From 36fbc5b43fa1874cc892bebda044f96538a57b89 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Mon, 7 Oct 2024 15:23:04 +0300 Subject: [PATCH] move lua script to lua data --- apps/lua/data/scripts/game.lua | 31 +++++++++++++++++++++++++++++++ apps/scenery/scenes/ingame.c | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 apps/lua/data/scripts/game.lua diff --git a/apps/lua/data/scripts/game.lua b/apps/lua/data/scripts/game.lua new file mode 100644 index 0000000..f571881 --- /dev/null +++ b/apps/lua/data/scripts/game.lua @@ -0,0 +1,31 @@ +ORIGIN = { x = 320, y = 180 } +RADIUS = 48 +offset = { x = 0, y = 0 } +angle = 0 + +function game_tick() + rectangle { + rect = { x = 0, y = 0, w = 640, h = 360 }, + color = { r = 127, g = 0, b = 127, a = 255 }, + } + + sprite { + path = "/assets/title.png", + rect = { + x = 320 - (320 / 2), + y = 180 - (128 / 2), + w = 320, + h = 128, + }, + } + + text { + string = "IT KEEPS HAPPENING", + position = offset, + font = "/fonts/kenney-pixel.ttf", + } + + offset.x = ORIGIN.x + (math.cos(angle) * RADIUS) + offset.y = ORIGIN.y + (math.sin(angle) * RADIUS) + angle = angle + 0.1 +end diff --git a/apps/scenery/scenes/ingame.c b/apps/scenery/scenes/ingame.c index b7e6d1f..3f8d175 100644 --- a/apps/scenery/scenes/ingame.c +++ b/apps/scenery/scenes/ingame.c @@ -106,7 +106,7 @@ Scene *ingame_scene(State *state) { new_scene->cam = (Camera){ .pos = { 32, 0, 1 }, .up = { 0, 1, 0 }, .fov = (float)M_PI_2 }; - m_audio(m_set("music/mod65.xm"), + m_audio(m_set(path, "music/mod65.xm"), m_opt(channel, "soundtrack"), m_opt(repeat, true));