]> git.mcshandy.xyz Git - sumeriangame/commitdiff
Fill out some more framework for configuration and asset management. Export script...
authorRandy McShandy <randy@mcshandy.xyz>
Fri, 7 Nov 2025 04:47:22 +0000 (22:47 -0600)
committerRandy McShandy <randy@mcshandy.xyz>
Fri, 7 Nov 2025 04:47:22 +0000 (22:47 -0600)
main/.love-file
main/assets.lua [new file with mode: 0644]
main/conf.lua [new file with mode: 0644]
main/export/game.love [new file with mode: 0644]
main/love_export.sh [new file with mode: 0755]
main/main.lua

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e1ef230ed63acd4f4f9e484f1b6cea2edf509f34 100644 (file)
@@ -0,0 +1,6 @@
+main.lua
+conf.lua
+assets.lua
+assets/Intro.wav
+assets/SantakkuM.ttf
+assets/transition1.wav
diff --git a/main/assets.lua b/main/assets.lua
new file mode 100644 (file)
index 0000000..8c898e2
--- /dev/null
@@ -0,0 +1,42 @@
+-- assets.lua
+-- Asset storage
+
+-- You need a cuneiform font for this one
+IntroMessage = "\nπ’Š©π’Œ†π’‹Όπ’€―π’€­π’Άπ’ˆ¨π’‚—\nπ’“π’‹§π’ˆ π’ƒ²\n𒍣𒂡"
+
+local assets = {}
+
+AssetClass =
+{
+  Image       = 1,
+  Font        = 2,
+  AudioSource = 3,
+}
+
+local AssetTables = {}
+for k,v in pairs(AssetClass) do
+  table.insert(AssetTables, {})
+end
+
+function assets.store_font(name, path, font_size)
+  local new = love.graphics.newFont(path, font_size)
+  AssetTables[AssetClass.Font][name] = new
+end
+
+function assets.get_font(name)
+  return AssetTables[AssetClass.Font][name]
+end
+
+function assets.store_source(name, path, source_type)
+  AssetTables[AssetClass.AudioSource][name] = love.audio.newSource(path, source_type)
+end
+
+function assets.get_source(name)
+  return AssetTables[AssetClass.AudioSource][name]
+end
+
+assets.store_font("Cuneiform16", "assets/SantakkuM.ttf", 36)
+assets.store_source("intro", "assets/Intro.wav", "static")
+assets.store_source("transition1", "assets/transition1.wav", "static")
+
+return assets
diff --git a/main/conf.lua b/main/conf.lua
new file mode 100644 (file)
index 0000000..6266e39
--- /dev/null
@@ -0,0 +1,22 @@
+-- conf.lua
+-- All shared configuration options
+
+local config = {}
+
+-- Members of this table should conform to the config scheme described at https://www.love2d.org/wiki/Config_Files
+-- and will be automatically passed to Love in the callback below
+config.window =
+{
+  width       = 800,
+  height      = 600,
+  title       = "title",
+  fullscreen  = false
+}
+
+function love.conf(t)
+  for k,v in pairs(config.window) do
+    t.window[k] = v
+  end
+end
+
+return config
diff --git a/main/export/game.love b/main/export/game.love
new file mode 100644 (file)
index 0000000..29cb294
Binary files /dev/null and b/main/export/game.love differ
diff --git a/main/love_export.sh b/main/love_export.sh
new file mode 100755 (executable)
index 0000000..05fd4ff
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+if [[ -f export/game.love ]]; then
+  rm export/game.love
+fi
+cat .love-file | zip -r export/game.love -@
index 49b9e9cbb1c243e613f43625b81e9dfa132e3b5d..e1acc53b82fa84f4af569b1b93ca1908bc306945 100644 (file)
@@ -1,4 +1,11 @@
+-- main.lua
+
+local conf = require('conf')
+local assets = require('assets')
+
 function love.load()
+               love.graphics.setFont(assets.get_font('Cuneiform16'))
+    love.audio.play(assets.get_source("intro"))
 end
 
 function love.update(delta_time)
@@ -8,4 +15,5 @@ function love.keypressed(key)
 end
 
 function love.draw()
+  love.graphics.print(IntroMessage, math.floor((conf.window.width/16) * 1), math.floor((conf.window.height/16) * 1))
 end