-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Changes in preparation for Issue 3372 #3520
Conversation
- uses glfwGetFramebufferSize to retrieve the proper size
I also want to add that if you would prefer to wait until the changes are pushed to emscripten, it is obviously no issue with me. At this stage I have no clue if/when it will be merged as it has been in "waiting for somebody to approve" for several days now. |
@ubkp in my local test it seems to work, but I would definitely feel a lot more confident if I could test it with a piece of code I did not write to make sure that it works. Could you point me to a program/test that I can experiment with fullscreen mode? |
@ypujante Since the
But there's another option through emscripten's fullscreen with:
This one can be tested directly on any of the examples, since they all use Edit: correction. |
@ubkp thank you for your feedback. I will double check that fullscreen works as you point out. Note that emscripten provides a |
I have spent some more time looking at the (raylib) code and some are my preliminary findings (note that all my findings are based on the main branch latest as of this writing a92c34d, not my changes)
I am not saying that bypassing glfw is a bad thing, but I feel like it should be consistent: if the I believe my changes are going the opposite direction: using glfw as the source of truth when it comes to size. I will follow back with more findings... |
As you can see I have done a follow up PR |
@ypujante thanks for the detailed analysis. Afair, Also, I personally would love to completely replace GLFW dependency on Web and just use the functionality already exposed by Emscripten, I think going through that middle-layer will generate more trouble than benefit in the future. It made sense in the past when all code was in a single file but at this moment, every platform can be controlled using its own base libraries. |
@raysan5 I would be happy to take a look at "replace GLFW dependency on Web and just use the functionality already exposed by Emscripten" if you want. That being said I don't want to spend a huge amount of time on this and then be turned down because the "PLATFORM_WEB is currently stable and that represent too many changes" Just want to be clear about where I am standing... I am closing this PR as well. |
@ypujante If it's not already clear, large modifications create a burden on verification by the regular committers as well as Ramon. And then there is now more code to maintain. These are not small matters. |
@orcmid For the record, this PR as well as the other one, were not "out of the blue" but based on issue #3772 that was open well over a month ago including 53 comments and I have been working on it almost this entire time as I was getting feedback along the way. Also for the record, I was not expecting either PR, in their state, to be accepted. I understand that this is not my project and that the owner has the burden of maintaining it after the fact. I also believe that waiting for my emscripten changes to be merged will result in less changes to raylib which is obviously preferable for this project. Like I said, if @raysan5 wants me to take a look at "replace GLFW dependency on Web and just use the functionality already exposed by Emscripten" given the amount of time I have already spent looking at emscripten, I think it might be easier for me and I would be more than happy to do it given his blessing. |
@ypujante At this moment I'm not aware of the cost and implications of replacing the GLFW usage by a direct Emscripten usage, if it simplifies the current implementation and reduces the amount of code and complexity (replacing the GLFW intermediate callbacks), I would go for it. If you want to take a look to it and evaluate how it can be accomplished, you are welcome. |
Following our discussion on #3372, I am opening this PR.
The idea is that raylib can safely use
glfwGetFramebufferSize
to retrieve the correct frame buffer size. Before my emscripten PR is merged, it simply returnswidth
andheight
(see code) so the screenScale will be 1.The change in
WindowSizeCallback
is to follow what happens duringInitPlatform
The change in
EmscriptenResizeCallback
is to simply callSetWindowSize
as it will trigger the callback. Setting the canvas size explicitly (which is what is done prior to this PR) is in my opinion not the right thing to do anyway because it bypasses glfw.Once the emscripten changes have been pushed, 4k is enabled by doing something like this:
which can be done directly in the client code. I can imagine that there could be a convenient API provided by raylib so that client code does not have to write something like this. It could also be tied to the flag
FLAG_WINDOW_HIGHDPI
if that was the path you would like to follow.Although I did test my changes on my (own) local example, I would be more than happy to run deeper tests if you let me know how you proceed when you make this kind of changes so as to make sure I did not break anything.
Thank you