garden/main.lua
2025-01-01 15:14:01 +09:00

75 lines
1.4 KiB
Lua

-- Imports
local window = require("window")
local button = require("button")
local rooms = require("rooms")
local current_room = rooms['default']
screen = {
x = 0, y = 60,
width = 320,
height = 240,
}
screen.mousepressed = window.mousepressed(function (self, x, y, button)
end)
screen.draw = window.draw(function (self)
current_room:draw()
window.draw_border(self.width, self.height)
end)
inventory = {
x = 0, y = 0,
width = screen.width,
height = 60,
items = {}
}
inventory.draw = window.draw(function (self)
for _, item in ipairs(self.items) do
-- item:setpos(x, y)
item:draw()
end
window.draw_border(self.width, self.height)
end)
log = {
x = inventory.width , y = 0,
width = 80,
height = HEIGHT,
}
log.draw = window.draw(function (self)
window.draw_border(self.width, self.height)
end)
function love.load()
timer = 0
end
function love.mousepressed(x, y, button)
local x, y = x / MULTIPLIER, y / MULTIPLIER
end
function love.update(dt)
timer = timer + dt
end
mw, mh = 0, 0
if love.system.getOS() == 'android' then
mw = (love.window.getWidth() - WIDTH) / 2
mh = (love.window.getHeight() - HEIGHT) / 2
end
function love.draw()
love.graphics.push()
love.graphics.translate(mw, mh)
love.graphics.scale(MULTIPLIER)
screen:draw()
inventory:draw()
log:draw()
love.graphics.pop()
end