Jump to content
  • Advertisement
Sign in to follow this  

SDL resource comsumptions and compatibilty.

This topic is 4295 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!. I´ve been busy during the last few days crafting what would be my first prototipe of something that actually does work using the SDL library... Two questions have come to mind about it: -How much SDL is compatible among computers?. I tried it in several computers and worked without a problem but in one of them wouldn´t even run or would run in strange ways. -How much resources does the drawing consume?. The code for my application is purposedly consuming (see below) to test the SDL a bit. In my computer (a 1.60ghz laptop with 1gb of RAM) it runs fine but in an Athlon K7 (512 RAM) it´s just slow... Are the requirements for the SDL always high?. As for the code itself... Let me explain in wich way it is unneficient: the program is a tile based game, quite like the classic "Snake" that comes in the mobile phones but even uglier. The whole gaming board is a 40x30 matrix and the drawing process goes like: -Load the tileset. -Loop: -Check one matrix place. -Set the offsets on the tileset depending on the content. -Draw to the screen what was just selected. -Check next. -End loop. It does that for every single instance of the main game loop and, to test further, there´s no use of the "SDL_Delay" function. So to say, the program is calling a blit like 130 times per each passing through the game loop... It´s a lot but, don´t arcade-like games draw a lot of sprites on the screen each time too?. Finally, I have ways to improve the code (:D) and can upload it somewhere along with the .exe so everyone can take a look at it, in case I did something wrong. Edit: I´ve decided to paste that piece of code, just in case. "marco" is a frame for selecting the tiles and "coordenadas" is just the coordinates where the stuff will be put. "filas" is rows and "columnas" is columns.
            for(filas=0; filas<30; filas++)                                             
                  for(columnas=0; columnas<40; columnas++)
                              case 0: marco.x=0; marco.y=0; break;
                              case 1: marco.x=48; marco.y=0; break;
                              case 3: marco.x=16; marco.y=0; break;
                              case 4: marco.x=32; marco.y=0; break;
                              case 5: marco.x=32; marco.y=16; break;
                        coordenadas.x=(columnas*16)+80; coordenadas.y=(filas*16)+48;
                        SDL_BlitSurface(objeto, &marco, pantalla, &coordenadas);                 

Just to clarify, the whole code is as newbish as this part, so full of "switch" sentences and the like.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!