The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.
SDL
Simple Directmedia Layer Forums
Question regarding good practices / habits
GunnDawg
Joined: 25 Jan 2016
Posts: 6
Posted: Tue Feb 02, 2016 11:40 am
I'm new to SDL and game development in general (not so much C and C++ programming though) and am curious on a few things that may or may not be considered bad practice. I'm going to be creating a simple game at first that has a sky and some ground textures (sprites). The sky will be using a static blue color and was wondering if the way I am currently handling that is considered wrong or a bad habit.
So as you can see I'm just using SDL_SetRenderDrawColor to draw the entire screen the sky blue color rather than creating a texture out of a surface (SDL_CreateTextureFromSurface) and then drawing that texture to the screen. This way I can just draw the sprites where I need them leaving any remaining space to appear as the sky, which as far as I'm concerned would look the same as drawing a blue colored texture behind it all.
So maybe it's just a matter of opinion when both methods produce the same results, but I'd still like to get an opinion before adopting bad practices and habits.