SDL_Event e;传递给函数

SDL_Event e; passing to function

e 是什么

SDL_Event e;

如何将 e 从一个函数传递到另一个函数,然后再传递到另一个函数。 可能吗?

基本上是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 );
    }
}

如果这是一个愚蠢的问题,我很抱歉,但我无法理解这个概念,我是编码新手。

只需将函数 2 声明为

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

在 C++ 中,您需要为函数(此处可能为 void)和所有参数(此处名为 eSDL_Event)提供类型