r/raylib • u/Zeta_ggwp • 10d ago
Help Decoupling Gameplay From Screen Size
I am working on a clone of the arcade game asteroids to learn C and Raylib, but I ran into a problem. If the game is played in different screen sizes, the player can see more space and thus, asteroids might seem like they are spawning too close to them.
How would I go about making the gameplay not/less dependant on the screen size and resolution?
8
Upvotes
3
u/Inevitable-Door-6250 10d ago edited 10d ago
One option would be setting the spawn range/area for the asteroids based on screen size. Another would be scaling everything rendered based on screen size.
2
u/Pitiful-Main-1544 10d ago
Best way would be using a RendexTexture2D, drawing to the render texture and then scaling it up based on the current screen size.
1
u/CreepyConference2468 10d ago edited 10d ago
A pattern that I'm thinking is: