All pastes #76401 Raw Edit

Mirchiss

public cpp v1 · immutable
·published 2006-07-01 15:31 UTC
rendered paste body
#include "SDLhelpfunctions.h"//      X   Y   Z            int map[25][20][2];char x=0,y=0;//0 is for Map 1 is for player;SDL_Event event;int main (int argc, char *argv[]){   SDL_Init();  bool quit = false;  //Declares everything 0;  int i;  int j;  for (i = 0; i<=24;i++ )  {    for (j = 0; j<=19;j++ )     {      map[i][j][0]=0;      map[i][j][1]=0;    }  }  map[x][y][1]=0;    while(quit==false)  {     if( SDL_PollEvent( &event ) )    {     //Checks if user wants to quit      if( event.type == SDL_QUIT )      {        quit = true;      }   //Checks if user has pressed a key      else if ( event.type == SDL_KEYDOWN )      {        switch(event.key.keysym.sym)        {          case SDLK_UP   :            map[x][y][1]=0;            map[x][--y][1]=1;            break;          case SDLK_DOWN :            map[x][y][1]=0;            map[x][++y][1]=1;            break;          case SDLK_LEFT :            map[x][y][1]=0;            map[++x][y][1]=1;            break;          case SDLK_RIGHT:            map[x][y][1]=0;            map[--x][y][1]=1;            break;          default        :            break;        }               }    }              }return 0;}