Switched back to old standard; addded -Wall
- removed -std=c++11 - added -Wall and removed most reported warningsdev-ui
parent
e37019943c
commit
9a268f5538
|
@ -13,8 +13,8 @@ find_package(SDL_image REQUIRED)
|
||||||
set(CMAKE_BUILD_TYPE debug)
|
set(CMAKE_BUILD_TYPE debug)
|
||||||
|
|
||||||
# Global compile flags
|
# Global compile flags
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -O2")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -w -g -O0")
|
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0")
|
||||||
|
|
||||||
# Subdirectory with sources
|
# Subdirectory with sources
|
||||||
add_subdirectory(src bin)
|
add_subdirectory(src bin)
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <SDL/SDL_image.h>
|
#include <SDL/SDL_image.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct ApplicationPrivate
|
* \struct ApplicationPrivate
|
||||||
|
@ -252,6 +254,8 @@ bool CApplication::OpenJoystick()
|
||||||
m_private->joystick = SDL_JoystickOpen(m_private->joystickIndex);
|
m_private->joystick = SDL_JoystickOpen(m_private->joystickIndex);
|
||||||
if (m_private->joystick == NULL)
|
if (m_private->joystick == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,10 +355,10 @@ void CApplication::ParseEvent()
|
||||||
else
|
else
|
||||||
event.type = EVENT_KEY_UP;
|
event.type = EVENT_KEY_UP;
|
||||||
|
|
||||||
event.data.key.key = m_private->currentEvent.key.keysym.sym;
|
event.key.key = m_private->currentEvent.key.keysym.sym;
|
||||||
event.data.key.mod = m_private->currentEvent.key.keysym.mod;
|
event.key.mod = m_private->currentEvent.key.keysym.mod;
|
||||||
event.data.key.state = TranslatePressState(m_private->currentEvent.key.state);
|
event.key.state = TranslatePressState(m_private->currentEvent.key.state);
|
||||||
event.data.key.unicode = m_private->currentEvent.key.keysym.unicode;
|
event.key.unicode = m_private->currentEvent.key.keysym.unicode;
|
||||||
}
|
}
|
||||||
else if ( (m_private->currentEvent.type == SDL_MOUSEBUTTONDOWN) ||
|
else if ( (m_private->currentEvent.type == SDL_MOUSEBUTTONDOWN) ||
|
||||||
(m_private->currentEvent.type == SDL_MOUSEBUTTONUP) )
|
(m_private->currentEvent.type == SDL_MOUSEBUTTONUP) )
|
||||||
|
@ -364,24 +368,24 @@ void CApplication::ParseEvent()
|
||||||
else
|
else
|
||||||
event.type = EVENT_MOUSE_BUTTON_UP;
|
event.type = EVENT_MOUSE_BUTTON_UP;
|
||||||
|
|
||||||
event.data.mouseButton.button = m_private->currentEvent.button.button;
|
event.mouseButton.button = m_private->currentEvent.button.button;
|
||||||
event.data.mouseButton.state = TranslatePressState(m_private->currentEvent.button.state);
|
event.mouseButton.state = TranslatePressState(m_private->currentEvent.button.state);
|
||||||
event.data.mouseButton.pos = WindowToInterfaceCoords(m_private->currentEvent.button.x, m_private->currentEvent.button.y);
|
event.mouseButton.pos = WindowToInterfaceCoords(m_private->currentEvent.button.x, m_private->currentEvent.button.y);
|
||||||
}
|
}
|
||||||
else if (m_private->currentEvent.type == SDL_MOUSEMOTION)
|
else if (m_private->currentEvent.type == SDL_MOUSEMOTION)
|
||||||
{
|
{
|
||||||
event.type = EVENT_MOUSE_MOVE;
|
event.type = EVENT_MOUSE_MOVE;
|
||||||
|
|
||||||
event.data.mouseMove.state = TranslatePressState(m_private->currentEvent.button.state);
|
event.mouseMove.state = TranslatePressState(m_private->currentEvent.button.state);
|
||||||
event.data.mouseMove.pos = WindowToInterfaceCoords(m_private->currentEvent.button.x, m_private->currentEvent.button.y);
|
event.mouseMove.pos = WindowToInterfaceCoords(m_private->currentEvent.button.x, m_private->currentEvent.button.y);
|
||||||
}
|
}
|
||||||
// TODO: joystick state polling instead of getting events
|
// TODO: joystick state polling instead of getting events
|
||||||
else if (m_private->currentEvent.type == SDL_JOYAXISMOTION)
|
else if (m_private->currentEvent.type == SDL_JOYAXISMOTION)
|
||||||
{
|
{
|
||||||
event.type = EVENT_JOY_AXIS;
|
event.type = EVENT_JOY_AXIS;
|
||||||
|
|
||||||
event.data.joyAxis.axis = m_private->currentEvent.jaxis.axis;
|
event.joyAxis.axis = m_private->currentEvent.jaxis.axis;
|
||||||
event.data.joyAxis.value = m_private->currentEvent.jaxis.value;
|
event.joyAxis.value = m_private->currentEvent.jaxis.value;
|
||||||
}
|
}
|
||||||
else if ( (m_private->currentEvent.type == SDL_JOYBUTTONDOWN) ||
|
else if ( (m_private->currentEvent.type == SDL_JOYBUTTONDOWN) ||
|
||||||
(m_private->currentEvent.type == SDL_JOYBUTTONUP) )
|
(m_private->currentEvent.type == SDL_JOYBUTTONUP) )
|
||||||
|
@ -391,8 +395,8 @@ void CApplication::ParseEvent()
|
||||||
else
|
else
|
||||||
event.type = EVENT_JOY_BUTTON_UP;
|
event.type = EVENT_JOY_BUTTON_UP;
|
||||||
|
|
||||||
event.data.joyButton.button = m_private->currentEvent.jbutton.button;
|
event.joyButton.button = m_private->currentEvent.jbutton.button;
|
||||||
event.data.joyButton.state = TranslatePressState(m_private->currentEvent.jbutton.state);
|
event.joyButton.state = TranslatePressState(m_private->currentEvent.jbutton.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -414,33 +418,33 @@ void CApplication::ProcessEvent(Event event)
|
||||||
case EVENT_KEY_DOWN:
|
case EVENT_KEY_DOWN:
|
||||||
case EVENT_KEY_UP:
|
case EVENT_KEY_UP:
|
||||||
printf("EVENT_KEY_%s:\n", (event.type == EVENT_KEY_DOWN) ? "DOWN" : "UP");
|
printf("EVENT_KEY_%s:\n", (event.type == EVENT_KEY_DOWN) ? "DOWN" : "UP");
|
||||||
printf(" key = %4x\n", event.data.key.key);
|
printf(" key = %4x\n", event.key.key);
|
||||||
printf(" state = %s\n", (event.data.key.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
printf(" state = %s\n", (event.key.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
||||||
printf(" mod = %4x\n", event.data.key.mod);
|
printf(" mod = %4x\n", event.key.mod);
|
||||||
printf(" unicode = %4x\n", event.data.key.unicode);
|
printf(" unicode = %4x\n", event.key.unicode);
|
||||||
break;
|
break;
|
||||||
case EVENT_MOUSE_MOVE:
|
case EVENT_MOUSE_MOVE:
|
||||||
printf("EVENT_MOUSE_MOVE:\n");
|
printf("EVENT_MOUSE_MOVE:\n");
|
||||||
printf(" state = %s\n", (event.data.mouseMove.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
printf(" state = %s\n", (event.mouseMove.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
||||||
printf(" pos = (%f, %f)\n", event.data.mouseMove.pos.x, event.data.mouseMove.pos.y);
|
printf(" pos = (%f, %f)\n", event.mouseMove.pos.x, event.mouseMove.pos.y);
|
||||||
break;
|
break;
|
||||||
case EVENT_MOUSE_BUTTON_DOWN:
|
case EVENT_MOUSE_BUTTON_DOWN:
|
||||||
case EVENT_MOUSE_BUTTON_UP:
|
case EVENT_MOUSE_BUTTON_UP:
|
||||||
printf("EVENT_MOUSE_BUTTON_%s:\n", (event.type == EVENT_MOUSE_BUTTON_DOWN) ? "DOWN" : "UP");
|
printf("EVENT_MOUSE_BUTTON_%s:\n", (event.type == EVENT_MOUSE_BUTTON_DOWN) ? "DOWN" : "UP");
|
||||||
printf(" button = %d\n", event.data.mouseButton.button);
|
printf(" button = %d\n", event.mouseButton.button);
|
||||||
printf(" state = %s\n", (event.data.mouseButton.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
printf(" state = %s\n", (event.mouseButton.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
||||||
printf(" pos = (%f, %f)\n", event.data.mouseButton.pos.x, event.data.mouseButton.pos.y);
|
printf(" pos = (%f, %f)\n", event.mouseButton.pos.x, event.mouseButton.pos.y);
|
||||||
break;
|
break;
|
||||||
case EVENT_JOY_AXIS:
|
case EVENT_JOY_AXIS:
|
||||||
printf("EVENT_JOY_AXIS:\n");
|
printf("EVENT_JOY_AXIS:\n");
|
||||||
printf(" axis = %d\n", event.data.joyAxis.axis);
|
printf(" axis = %d\n", event.joyAxis.axis);
|
||||||
printf(" value = %d\n", event.data.joyAxis.value);
|
printf(" value = %d\n", event.joyAxis.value);
|
||||||
break;
|
break;
|
||||||
case EVENT_JOY_BUTTON_DOWN:
|
case EVENT_JOY_BUTTON_DOWN:
|
||||||
case EVENT_JOY_BUTTON_UP:
|
case EVENT_JOY_BUTTON_UP:
|
||||||
printf("EVENT_JOY_BUTTON_%s:\n", (event.type == EVENT_JOY_BUTTON_DOWN) ? "DOWN" : "UP");
|
printf("EVENT_JOY_BUTTON_%s:\n", (event.type == EVENT_JOY_BUTTON_DOWN) ? "DOWN" : "UP");
|
||||||
printf(" button = %d\n", event.data.joyButton.button);
|
printf(" button = %d\n", event.joyButton.button);
|
||||||
printf(" state = %s\n", (event.data.mouseButton.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
printf(" state = %s\n", (event.mouseButton.state == STATE_PRESSED) ? "STATE_PRESSED" : "STATE_RELEASED");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -569,6 +573,7 @@ bool CApplication::RetJoystickEnabled()
|
||||||
bool CApplication::WriteScreenShot(char *filename, int width, int height)
|
bool CApplication::WriteScreenShot(char *filename, int width, int height)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplication::InitText()
|
void CApplication::InitText()
|
||||||
|
|
|
@ -637,31 +637,18 @@ struct Event
|
||||||
{
|
{
|
||||||
//! Type of event (EVENT_*)
|
//! Type of event (EVENT_*)
|
||||||
EventType type;
|
EventType type;
|
||||||
/**
|
|
||||||
\union EventDataUnion
|
|
||||||
\brief Additional data associated with some events
|
|
||||||
|
|
||||||
For the listed event, the given member is filled with data.
|
//! Additional data for EVENT_KEY_DOWN and EVENT_KEY_UP
|
||||||
For other event types, it is filled with zeros.
|
KeyEventData key;
|
||||||
*/
|
//! Additional data for EVENT_MOUSE_BUTTON_DOWN and EVENT_MOUSE_BUTTON_UP
|
||||||
union EventDataUnion
|
MouseButtonEventData mouseButton;
|
||||||
{
|
//! Additional data for EVENT_MOUSE_MOVE
|
||||||
//! Additional data for EVENT_KEY_DOWN and EVENT_KEY_UP
|
MouseMoveEventData mouseMove;
|
||||||
KeyEventData key;
|
//! Additional data for EVENT_JOY
|
||||||
//! Additional data for EVENT_MOUSE_BUTTON_DOWN and EVENT_MOUSE_BUTTON_UP
|
JoyAxisEventData joyAxis;
|
||||||
MouseButtonEventData mouseButton;
|
//! Additional data for EVENT_JOY_AXIS
|
||||||
//! Additional data for EVENT_MOUSE_MOVE
|
JoyButtonEventData joyButton;
|
||||||
MouseMoveEventData mouseMove;
|
|
||||||
//! Additional data for EVENT_JOY
|
|
||||||
JoyAxisEventData joyAxis;
|
|
||||||
//! Additional data for EVENT_JOY_AXIS
|
|
||||||
JoyButtonEventData joyButton;
|
|
||||||
|
|
||||||
EventDataUnion()
|
|
||||||
{ memset(this, 0, sizeof(EventDataUnion)); }
|
|
||||||
~EventDataUnion()
|
|
||||||
{}
|
|
||||||
} data;
|
|
||||||
//? long param; // parameter
|
//? long param; // parameter
|
||||||
//? Math::Point pos; // mouse position (0 .. 1)
|
//? Math::Point pos; // mouse position (0 .. 1)
|
||||||
//? float axeX; // control the X axis (-1 .. 1)
|
//? float axeX; // control the X axis (-1 .. 1)
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
|
|
||||||
|
|
||||||
class CInstanceManager;
|
class CInstanceManager;
|
||||||
class Gfx::CEngine;
|
|
||||||
class Gfx::CTerrain;
|
|
||||||
class Gfx::CWater;
|
|
||||||
class CObject;
|
class CObject;
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
|
|
||||||
class CInstanceManager;
|
class CInstanceManager;
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class Gfx::CTerrain;
|
|
||||||
class Gfx::CWater;
|
|
||||||
class CObject;
|
class CObject;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue