import "luxe: game" for Ready import "luxe: assets" for Assets import "luxe: input" for Input, Key, MouseButton import "luxe: world" for World, Entity, Transform, Sprite, Values, Tags, Camera, Text import "luxe: math" for Math import "luxe: draw" for Draw import "luxe: io" for IO import "outline/app" for App class Game is Ready { construct ready() { super("ready!") app = App.new() System.print("render size: %(app.width) x %(app.height) @ %(app.scale)x") _spritecount = 0 var instructiontext = Entity.create(app.ui) var font = Assets.material("luxe: material/font") Transform.create(instructiontext) Transform.set_pos(instructiontext, 10, 10) Text.create(instructiontext, font, 32, "luxe: fonts/lato", [1,1,1,1]) Text.set_text(instructiontext, "right click to rapidly spawn sprites, left click to spawn one at a time") } //ready tick(delta) { if(Input.mouse_state_down(MouseButton.right)) { _logo = Entity.create(app.world, "sprite") Transform.create(_logo) var pos = Camera.screen_point_to_world(app.camera, Input.mouse_x(), Input.mouse_y()) Transform.set_pos(_logo, pos.x, pos.y, 0) Sprite.create(_logo, Assets.material("luxe: material/logo"), 128, 128) _spritecount = _spritecount + 1 System.print(_spritecount) } if(Input.mouse_state_pressed(MouseButton.left)) { _logo = Entity.create(app.world, "sprite") Transform.create(_logo) var pos = Camera.screen_point_to_world(app.camera, Input.mouse_x(), Input.mouse_y()) Transform.set_pos(_logo, pos.x, pos.y, 0) Sprite.create(_logo, Assets.material("luxe: material/logo"), 128, 128) _spritecount = _spritecount + 1 System.print(_spritecount) } 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