aboutsummaryrefslogtreecommitdiff
path: root/src/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.lua')
-rw-r--r--src/init.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/init.lua b/src/init.lua
new file mode 100644
index 0000000..c18f175
--- /dev/null
+++ b/src/init.lua
@@ -0,0 +1,47 @@
+require "src.events"
+require "src.ecs"
+require "src.utils"
+require "src.input"
+require "src.textures"
+
+SCR_WIDTH = 320
+SCR_HEIGHT = 180
+WindowScale = 1
+
+register_input("Left", {{"key", "left"}, {"key", "a"}})
+register_input("Right", {{"key", "right"}, {"key", "d"}})
+register_input("Down", {{"key", "down"}, {"key", "s"}})
+register_input("Up", {{"key", "up"}, {"key", "w"}})
+
+register_input("Right_Click", {{"mouse", 1}})
+register_input("Left_Click", {{"mouse", 2}})
+
+local lg = love.graphics
+local lf = love.filesystem
+
+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)
+
+ load_textures_from()
+
+ love.window.setMode(SCR_WIDTH, SCR_HEIGHT, {fullscreen = false})
+
+ load_dir("src/objs")
+ load_dir("src/scenes")
+end
+