Merge template-live-editor-mobile
This commit is contained in:
commit
9f21230005
10
app.lua
10
app.lua
|
@ -68,7 +68,15 @@ function love.run()
|
||||||
App.fake_mouse_press = nil
|
App.fake_mouse_press = nil
|
||||||
App.fake_mouse_release = nil
|
App.fake_mouse_release = nil
|
||||||
-- other methods dispatch to real hardware
|
-- other methods dispatch to real hardware
|
||||||
App.screen.resize = love.window.setMode
|
|
||||||
|
App.screen.resize = function(width, height, flags)
|
||||||
|
love.window.setMode(width, height, flags)
|
||||||
|
if OS == 'iOS' then
|
||||||
|
love.keyboard.setTextInput(true) -- magic. iOS seems to lose textinput events after calls to setMode.
|
||||||
|
-- https://github.com/love2d/love/issues/1959
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
App.screen.size = love.window.getMode
|
App.screen.size = love.window.getMode
|
||||||
App.screen.move = love.window.setPosition
|
App.screen.move = love.window.setPosition
|
||||||
App.screen.position = love.window.getPosition
|
App.screen.position = love.window.getPosition
|
||||||
|
|
9
main.lua
9
main.lua
|
@ -1,6 +1,8 @@
|
||||||
utf8 = require 'utf8'
|
utf8 = require 'utf8'
|
||||||
json = require 'json'
|
json = require 'json'
|
||||||
|
|
||||||
|
OS = love.system.getOS()
|
||||||
|
|
||||||
require 'app'
|
require 'app'
|
||||||
require 'test'
|
require 'test'
|
||||||
require 'live'
|
require 'live'
|
||||||
|
@ -8,8 +10,6 @@ require 'live'
|
||||||
require 'keychord'
|
require 'keychord'
|
||||||
require 'button'
|
require 'button'
|
||||||
|
|
||||||
OS = love.system.getOS()
|
|
||||||
|
|
||||||
-- delegate most business logic to a layer that can be reused by other projects
|
-- delegate most business logic to a layer that can be reused by other projects
|
||||||
require 'edit'
|
require 'edit'
|
||||||
Editor_state = {}
|
Editor_state = {}
|
||||||
|
@ -218,7 +218,10 @@ function App.keychord_press(chord, key)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
love.keyboard.setTextInput(true) -- magic. keeps iOS from losing textinput events after switching apps.
|
if OS == 'iOS' then
|
||||||
|
love.keyboard.setTextInput(true) -- magic. iOS is prone to losing textinput events.
|
||||||
|
-- https://github.com/love2d/love/issues/1959
|
||||||
|
end
|
||||||
-- ignore events for some time after window in focus (mostly alt-tab)
|
-- ignore events for some time after window in focus (mostly alt-tab)
|
||||||
if Current_time < Last_focus_time + 0.01 then
|
if Current_time < Last_focus_time + 0.01 then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user