2022-03-03 20:24:10 +01:00
|
|
|
local game = require "game"
|
|
|
|
|
|
|
|
game.OS = love.system.getOS()
|
|
|
|
game.OSTYPE = "PC"
|
|
|
|
if game.OS == 'Horizon' then
|
|
|
|
game.OSTYPE = love._console_name -- 3DS or Switch
|
|
|
|
end
|
|
|
|
if game.OS == "Android" or game.OS == "iOS" then game.OSTYPE = "Mobile" end
|
|
|
|
|
|
|
|
lg = love.graphics
|
|
|
|
|
|
|
|
|
2022-03-04 14:03:06 +01:00
|
|
|
if game.OS~="Horizon" then push = require "lib/push" end
|
2022-03-03 20:24:10 +01:00
|
|
|
|
|
|
|
function love.load()
|
|
|
|
lg.setBackgroundColor(31/255,14/255,28/255)
|
|
|
|
|
|
|
|
if pcall (lg.set3D, true) == true then
|
|
|
|
lg.set3D(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
game:changesize(400,240)
|
|
|
|
lg.setDefaultFilter("nearest")
|
|
|
|
if game.OS ~= "Horizon" then
|
|
|
|
game:changesize(416,234)
|
2022-03-04 14:17:14 +01:00
|
|
|
love.window.setTitle('Neutron')
|
2022-03-03 20:24:10 +01:00
|
|
|
w,h = love.window.getDesktopDimensions()
|
|
|
|
res = game.OSTYPE=="PC"
|
|
|
|
push:setupScreen(game.WIDTH, game.HEIGHT, w, h, {fullscreen = true,resizable = res, pixelperfect = true})
|
|
|
|
push:setBorderColor(0.161,0.157, 0.192,1)
|
|
|
|
end
|
2022-03-04 14:03:06 +01:00
|
|
|
|
|
|
|
game.scenes:main(game)
|
2022-03-03 20:24:10 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function love.draw(screen)
|
2022-03-04 14:17:14 +01:00
|
|
|
if game.OSTYPE~="Horizon" then push:start() end
|
2022-03-03 20:24:10 +01:00
|
|
|
game:draw(screen)
|
2022-03-04 14:17:14 +01:00
|
|
|
if game.OSTYPE~="Horizon" then push:finish() end
|
2022-03-03 20:24:10 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function love.update()
|
|
|
|
dt = love.timer.getDelta()
|
|
|
|
game:step(dt)
|
|
|
|
end
|
|
|
|
|
|
|
|
function love.keypressed(key,scancode)
|
|
|
|
game.inputs.keys[scancode] = true
|
|
|
|
end
|
2022-03-04 14:17:14 +01:00
|
|
|
function love.gamepadpressed(joystick, button) game.inputs.buttons[button] = true
|
2022-03-03 20:24:10 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function love.keyreleased(key,scancode)
|
|
|
|
game.inputs.keys[scancode] = false
|
|
|
|
end
|
|
|
|
|
|
|
|
function love.gamepadreleased(joystick, button)
|
|
|
|
game.inputs.buttons[button] = false
|
|
|
|
end
|
|
|
|
|
|
|
|
function love.gamepadaxis( joystick, axis, value )
|
|
|
|
game.inputs.axis[axis] = value
|
|
|
|
end
|
|
|
|
|
|
|
|
function love.resize(w, h)
|
|
|
|
if game.OSTYPE~="3DS" then push:resize(w, h) end
|
|
|
|
end
|
2022-03-04 10:39:02 +01:00
|
|
|
|
|
|
|
function love.mousepressed(x,y,button,istouch,presses)
|
|
|
|
-- Format positions according to screen
|
|
|
|
if game.OS ~= "Horizon" then
|
|
|
|
x,y = push:toGame(x,y)
|
|
|
|
end
|
2022-03-04 14:19:03 +01:00
|
|
|
if x~=nil and y~=nil then game:MouseCallback(x,y,presses) end
|
2022-03-04 10:39:02 +01:00
|
|
|
end
|