Fixed macros for GCC
This commit is contained in:
parent
2c934fd5a3
commit
a3d2d4bc34
|
@ -9,8 +9,12 @@
|
|||
|
||||
#define IS_NULLPTR( x ) (x == nullptr)
|
||||
|
||||
#define RETURN_IF_NULLPTR( x , v ) { if(IS_NULLPTR(x)) return v; }
|
||||
#define RETURN_IF_NOT_NULLPTR( x , v ) { if(!IS_NULLPTR(x)) return v; }
|
||||
// TODO: Find fix for this, the original doesnt compile under gcc
|
||||
#define RETURN_IF_NULLPTR( x ) { if(IS_NULLPTR(x)) return; }
|
||||
#define RETURN_IF_NOT_NULLPTR( x ) { if(!IS_NULLPTR(x)) return; }
|
||||
|
||||
#define RETURN_IF_NULLPTR_ARG( x, v ) { if(IS_NULLPTR(x)) return v; }
|
||||
#define RETURN_IF_NOT_NULLPTR_ARG( x, v ) { if(!IS_NULLPTR(x)) return v; }
|
||||
|
||||
typedef uint8_t Uint8;
|
||||
typedef int8_t Int8;
|
||||
|
|
|
@ -59,13 +59,13 @@ namespace sdlu
|
|||
|
||||
bool RenderWindow::IsOpen()
|
||||
{
|
||||
RETURN_IF_NULLPTR(m_pWindow, false);
|
||||
RETURN_IF_NULLPTR_ARG(m_pWindow, false);
|
||||
return (!SDL_GetWindowID(m_pWindow) ? false : true);
|
||||
}
|
||||
|
||||
bool RenderWindow::PollEvent(SDL_Event* event)
|
||||
{
|
||||
RETURN_IF_NULLPTR(m_pWindow, false);
|
||||
RETURN_IF_NULLPTR_ARG(m_pWindow, false);
|
||||
// Handle events before the user in case a derived
|
||||
// class decides to block the event.
|
||||
while (SDL_PollEvent(event))
|
||||
|
@ -89,7 +89,7 @@ namespace sdlu
|
|||
|
||||
Vector2i RenderWindow::GetPosition()
|
||||
{
|
||||
RETURN_IF_NULLPTR(m_pWindow, Vector2i());
|
||||
RETURN_IF_NULLPTR_ARG(m_pWindow, Vector2i());
|
||||
|
||||
int x = 0, y = 0;
|
||||
SDL_GetWindowPosition(m_pWindow, &x, &y);
|
||||
|
@ -112,7 +112,7 @@ namespace sdlu
|
|||
|
||||
Vector2u RenderWindow::GetSize()
|
||||
{
|
||||
RETURN_IF_NULLPTR(m_pWindow, Vector2u());
|
||||
RETURN_IF_NULLPTR_ARG(m_pWindow, Vector2u());
|
||||
|
||||
int x = 0, y = 0;
|
||||
SDL_GetWindowSize(m_pWindow, &x, &y);
|
||||
|
@ -135,7 +135,7 @@ namespace sdlu
|
|||
|
||||
std::string RenderWindow::GetTitle()
|
||||
{
|
||||
RETURN_IF_NULLPTR(m_pWindow, "");
|
||||
RETURN_IF_NULLPTR_ARG(m_pWindow, "");
|
||||
|
||||
return SDL_GetWindowTitle(m_pWindow);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue