我正在使用SDL的最新版本,即SDL_WINDOWEVENT似乎失踪。
在SDL_Events.h内部,SDL_Events的定义是:
/** General event structure */
typedef union SDL_Event {
Uint8 type;
SDL_ActiveEvent active;
SDL_KeyboardEvent key;
SDL_MouseMotionEvent motion;
SDL_MouseButtonEvent button;
SDL_JoyAxisEvent jaxis;
SDL_JoyBallEvent jball;
SDL_JoyHatEvent jhat;
SDL_JoyButtonEvent jbutton;
SDL_ResizeEvent resize;
SDL_ExposeEvent expose;
SDL_QuitEvent quit;
SDL_UserEvent user;
SDL_SysWMEvent syswm;
} SDL_Event;
我知道有一个SDL。 WINDOWEVENT from the wiki
页: 1 页: 1
澄清问题
如果你看看所提供的联系,则样本代码显示
void PrintEvent(const SDL_Event * event)
{
if (event->type == SDL_WINDOWEVENT) {
switch (event->window.event) {
case SDL_WINDOWEVENT_SHOWN:
fprintf(stderr, "Window %d shown", event->window.windowID);
break;
// snip
}
My Code
SDL_Event sdlEvent = {0};
while(SDL_PollEvent(&sdlEvent))
{
if(sdlEvent.type == SDL_QUIT)// || isTriggered(SDLK_ESCAPE))
System::getEventManagerGlobal().broadcastEvent( Event("QUIT") );
if(sdlEvent.type == SDL_WINDOWEVENT)
{
if(sdlEvent.window.event == SDL_WINDOWEVENT_MOVED)
{
// snip
}
}
}
error C2065: SDL_WINDOWEVENT : undeclared identifier error C2039: window : is not a member of SDL_Event sdl_events.h(227) : see declaration of SDL_Event error C2228: left of .event must have class/struct/union error C2065: SDL_WINDOWEVENT_MOVED : undeclared identifier