lemon32767 / ccleste

Celeste Classic C source port for 3DS and PC.
206 stars 38 forks source link

Scaling the contents of the game window #7

Closed rien333 closed 3 years ago

rien333 commented 3 years ago

Thank you so much for this great little project. 😊

Not sure if this is my fault, but currently the content's game window don't really scale nicely (in fact, they seemingly don't do so at all). With this, I mean that the window contents don't react to being launched or changed to a fullscreen window state, nor to any resize events. This is especially cumbersome on HiDPI screens, where the window launches in an incredibly tiny state.

It doesn't get any bigger than this:

2021-01-27-1611751423

If I scale, the following is displayed (also note the artifacts below and next to the game contents, those exist within the window, but obviously outside any "playable" area):

https://user-images.githubusercontent.com/10417027/105995910-edc85200-60a9-11eb-8f25-ba68aea77f4a.mp4

I'm on Arch Linux (kernel version 5.10.10), and I use X11.

rien333 commented 3 years ago

@gek169 The documentation (readme.md) clearly states:

PC and 3DS are the main supported platforms, though other people are maintaining ports to other platforms.

tbh, it could be that I've been misled in someway (I know little about the history of this project), but lets see what the developers think of making this work somewhat nicer on PC. (actually, the code is riddled with #ifdef 3DS pragmas, so the code already contains portions dedicated to the 3DS and portions specific to PC)

rien333 commented 3 years ago

A shame, I actually found this project in my package manager, so I kinda expected it to treat PCs as first class citizens. Feel free to close if this is of little interest, maybe I can live with a dirty patch.

lemon32767 commented 3 years ago

Fixed in https://github.com/lemon32767/ccleste/commit/9518a2c42ebf50184dfb5aef73e409e098160841. (Or it should be; I don't have a high DPI display to test this on. Leaving this open in case you have any issues with this).

Also, PC is a "first class citizen", not just for debugging. The code is really messy because I first wrote it with 3DS support in mind mainly, which required me to use SDL 1.2, and then I kept bolting on features and fixes for better PC support, so I apologize for that.

rien333 commented 3 years ago

The scaling works greats, thank you so much!

The only thing I noticed is that each scale operation leaves behind artifacts or traces (even more so than before). Personally, it doesn't bother me so much, as I normally don't go around scaling my game windows all the time. So close if you're satisfied ☺

Here's a video demonstration of me resizing the window and the funky visual results this creates (note that the main content always renders nicely though; it's only the "letterboxing" that acts "buggy")

https://user-images.githubusercontent.com/10417027/106391716-0e1c4780-63ef-11eb-827b-f6efa59b1463.mp4

lemon32767 commented 3 years ago

Oops, forgot to clear the renderer. https://github.com/lemon32767/ccleste/commit/de51aa62616a327905853ec5acf576f54c67d733 should fix it.

rien333 commented 3 years ago

That does it, lovely <3