experimental mobile support (maybe!!)
This commit is contained in:
parent
18d9d681b8
commit
52ee57f231
1 changed files with 15 additions and 5 deletions
10
main.lua
10
main.lua
|
@ -23,6 +23,7 @@ fonts = {}
|
||||||
cursors = {}
|
cursors = {}
|
||||||
|
|
||||||
debug = false
|
debug = false
|
||||||
|
is_mobile = love.system.getOS() == "Android" or love.system.getOS() == "iOS"
|
||||||
|
|
||||||
function newAnimation(image, width, height)
|
function newAnimation(image, width, height)
|
||||||
local animation = {}
|
local animation = {}
|
||||||
|
@ -54,9 +55,16 @@ function love.load()
|
||||||
cursors.hover = love.mouse.newCursor('assets/sprites/cursor/hand.png', sprites['cursor/hand']:getWidth()/2, sprites['cursor/hand']:getHeight()/2)
|
cursors.hover = love.mouse.newCursor('assets/sprites/cursor/hand.png', sprites['cursor/hand']:getWidth()/2, sprites['cursor/hand']:getHeight()/2)
|
||||||
cursors.drag = love.mouse.newCursor('assets/sprites/cursor/dragging.png', sprites['cursor/dragging']:getWidth()/2, sprites['cursor/dragging']:getHeight()/2)
|
cursors.drag = love.mouse.newCursor('assets/sprites/cursor/dragging.png', sprites['cursor/dragging']:getWidth()/2, sprites['cursor/dragging']:getHeight()/2)
|
||||||
|
|
||||||
|
if not is_mobile then
|
||||||
love.mouse.setCursor(cursors.default)
|
love.mouse.setCursor(cursors.default)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if is_mobile then
|
||||||
|
local winwidth, winheight = love.graphics.getDimensions( )
|
||||||
|
love.window.setMode(winwidth, winheight, {borderless=true, resizable=false, minwidth=705, minheight=510, fullscreen=true})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local cursor
|
local cursor
|
||||||
function setCursor(mouse)
|
function setCursor(mouse)
|
||||||
cursor = mouse
|
cursor = mouse
|
||||||
|
@ -73,12 +81,14 @@ function love.update(dt)
|
||||||
if scene.update then scene.update(dt) end
|
if scene.update then scene.update(dt) end
|
||||||
bench.stopBenchmark('update')
|
bench.stopBenchmark('update')
|
||||||
|
|
||||||
|
if not is_mobile then
|
||||||
if cursor then
|
if cursor then
|
||||||
love.mouse.setCursor(cursor)
|
love.mouse.setCursor(cursor)
|
||||||
else
|
else
|
||||||
love.mouse.setCursor(cursors.default)
|
love.mouse.setCursor(cursors.default)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
love.graphics.setFont(fonts.default)
|
love.graphics.setFont(fonts.default)
|
||||||
|
|
Loading…
Reference in a new issue