is properties the right way?
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1808 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ce2b4bead9
commit
f95937bc2e
|
@ -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;
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace InputCommon
|
|||
{
|
||||
void Init() {
|
||||
// init the event handler
|
||||
EventHandler::GetInstance();
|
||||
//EventHandler::GetInstance();
|
||||
}
|
||||
|
||||
void Shutdown() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue