-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
push v1.0 #44
Conversation
I can test to see if #42 is fixed tonight, and more generally test this rewrite. Sounds good though! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, it's been a while I don't read Lua code haha
I think you could run your code through a prettifier to get consistent indentation / style.
If the canvas functionality is still working then the API change from : to . shouldn't make too much of a difference, if properly documented. Nice! I'm happy to see this library still being used and adapted to modern use cases. :-)
"mouse-input" | ||
--[[ | ||
"canvases-shaders", | ||
"stencil" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the other examples not working? The more the merrier :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, they should work, so I'll try to fix them up. I think I left them commented out because they used shaders, and I don't know if LOVE 0.10 shaders are compatible with LOVE 11. I'll try them out and let you know if they work okay.
#42 is still a problem, FPS is unchanged from before when canvas == trues. However as canvas is set to false by default now it's not as much of a problem. |
To get my game running using this all I had to do was swap 'push:' with 'push.', add love.window.setMode, modify push.setupScreen and change mouseX == nil to mouseX == false, as push.toGame returns false now when mouse pressed outside in bezel area of window. |
Hmm, weird. Are canvases usually slow on Android? If this is a LOVE issue I don't think I can work around this. |
I don't have much experiences with canvases but I just tried creating a project with 4 of them, rendering a 1920x1080 image to each and then drawing the canvases and FPS was locked at 60. Compare that to drawing just one 1920x1080 image using push.lua and canvas = true (3 canvases are created according to love.graphics.stats()) where FPS is 23. Test device is P20 Lite. |
@FormularSumo Okay, so I've been thinking about ways to solve this, I believe what's causing this is the shader handling code. I feel like the best solution would be to scrap the shader handling code entirely and let devs handle shaders since shaders will apply within the canvas anyway. This would probably fix the slowdown issue since the canvas feature would be reduced to simply rendering to a canvas instead of handling shaders for each frame. However, this would remove a known feature of push and I don't want to do that without @Ulydev's consent. Another solution would be to refactor the shader code, but in order to optimize it the shader feature might need to be entirely reworked API-wise. |
Is this a good thing? When I see However, usually I'd also see modules let users create their state object:
That would follow what kikito wrote up about stateless modules.
That sounds great!
That sounds really interesting. I guess it maintains crisp pixels? |
If you're talking about internal variables push uses for operation, yeah, it still has them. They are no longer exposed to the user within the Other than the fact that this change makes using
Yeah 😀 |
New PR: #46
Over the past few days, I spent some time rewriting and optimizing push, and present a potential v1.0 update:
push:function()
is nowpush.function()
.push.setupScreen(pushWidth, pushHeight, {upscale = ..., canvas = ...})
upscale
(string): upscale push's resolution to the current window size"normal"
: fit to the current window size, preserving aspect ratio"pixel-perfect"
: pixel-perfect scaling using integer scaling (for values ≥1, otherwise uses normal scaling)"stretched"
: stretch to the current window sizecanvas
(bool): use and upscale canvas set to push's resolutionpush.resize(width, height)
.push:setBackgroundColor()
, since it was essentially just an integrated alias forlove.graphics.setBackgroundColor()
.push:apply()
, since it was pretty limited in functionality, only serving as an alias forpush:start()
andpush:finish()
(plus, API changes will require devs to change their code anyway).low-res
example.mouse-input
example.An additional note: I think the canvas API is really cool, but it could use a little cleaning up and tweaks. Its code is mostly untouched in my rewrite, so it should work the same for now.
Also, I wanted to make the screenshot on the README a GIF like the original one, but I wasn't able to record one properly.