66 lines
1.7 KiB
Text
66 lines
1.7 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, Text, Prototype, Anim
|
|
import "luxe: math" for Math
|
|
import "luxe: draw" for Draw
|
|
import "luxe: io" for IO
|
|
import "luxe: lx" for LX
|
|
|
|
import "field" for Field, Slots, Hand
|
|
import "utils/hex" for Hex
|
|
import "outline/app" for App
|
|
|
|
class Game is Ready {
|
|
|
|
construct ready() {
|
|
|
|
super("ready!")
|
|
|
|
app = App.new()
|
|
app.color = [0,0,0,1]
|
|
|
|
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, 100)
|
|
Text.create(_logo, Assets.material("luxe: material/font"), 42, "luxe: fonts/lato", [1,1,1,1])
|
|
Text.set_text(_logo, "Lorem Ipsum dolor sit amet")
|
|
|
|
_playField = Field.new(app.world)
|
|
Transform.set_pos(_playField.root, app.width/2, app.height/2 + 100, 0)
|
|
Transform.set_scale(_playField.root, 0.8, 0.8, 0.8)
|
|
_playField.add_slots(Slots)
|
|
|
|
_hand = Field.new(app.world)
|
|
Transform.set_pos(_hand.root, app.width/2, 50, 0)
|
|
Transform.set_scale(_hand.root, 0.8, 0.8, 0.8)
|
|
_hand.add_slots(Hand)
|
|
} //ready
|
|
|
|
tick(delta) {
|
|
|
|
var pos = Camera.screen_point_to_world(app.camera, Input.mouse_x(), Input.mouse_y())
|
|
pos = Hex.coord_to_pos(Hex.pos_to_coord(pos, 50), 50)
|
|
Transform.set_pos(_logo, pos.x, pos.y, 100)
|
|
|
|
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
|