Jump to content

  • Log In with Google      Sign In   
  • Create Account

munchor

Member Since 17 Dec 2011
Offline Last Active May 19 2012 02:49 PM

Posts I've Made

In Topic: [SDL] Moving right and left

19 May 2012 - 01:57 PM

Servant Of The Lord, I actually read what you said twice, very nice explanation, I shall implement it right away and see how it works :)

In Topic: When to free sound

03 March 2012 - 01:37 PM

Thank you, the first alternative worked!

In Topic: When to free sound

03 March 2012 - 08:42 AM

1) Load the sound at the start of the level. (The same goes for textures, models, etc)
2) Free them at the end of the level

If sounds and models etc are the same across all levels then you can load them when the game starts instead (and free them when the game ends), you could also store a list of resources required for each level and then load the full list for level 1, at the end of level 1 you check the difference in the resource list for lvl 1 and 2 and free the resources that are no longer needed and then add any new additions.

All bullets can share 1 sound object so you don't need to load it once for each bullet.


The problem is how can I play them from the Bullet class if I do that.

In Topic: Transparent png not transparent with sdl_image

03 March 2012 - 06:02 AM

When you use SDL_BlitSurface you can also change the size of the image...

Maybe you should take a look at http://sdl.beuc.net/sdl.wiki/SDL_BlitSurface

In Topic: Transparent png not transparent with sdl_image

03 March 2012 - 05:44 AM

You shouldn't loop the image and draw it pixel by pixel...


SDL_RWops *gold_rwops = SDL_RWFromFile("img/gold.png", "rb");
SDL_Surface *gold = IMG_LoadPNG_RW(gold_rwops);

SDL_Rect tile = {250 + x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE};
SDL_BlitSurface(gold, NULL, screen, &tile);

Here's how I did it.

PARTNERS