add SDL_GetEvent
This commit is contained in:
@@ -488,3 +488,19 @@ int FindSurfaceTraits(const SDL_Surface *img)
|
|||||||
// if(WhiteOnly) ret |= TRAIT_WHITE_ONLY;
|
// if(WhiteOnly) ret |= TRAIT_WHITE_ONLY;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SDL_GetEvent(SDL_Event &event, int mask)
|
||||||
|
{
|
||||||
|
/* SDL_PeepEvents returns error if video isn't initialized. */
|
||||||
|
if(!SDL_WasInit(SDL_INIT_VIDEO))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch(SDL_PeepEvents(&event, 1, SDL_GETEVENT, mask))
|
||||||
|
{
|
||||||
|
case 1: return true;
|
||||||
|
case 0: return false;
|
||||||
|
case -1: RageException::Throw("SDL_PeepEvents returned unexpected error: %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ SDL_Surface *SDL_CreateRGBSurfaceSane
|
|||||||
|
|
||||||
void FixHiddenAlpha(SDL_Surface *img);
|
void FixHiddenAlpha(SDL_Surface *img);
|
||||||
|
|
||||||
|
/* Check for an event; return true if one was waiting. */
|
||||||
|
bool SDL_GetEvent(SDL_Event &event, int mask);
|
||||||
|
|
||||||
/* The surface contains no transparent pixels and/or never uses its color
|
/* The surface contains no transparent pixels and/or never uses its color
|
||||||
* key, so it doesn't need any alpha bits at all. */
|
* key, so it doesn't need any alpha bits at all. */
|
||||||
#define TRAIT_NO_TRANSPARENCY 0x0001 /* 0alpha */
|
#define TRAIT_NO_TRANSPARENCY 0x0001 /* 0alpha */
|
||||||
|
|||||||
Reference in New Issue
Block a user