c++ - SDL_Event e; passing to function -


what e in

sdl_event e; 

how pass e 1 function function function. possible?

basically e bool or int

bool x_out_window() {     bool quit = false;     sdl_event e;     while( !quit )     {         while( sdl_pollevent( &e ) != 0 )         {             if( e.type == sdl_quit )             quit = true;             else             detect_key_press(e.type);         }      } }  bool detect_key_press(e.type) {     //sdl_event e;     if( e.type == sdl_keydown )     {         //select surfaces based on key press         switch( e.key.keysym.sym )         {             case sdlk_up:             gcurrentsurface = gkeypresssurfaces[ key_press_surface_up ];             break;              case sdlk_down:             gcurrentsurface = gkeypresssurfaces[ key_press_surface_down ];             break;              case sdlk_left:             gcurrentsurface = gkeypresssurfaces[ key_press_surface_left ];             break;              case sdlk_right:             gcurrentsurface = gkeypresssurfaces[ key_press_surface_right ];             break;              default:             gcurrentsurface = gkeypresssurfaces[ key_press_surface_default ];             break;         }         sdl_blitsurface( gxout, null, gscreensurface, null );         sdl_updatewindowsurface( gwindow );     } } 

i sorry if silly question unable understand concept, novice in coding.

just declare function 2 as

void funtion2(sdl_event e){   //... } 

in c++ need provide type both function (probably void here) , parameters (a sdl_event named e here)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -