me.fier.engine/assets/scripts/main.lua
2023-05-15 10:41:14 +02:00

44 lines
895 B
Lua

engine_window_init(96,64,"Game")
texture = engine_texture_create(8,8)
engine_texture_from_file(texture,"assets/textures/fier0.rgba")
--[[
void handleEvent(struct ENGINE_EVENT * event) {
if (event->type == ENGINE_EVENT_TYPE_EXIT) {
exit(0);
}
}
]]--
frame = 0
frameSec = 0
lastSec = 0
iters = 0
function tick()
frame = frame + 1
frameSec = frameSec + 1
t = engine_time_get()
if t - lastSec >= 1000 then
print("FPS: " ..tostring(frameSec))
lastSec = t
frameSec = 0
iters = iters + 1
if iters > 4 then os.exit() end
end
engine_window_present()
end
while true do
event = engine_event_get()
--[[
if (event->type != ENGINE_EVENT_TYPE_NONE) {
handleEvent(event);
} else {
tick();
}
]]--
engine_free(event) -- We can't actually do anything with the event yet (no Lua implementation)
tick()
engine_texture_render_2d(texture,math.random(-8,102),math.random(-8,72))
end