rework on dat and spr loader

This commit is contained in:
Eduardo Bart
2011-08-15 16:15:49 -03:00
parent b21ccd16f9
commit 2e1a96c2df
43 changed files with 191 additions and 581 deletions

View File

@@ -151,7 +151,7 @@ enum InputKeyCode {
KC_MEDIASELECT = 0xED // Media Select
};
enum InputEventType {
enum PlatformEventType {
EventNone = 0,
EventMouseAction = 1,
EventKeyboardAction = 2,
@@ -175,7 +175,7 @@ enum InputEventType {
EventMouseWheelDown = EventMouseAction | EventMouseWheel | EventDown
};
struct InputEvent {
struct PlatformEvent {
int type;
Point mousePos;
Point mouseMoved;

View File

@@ -11,7 +11,7 @@ public:
/// Fired when user resize the window
virtual void onResize(const Size& size) = 0;
/// Fired when user press a key or move the mouse
virtual void onInputEvent(const InputEvent& event) = 0;
virtual void onPlatformEvent(const PlatformEvent& event) = 0;
};
#endif

View File

@@ -260,7 +260,7 @@ void Platform::terminate()
void Platform::poll()
{
XEvent event, peekevent;
static InputEvent inputEvent;
static PlatformEvent inputEvent;
while(XPending(x11.display) > 0) {
XNextEvent(x11.display, &event);
@@ -335,7 +335,7 @@ void Platform::poll()
inputEvent.type = EventTextEnter;
inputEvent.keychar = buf[0];
inputEvent.keycode = KC_UNKNOWN;
m_listener->onInputEvent(inputEvent);
m_listener->onPlatformEvent(inputEvent);
}
}
@@ -348,7 +348,7 @@ void Platform::poll()
inputEvent.keycode = x11.keyMap[keysym];
inputEvent.type = (event.type == KeyPress) ? EventKeyDown : EventKeyUp;
inputEvent.keychar = (len > 0) ? buf[0] : 0;
m_listener->onInputEvent(inputEvent);
m_listener->onPlatformEvent(inputEvent);
}
break;
}
@@ -371,7 +371,7 @@ void Platform::poll()
inputEvent.type = EventMouseWheelDown;
break;
}
m_listener->onInputEvent(inputEvent);
m_listener->onPlatformEvent(inputEvent);
break;
case MotionNotify:
@@ -380,7 +380,7 @@ void Platform::poll()
Point newMousePos(event.xbutton.x, event.xbutton.y);
inputEvent.mouseMoved = newMousePos - inputEvent.mousePos;
inputEvent.mousePos = newMousePos;
m_listener->onInputEvent(inputEvent);
m_listener->onPlatformEvent(inputEvent);
break;
}