79 lines
1.4 KiB
Lua
79 lines
1.4 KiB
Lua
|
|
-- Cat Haven - Main Entry Point
|
||
|
|
-- LOVR 2023 (v1.4) compatible
|
||
|
|
|
||
|
|
local core = nil
|
||
|
|
local voxel = nil
|
||
|
|
local cat = nil
|
||
|
|
local house = nil
|
||
|
|
local ui = nil
|
||
|
|
local audio = nil
|
||
|
|
|
||
|
|
function lovr.load()
|
||
|
|
core = require('src.core')
|
||
|
|
voxel = require('src.voxel.init')
|
||
|
|
cat = require('src.cat.init')
|
||
|
|
house = require('src.house.init')
|
||
|
|
ui = require('src.ui.init')
|
||
|
|
audio = require('src.audio.init')
|
||
|
|
|
||
|
|
if core.init then
|
||
|
|
core.init()
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
function lovr.update(dt)
|
||
|
|
if core.update then
|
||
|
|
core.update(dt)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
function lovr.draw(pass)
|
||
|
|
if voxel.renderWorld then
|
||
|
|
voxel.renderWorld(pass)
|
||
|
|
end
|
||
|
|
if cat.renderCats then
|
||
|
|
cat.renderCats(pass)
|
||
|
|
end
|
||
|
|
if house.renderFurniture then
|
||
|
|
house.renderFurniture(pass)
|
||
|
|
end
|
||
|
|
if ui.renderHUD then
|
||
|
|
ui.renderHUD(pass)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
function lovr.mousepressed(x, y, button)
|
||
|
|
if ui.handleMousePress then
|
||
|
|
ui.handleMousePress(x, y, button)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
function lovr.keypressed(key)
|
||
|
|
if key == 'escape' then
|
||
|
|
if core.togglePause then
|
||
|
|
core.togglePause()
|
||
|
|
end
|
||
|
|
end
|
||
|
|
if key == 's' and lovr.headset and lovr.headset.isDown then
|
||
|
|
if lovr.headset.isDown('rthumb') then
|
||
|
|
if core.saveGame then
|
||
|
|
core.saveGame()
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
if key == 'l' and lovr.headset and lovr.headset.isDown then
|
||
|
|
if lovr.headset.isDown('rthumb') then
|
||
|
|
if core.loadGame then
|
||
|
|
core.loadGame()
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
function lovr.quit()
|
||
|
|
if core.saveGame then
|
||
|
|
core.saveGame()
|
||
|
|
end
|
||
|
|
return false
|
||
|
|
end
|