So I recently started working on my first 2D (side-scrolling) game engine written in C++ with SDL. I used the awesome tutorials over at sdltutorials.com to get started and all was great. I did find a few areas however in which I had no clarification on and so had to kinda guess on how to achieve it. The first was depth. I wanted the foreground and background to appear closer and further away respectively. I did a little research and ended up blitting large surfaces which moved at different speeds relative to the viewport, which I believe is called 'parallaxing'. This worked fine so I was pretty happy with the result and ease! I then wasn't sure about the screen size and resizing everything if needed. I found that SDL had no native support for this and that if I wanted to re-size everything I would either have to create sprites of different sizes, or use OpenGL with SDL. I thought that using OpenGL would be the best option as I wanted to learn this eventually anyway.
So I left my SDL version and started to implement a new version with OpenGL. Here's where the trouble started. Firstly I found that I wasn't sure how to achieve the depth effects. At first I just created a textured quad which I moved much like the SDL version. But I then tried using perspective so that I could use the Z axis to move it further away and achieve the same effect 'for free'. This meant have a much larger quad with the background image textured to it and effectively stretched so that it appeared at the correct size. But is this the best way to do it? It seems simpler because I don't have to worry about placing it relative to anything; I just draw it at a fixed point and let the perspective take care of the rest. I've tried searching the internet for anything on this but I failed to find anything relevant. Currently I've left it in orthographic mode with 'parallaxing'.
My second problem was screen size and resolution. Is it the norm to scale everything depending on the users screen resolution as I thought? I thought that if I just made all my art assets at a high resolution, I could then use OpenGL to scale everything down for lower resolution settings, and recalculate positions and such. It sounds easier when written down Currently I've just left it fixed at a resolution.
So in summary my questions are:
- For a 2D side scroller (with OpenGL in this case), is it better to use perspective with the depth buffer or an orthographic view with 'parallaxing' to achieve the perception of depth?
- What's the best way to deal with different screen/window sizes? It is plausible to scale images down as long as they keep their aspect ratio, or is there a better way of handling this?
(Mods: I wasn't quite sure where to post this as my questions seemed relevant to a number of sections. I posted here because I figured my problems are down to me being a beginner - Sorry if it's the incorrect place)