function main() math.randomseed(os.time()) engine_window_init(96,64,"Game") texture = engine_texture_create(8,8) engine_texture_from_file(texture,bp("texture/fier.rgba")) while true do event = engine_event_get() eventData = {engine_lua_event_get_data(event)} if eventData[1] ~= ENGINE_EVENT_TYPE_NONE then handleEvent(event,eventData) else tick() end engine_event_free(event) end end lastFrame = 0 function tick() engine_texture_render_2d(texture,math.random(-8,102),math.random(-8,72)) engine_window_present() trackFps() local curFrame = engine_time_get() local wait = 16 - (curFrame - lastFrame) if wait > 0 then engine_time_sleep(wait) end lastFrame = engine_time_get() end function handleEvent(event,eventData) if eventData[1] == ENGINE_EVENT_TYPE_EXIT then os.exit() end if eventData[1] == ENGINE_EVENT_TYPE_INPUT_KB then for _,val in pairs(eventData) do print(tostring(val)) end end end local frameSec = 0 local lastSec = 0 function trackFps() frameSec = frameSec + 1 t = engine_time_get() if t - lastSec >= 1000 then print("FPS: " ..tostring(frameSec)) lastSec = t frameSec = 0 end end function bp(pth) return basepath .. "/mods/main/" ..pth end basepath = (debug.getinfo(1, "S").source:sub(2):match("(.*[/\\])") or "./"):sub(1,-2) .. "/../../.." -- Lazy, fix package.path = basepath.. "/mods/main/script/?.lua;" ..basepath.. "/mods/main/script/?/main.lua;" ..package.path main()