Reorganized code and assets.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local make_class = require 'src.utils.classes'
|
||||
local Sprite = require 'src.ui.sprite'
|
||||
local Sprite = require 'src.graphics.sprite'
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user