Is there a way to use something other than display.getCurrentStage() to setFocus on touch event listeners?
Our problem:
We have to keep 2048x1536 as the content size in conf.lua because these dimensions are used thoroughly throughout. While setting the app up to be responsive to other device sizes, we have created a module which returns placement data so all works well there and we now have a responsive design.
However, the only problem is when using a touch event listener that needs to refer to display.getCurrentStage() to setFocus. So the currentStage will always return 2048 even when using different sizes to that.
Is there a way to use something else to setFocus? Tried a display.newRect but that didn’t work.
local gameStage = display.getCurrentStage() function onTouch (event) local t = event.target local phase = event.phase if "began" == phase then local parent = t.parent; parent:insert(t); gameStage:setFocus( t, event.id ) t.isFocus = true -- -- --Then Later -- -- elseif "ended" == phase or "cancelled" == phase then gameStage:setFocus( t, nil ) t.isFocus = false