Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualPointer2APointer

Posted 17 September 2012 - 03:01 PM

Have you thought about a class or struct consisting of character arrays containing numeric letters to determine which tile to be used in conjuction with a function call to a scene renderer?

What I would do is create a class for the tiles, create a class for the scene renderer, and pass the appropriate tile/tiles as many times as you would like by simply sending an argument of which tile, how many tiles, their positions, to the scene renderer which then draws them on to the screen when necessary, and deletes the garbage(memory)needed when the tiles are offscreen or not shown, etc.

I'd say that SDL(SimpleDirect Media Layer)is a pretty easy library for blitting images to a window.

In SDL you can accomplish an image to the screen as easy as:

typedef SDL_Surface * LOAD;
LOAD Screen = SDL_SetVideoMode(800, 600, 32, SDL_FULLSCREEN);
LOAD PlayerImage = "IMAGE.jpg";
SDL_BlitSurface(PlayerImage, NULL, NULL, Screen);
SDL_Flip(Screen);
SDL_Delay(3000);

You can also add some more data to maybe flag certain tile types as "solid" so the playable character or enemy will not walk over or "through" it.

#1Pointer2APointer

Posted 17 September 2012 - 02:52 PM

Have you thought about a class or struct consisting of character arrays containing numeric letters to determine which tile to be used in conjuction with a function call to a scene renderer?

What I would do is create a class for the tiles, create a class for the scene renderer, and pass the appropriate tile/tiles as many times as you would like by simply sending an argument of which tile, how many tiles, their positions, to the scene renderer which then draws them on to the screen when necessary, and deletes the garbage(memory)needed when the tiles are offscreen or not shown, etc.

You can also add some more data to maybe flag certain tile types as "solid" so the playable character will not walk over or "through" it.

PARTNERS