I am using the latest version of SDL, the enum SDL_WINDOWEVENT seems to be missing
inside SDL_Events.h, the definition of SDL_Events is:
/** 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;
I know there is a SDL_WINDOWEVENT from the wiki
// --------------------------------------------------------------------------------
Edit to clarify the Problem
If you look at the link provided, the sample code gives
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
I found the issue I was having - Joachim and user1202136 clued me on
I was mistaken on the version of SDL I am using, which explains why the methods don't exist..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.