Closed MikuAuahDark closed 7 years ago
No call should be made to
love.graphics.reset
andlove.graphics.origin
. Additionally, graphics state must be balanced!
This should already be the case. If not it's a bug, please report it.
love.mousepressed
,love.mousereleased
,love.mousemoved
,love.<more handles>
shouldn't be overridden. It's substitute is available, and additionally for mouse/touch events, handles the coordinates because letterboxing.
These event handlers are set up when you "show" a layout using the Love backend (in backend/love.lua). It sounds like you need your own custom backend, mostly identical to the Love backend except that the "show" function uses your substitute event handlers rather than Love's.
You can simply overwrite the Love backend's "show" function somewhere in your own code. Anything else you may need to change for your letterbox backend should be in that same file, for example getWindowSize, maybe.
Touch events and mouse events are same.
This shouldn't be hard to add. It would go in that same "show" function.
I accidentally edited your question instead of replying, and your first paragraph is lost now. Sorry about that.
Alright, I see..
One more question: How can I pass additional data to the backend? My framework is namespaced and isn't stored in global variable.
You should be able to overwrite backend functions from someplace that has access to your letterbox framework (e.g. in your replacement functions, have letterbox module available as an upvalue).
local backend = require 'luigi.backend.love'
local letterbox = require 'mystuff.letterbox'
backend.getWindowSize = function ()
return letterbox.geScreenWidth(), letterbox.getScreenHeight()
end
Sorry, but I mean they even not loaded as require
rather than with love.filesystem.load
.
But I get the idea, thank you very much.
I'd like to use LUIGI for my game, but it uses framework which has letterboxing, so it has these restrictions:
No call should be made to
love.graphics.reset
andlove.graphics.origin
. Additionally, graphics state must be balanced!love.mousepressed
,love.mousereleased
,love.mousemoved
,love.<more handles>
shouldn't be overridden. It's substitute is available, and additionally for mouse/touch events, handles the coordinates because letterboxing.Touch events and mouse events are same.