   Once again Tilemap. SDL/Linux.
  Wondering if someone can explain to me or maby give some good tutorials on this.Using SDL and C on Linux Debian Lenny.I already have some code made up. Not sure if it is correct or not, but I can't figure out how to draw the map back out using a method like:map[32][32] = {2,3,4,5,6,etc...};I know you have to have a view port x and y and some other vars. At least from what I seen on the forums here, but I still don't get it.<code>#include </usr/local/include/SDL/SDL.h>#include <stdio.h>#include <stdlib.h>int main(){SDL_Surface *screen;SDL_Surface *tiles;SDL_Rect src, dest;SDL_Surface *myTiles[768];int i;if (SDL_Init(SDL_INIT_VIDEO) != 0) { printf("Unable to initialize SDL: %s\n", SDL_GetError()); return 1; }atexit(SDL_Quit); screen = SDL_SetVideoMode(640, 480, 16, 0); if (screen == NULL) { printf("Unable to set video mode: %s\n", SDL_GetError()); return 1; }tiles = SDL_LoadBMP("Test_1024.bmp");if (tiles == NULL) {    printf("Unable to load bitmap.\n");    return 1;}#if SDL_BYTEORDER == SDL_BIG_ENDIAN   int rmask = 0xff000000;   int gmask = 0x00ff0000;   int bmask = 0x0000ff00;   int amask = 0x000000ff;#else   int rmask = 0x000000ff;   int gmask = 0x0000ff00;   int bmask = 0x00ff0000;   int amask = 0xff000000;#endiffor (i=0; i <= 768; i++){myTiles = SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCCOLORKEY, 32, 32, 32, rmask, gmask, bmask, amask);}int y;int x;for(y = 0; y < 24; y++){for(x = 0; x < 32; x++)    {   int slice_x = x * 32;    int slice_y = y * 32;    SDL_Rect srcRect;    src.x = slice_x;    src.y = slice_y;    src.w = 32;   src.h = 32;    SDL_Rect dstRect;    dest.x = x * 32;    dest.y = y * 32;  int i =  x + y * 32; SDL_BlitSurface(tiles, &src, &myTiles, &dest);}} SDL_Delay(700); printf("Engine Loaded Successful\n");}</code>That is the code I am tring. It should take the test image I am using, and load a 32 size tiles into each myTiles. I might go with 16 for size later.I just can't figure out how to draw a map out to the screen. hmm Maby someone can help me. Understand how to do that.
  You don't need to blit the tilemap to lots of small bitmaps. Consider instead using the same type of logic to blit the relevant tiles from the tilemap to the screen directly.Have you tried Lazy Foo's tiling tutorial? That is the basic idea, you keep all the images in their original SDL_Surface and use SDL_BlitSurface with an appropriate clipping rectangle to blit individual tiles to the screen.   ;  Here are some SDL examples.  Be sure to check out smoothscroll-1.1.tar.gz as it shows how to do tile mapping with sub-pixel precision using OpenGL for graphics acceleration.   ;  Hey,Not sure if you've solved your problem yet or not but I found a really interesting link the other day which gave me the motivation to start making my own tile based game.The tutorials are in C but the library is still the same.http://www.parallelrealities.co.uk/tutorials/intermediate/tutorial11.phpParallel RealitiesHave a look =)heh.   