58 lines
1.3 KiB
Text
58 lines
1.3 KiB
Text
import "luxe: game" for Ready
|
|
import "luxe: assets" for Assets
|
|
import "luxe: input" for Input, Key
|
|
import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera
|
|
import "luxe: math" for Math
|
|
import "luxe: draw" for Draw
|
|
import "luxe: io" for IO
|
|
|
|
import "outline/app" for App
|
|
import "spine" for Spine
|
|
|
|
class Game is Ready {
|
|
|
|
construct ready() {
|
|
|
|
super("ready!")
|
|
|
|
app = App.new()
|
|
|
|
System.print("render size: %(app.width) x %(app.height) @ %(app.scale)x")
|
|
|
|
_logo = Entity.create(app.world, "sprite")
|
|
Transform.create(_logo)
|
|
Transform.set_pos(_logo, app.width/2, app.height/2, 0)
|
|
Sprite.create(_logo, Assets.material("luxe: material/logo"), 128, 128)
|
|
|
|
|
|
var spine_asset = Spine.parse("assets/down_the_mountain/snowplayers")
|
|
_debug = Draw.create(World.render_set(app.world))
|
|
spine_asset.draw_bones(_debug)
|
|
spine_asset.draw_outlines(_debug)
|
|
Draw.commit(_debug)
|
|
} //ready
|
|
|
|
tick(delta) {
|
|
|
|
var pos = Camera.screen_point_to_world(app.camera, Input.mouse_x(), Input.mouse_y())
|
|
Transform.set_pos(_logo, pos.x, pos.y, 0)
|
|
|
|
if(Input.key_state_released(Key.escape)) {
|
|
IO.shutdown()
|
|
}
|
|
|
|
app.color.r = app.color.g = app.color.b = (IO.timestamp()/20 % 1)
|
|
|
|
} //tick
|
|
|
|
destroy() {
|
|
|
|
System.print("unready!")
|
|
app.destroy()
|
|
|
|
} //destroy
|
|
|
|
app { _app }
|
|
app=(v) { _app=v }
|
|
|
|
} //Game
|