Tag Info

New answers tagged

0

Try using gl_FragColor instead of color in simple.fs


4

On tile based GPUs (commonly seen in mobile hardware) it is beneficial to clear the renderer, as it allows the GPU to dispose of the existing cached frame data. Here's a quote from OpenGL Insights, dealing with the benefits of clearing the framebuffer on a tile based renderer: "On a tile-based architecture, avoiding clears can be disasterous for ...


2

No you don't need to. As you said yourself, if you whole scene is drawn-over by the new rendered frame, then it makes no visual difference. And as comments rightfully mentionned, it might have a positive or a negative impact on performance: profile on your target platform(s) to make your decision. In the old days, it was common place to actually re-render ...


0

I'm not sure if you'd like my method but based on what you said, "New Game, Settings, Exit" then I'm assuming the menu would be the main screen right? I'm a texture user , by the way, and not a surface one. //Let's assume that your method of input is a mouse //since this is long, you can create a class for this then recall it in the gameloop //WE CREATE ...


0

I know how you feel, SDL2 is somewhat different from the earlier one, to make it easier, I'll explain how SDL_Renderer, SDL_Window, and SDL_Texture works. //CREATE WINDOW SDL_Window *window = SDL_CreateWindow("Title", 100, 100, 400, 600,SDL_WINDOW_SHOWN); /*You have created a variable named window which is in the type of SDL_Window, SDL_Create Window ...


4

As congusbongus notes in his answer, many games benefit from dividing content into "scenes". A scene might represent a particular level, a room, a minigame, or lots of other possibilities, depending on the game. In such a system, menus can be implemented as scenes as well, and this works well for simple games with only a few menus. Personally, I like to ...


2

The typical way to implement this is using game screens or scenes. Your game loop updates and draws the current screen, whatever that may be Your menu(s) live in one screen or set of screens, your game world lives in another screen Choosing certain menu options (e.g. start game) switches the current screen In this sense, it's just a plain programming ...


4

JPG is lossy. Don't use that for sprites -- you will end up with nasty artifacts that will look bad. There's a couple reasons you might want to use colur-keying, but they're a bit lost in todays hardware. Taking a quick look at color key advantages: Pros They use up less disk space -- there is no alpha channel to store By consequence, their memory foot ...


0

The renderer cannot accept SDL_Surface*'s so you will have to convert them to textures by SDL_Texture* texture = SDL_CreateTextureFromSurface(render, surface) The renderer is basically an SDL_Window* that is hidden from the user where the graphics are rendered at first, then the rendered data gets switched with the window's data To do this you must use ...


0

you could place your files in a folder called resources or whatever you want it to be at the same directory as the exe. For the file path when using a SDL_LoadBMP() or whatnot will be resources/name_of_image.bmp



Top 50 recent answers are included