require "src.events" require "src.ecs" require "src.utils" require "src.input" require "src.textures" require "src.phys" require "src.sprite" require "src.state_machine" require "src.im" require "src.room_editor" require "src.export" require "src.sound" require "src.specks" require "src.camera" SCR_WIDTH = 320 SCR_HEIGHT = 180 GRAVITY = 1000 TERMINAL_VELOCITY = 900 WindowScale = 1 register_input("Left", {{"key", "left"}, {"key", "a"}}) register_input("Right", {{"key", "right"}, {"key", "d"}}) register_input("Jump", {{"key", "space"}}) register_input("Dash", {{"key", "lshift"}}) register_input("Hot_Reload", {{"key", "r"}}) register_input("Right_Click", {{"mouse", 2}}) register_input("Left_Click", {{"mouse", 1}}) li = love.image la = love.audio lg = love.graphics lf = love.filesystem lw = love.window lk = love.keyboard lm = love.mouse lmath = love.math function init_global_systems() event_bind(global_on_update, "Body", body_sys) event_bind(global_on_update, "State_Machine", state_update_sys) event_bind(global_on_update, "Sprite", sprite_anim_sys) event_bind(global_on_update, "Speck_System", speck_update_sys) event_bind(global_on_update, "Speck_Entity", speck_entity_system) event_bind(global_on_update, "Camera", camera_move_system) event_bind(global_on_draw, "Sprite", sprite_draw_sys) event_bind(global_on_draw, "Tilemap", tilemap_draw_sys) event_bind(global_on_draw, "Speck_System", speck_draw_sys) end function reload_assets() -- TODO: -- would be cool if it also made already loaded sprites and specks reload -- probably do some expensive thing to update, but strip it on build load_textures_from() load_sounds_from() load_specks_from() print("Assets loaded.") end local function load_dir(path) local files = lf.getDirectoryItems(path) for _, file in ipairs(files) do local filepath = path.."/"..file if lf.getInfo(filepath).type == "directory" then load_dir(filepath) else lf.load(filepath)(); end end end function main_init() lg.setDefaultFilter("nearest", "nearest") viewport = lg.newCanvas(SCR_WIDTH, SCR_HEIGHT) reload_assets() load_dir("src/objs") load_dir("src/scenes") init_global_systems() end