Reorganized code and assets.

This commit is contained in:
2025-10-05 15:24:48 -04:00
parent 7f8d79e00f
commit 03b5d1dafb
23 changed files with 57 additions and 23 deletions

View File

@@ -3,7 +3,7 @@
------------------------------------------------------------------------------
local make_class = require 'src.utils.classes'
local Sprite = require 'src.ui.sprite'
local Sprite = require 'src.graphics.sprite'
------------------------------------------------------------------------------

View File

@@ -1,66 +0,0 @@
------------------------------------------------------------------------------
-- Imports
------------------------------------------------------------------------------
local make_class = require 'src.utils.classes'
------------------------------------------------------------------------------
-- Class definitions
------------------------------------------------------------------------------
local Drawable = make_class()
------------------------------------------------------------------------------
-- Class methods
------------------------------------------------------------------------------
function Drawable:_init()
end
function Drawable:load()
end
function Drawable:update(_)
end
function Drawable:draw()
end
function Drawable:unload()
end
function Drawable:keypressed(_, _ , _)
end
function Drawable:textinput(_)
end
function Drawable:keyreleased(_, _)
end
function Drawable:mousemoved(_, _, _, _)
end
function Drawable:mousepressed(_, _, _)
end
function Drawable:mousereleased(_, _, _)
end
------------------------------------------------------------------------------
-- Module return
------------------------------------------------------------------------------
return Drawable

View File

@@ -1,48 +0,0 @@
------------------------------------------------------------------------------
-- Imports
------------------------------------------------------------------------------
local love = require 'love'
local make_class = require 'src.utils.classes'
local Drawable = require 'src.ui.drawable'
------------------------------------------------------------------------------
-- Class definitions
------------------------------------------------------------------------------
local Sprite = make_class(Drawable)
------------------------------------------------------------------------------
-- Class methods
------------------------------------------------------------------------------
function Sprite:_init(sprite_name, x, y)
self.sprite_name = sprite_name
self.x = (x ~= nil and x) or 0
self.y = (y ~= nil and y) or 0
end
function Sprite:load()
self.sprite = love.graphics.newImage(self.sprite_name)
end
function Sprite:draw()
if self.sprite ~= nil then
love.graphics.draw(self.sprite, self.x, self.y)
end
end
function Sprite:unload()
self.sprite = nil
end
------------------------------------------------------------------------------
-- Module return
------------------------------------------------------------------------------
return Sprite