00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef GCN_SDLINPUT_HPP
00056 #define GCN_SDLINPUT_HPP
00057
00058 #include <queue>
00059
00060 #include "SDL.h"
00061
00062 #include "guichan/input.h"
00063 #include "guichan/key.h"
00064 #include "guichan/keyinput.h"
00065 #include "guichan/mouseinput.h"
00066 #include "guichan/platform.h"
00067
00068 namespace gcn
00069 {
00073 class GCN_EXTENSION_DECLSPEC SDLInput : public Input
00074 {
00075 public:
00076
00080 SDLInput();
00081
00088 virtual void pushInput(SDL_Event event);
00089
00095 virtual void _pollInput() { }
00096
00097
00098
00099
00100 virtual bool isKeyQueueEmpty();
00101
00102 virtual KeyInput dequeueKeyInput();
00103
00104 virtual bool isMouseQueueEmpty();
00105
00106 virtual MouseInput dequeueMouseInput();
00107
00108 virtual void processKeyRepeat();
00109
00116 static Key convertKeyCharacter(SDL_keysym key);
00117
00118 protected:
00126 int convertMouseButton(int button);
00127
00128 std::queue<KeyInput> mKeyInputQueue;
00129 std::queue<MouseInput> mMouseInputQueue;
00130
00131 bool mMouseDown;
00132 bool mMouseInWindow;
00133 Key mLastKey;
00134 bool mIsRepeating;
00135 };
00136 }
00137
00138 #endif // end GCN_SDLINPUT_HPP