JoseTomasTocino / freegemas

Freegemas is an open source version of the well known Bejeweled, built in C++ using SDL2
GNU General Public License v2.0
61 stars 18 forks source link

Optimize main loop #41

Closed midzer closed 10 months ago

midzer commented 10 months ago

Hi,

Great game! :) Because I like it so much, I was working on a web port of Freegemas.

On the go, I've optimized main loop to lower CPU usage to better support older mobile devices.

In addition, proper scaling for all resolutions with SDL_RenderSetLogicalSize(), no more manual recalcing of mouse position on resize any more!

For the native game, relevant changes are mainly in go_window files

https://github.com/JoseTomasTocino/freegemas/compare/master...midzer:freegemas:emscripten

Let's talk about this. If you're interested, I can create a new branch and pick those changes for a PR.

Have a nice week midzer

sharkwouter commented 10 months ago

Hey @midzer, thanks for reporting this! I wouldn't mind it running a bit faster, but it would be nice to keep the ability to resize the window and the game to fill it. How much of a difference does each of your changes make?

What's missing for me to be able to just merge your work here would be that I don't really understand the changes in the CMakeLists.txt file and that the main is now Emscripten specific and will not compile for other systems anymore.

midzer commented 10 months ago

Hi @sharkwouter and thanks for your reply :)

I would pick relevant changed lines manually (without Emscripten) in a separate branch and open a PR.

Then we can check together. Those changes specifically for the web port, we could look at later.

sharkwouter commented 10 months ago

That's cool with me. I do think it would be good to have the web port in this repo in the end as well, though.

midzer commented 10 months ago

Yes, let's investigate a proper way to integrate it afterwards.

midzer commented 10 months ago

Let's close this one for good and discuss further changes regarding the web port in another issue.

sharkwouter commented 10 months ago

Cool, thanks for the contribution!