summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2009-01-06 08:30:31 +0000
committernakeee <nakeee@gmail.com>2009-01-06 08:30:31 +0000
commitf95937bc2e2c0d3cd1cfb5fe4ffc2b12e43e966f (patch)
tree8fd7ccff0ba9641a315d2db3342f5a3ede7b5b0c /Source
parentce2b4bead95a305353a02ee938ff14f4eafd11f2 (diff)
is properties the right way?
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1808 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/InputCommon/Src/EventHandler.cpp10
-rw-r--r--Source/Core/InputCommon/Src/InputCommon.cpp2
-rw-r--r--Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h13
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp9
5 files changed, 24 insertions, 12 deletions
diff --git a/Source/Core/InputCommon/Src/EventHandler.cpp b/Source/Core/InputCommon/Src/EventHandler.cpp
index 9565e0bce6..9795740ec4 100644
--- a/Source/Core/InputCommon/Src/EventHandler.cpp
+++ b/Source/Core/InputCommon/Src/EventHandler.cpp
@@ -29,14 +29,14 @@ EventHandler *EventHandler::GetInstance() {
void EventHandler::Destroy() {
if (m_Instance)
- delete m_Instance;
+ delete m_Instance;
fprintf(stderr, "deleting instance %p\n", m_Instance);
m_Instance = 0;
}
bool EventHandler::RegisterEventListener(listenFuncPtr func, Keys key) {
if (key.inputType == KeyboardInput) {
- fprintf(stderr, "Registering %d:%d %p\n", key.keyCode, key.mods, func);
+ fprintf(stderr, "Registering %d:%d %p %p \n", key.keyCode, key.mods, func, this);
if (key.keyCode == sf::Key::Count || key.mods >= NUMMODS ||
key.keyCode >= NUMKEYS)
return false;
@@ -72,7 +72,7 @@ void EventHandler::Update() {
for (unsigned int i = 0; i < eventQueue.size();i++) {
sf::Event ev = eventQueue.front();
eventQueue.pop();
- fprintf(stderr, "Updating event type %d code %d mod %d func %p\n", ev.Type, ev.Key.Code, ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control, keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control]);
+ fprintf(stderr, "Updating event type %d code %d mod %d func %p %p\n", ev.Type, ev.Key.Code, ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control, keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control], this);
if(keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control])
keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control](ev);
}
@@ -80,7 +80,7 @@ void EventHandler::Update() {
bool EventHandler::addEvent(sf::Event *ev) {
eventQueue.push(*ev);
- fprintf(stderr, "Got event type %d code %d\n", ev->Type, ev->Key.Code);
+ fprintf(stderr, "Got event type %d code %d %p\n", ev->Type, ev->Key.Code, this);
return true;
}
@@ -313,6 +313,6 @@ class EventHandlerCleaner
public:
~EventHandlerCleaner()
{
- EventHandler::Destroy();
+ //EventHandler::Destroy();
}
} EventHandlerCleanerInst;
diff --git a/Source/Core/InputCommon/Src/InputCommon.cpp b/Source/Core/InputCommon/Src/InputCommon.cpp
index fc908e8975..beed506f8e 100644
--- a/Source/Core/InputCommon/Src/InputCommon.cpp
+++ b/Source/Core/InputCommon/Src/InputCommon.cpp
@@ -6,7 +6,7 @@ namespace InputCommon
{
void Init() {
// init the event handler
- EventHandler::GetInstance();
+ //EventHandler::GetInstance();
}
void Shutdown() {
diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp
index b70ca46dd6..f9233da004 100644
--- a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp
+++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp
@@ -89,7 +89,7 @@ void __Logv(int log, int v, const char *format, ...) {}
bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
Keys key, oldKey;
- EventHandler *eventHandler = EventHandler::GetInstance();
+ static EventHandler *eventHandler = EventHandler::GetInstance();
key.inputType = KeyboardInput;
key.keyCode = code;
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h b/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h
index a75dc3e082..1233c2dc51 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h
@@ -14,13 +14,20 @@
#else
#include <GL/gl.h>
#endif
+enum OGL_Props {
+ OGL_FULLSCREEN,
+ OGL_STRETCHTOFIT,
+ OGL_KEEPRATIO,
+ OGL_PROP_COUNT
+};
class GLWindow {
private:
u32 width, height;
int yOffset, xOffset;
float xMax, yMax;
- public:
+ bool properties[OGL_PROP_COUNT];
+public:
virtual void SwapBuffers() {};
virtual void SetWindowText(const char *text) {};
@@ -28,7 +35,9 @@ class GLWindow {
virtual void Update() {};;
virtual bool MakeCurrent() {return false;};
-
+ bool getProperty(OGL_Props prop) {return properties[prop];}
+ virtual bool setProperty(OGL_Props prop, bool value)
+ {return properties[prop] = value;}
u32 GetWidth() {return width;}
u32 GetHeight() {return height;}
void SetSize(u32 newWidth, u32 newHeight) {
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp
index 6ce0e0c98b..acd6b1362b 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp
@@ -1,5 +1,7 @@
#include "X11Window.h"
+ static EventHandler *eventHandler = EventHandler::GetInstance();
+
X11Window::X11Window(int _iwidth, int _iheight) {
int _twidth, _theight;
if(g_Config.bFullscreen) {
@@ -206,6 +208,7 @@ bool X11Window::PeekMessages() {
// Taken from sfml code
void X11Window::ProcessEvent(XEvent WinEvent) {
+ // static EventHandler *eventHandler = EventHandler::GetInstance();
switch (WinEvent.type) {
case KeyPress :
@@ -223,7 +226,7 @@ void X11Window::ProcessEvent(XEvent WinEvent) {
Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask;
Evt.Key.Control = WinEvent.xkey.state & ControlMask;
Evt.Key.Shift = WinEvent.xkey.state & ShiftMask;
- EventHandler::GetInstance()->addEvent(&Evt);
+ eventHandler->addEvent(&Evt);
break;
}
// Key up event
@@ -241,7 +244,7 @@ void X11Window::ProcessEvent(XEvent WinEvent) {
Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask;
Evt.Key.Control = WinEvent.xkey.state & ControlMask;
Evt.Key.Shift = WinEvent.xkey.state & ShiftMask;
- EventHandler::GetInstance()->addEvent(&Evt);
+ eventHandler->addEvent(&Evt);
break;
}
}
@@ -282,7 +285,7 @@ void X11Window::Update() {
}*/
}
- EventHandler::GetInstance()->Update();
+ eventHandler->Update();
float FactorW = 640.0f / (float)GetWidth();
float FactorH = 480.0f / (float)GetHeight();