00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00016
00017 #ifndef header_inputbuffer
00018 #define header_inputbuffer
00019
00020 #include <queue>
00021 #include "key.h"
00022 #include "../../signals.h"
00023
00024 class CL_Component;
00025
00026 class CL_InputBuffer
00027
00028
00029 {
00030 public:
00031 CL_InputBuffer();
00032
00033
00034 CL_InputBuffer(CL_InputDevice *device);
00035
00036
00037 CL_InputBuffer(
00038 CL_Signal_v4<CL_Component *, CL_InputDevice *, CL_Key, bool &> &sig_key_down,
00039 CL_Signal_v3<CL_Component *, CL_InputDevice *, CL_Key> &sig_key_up);
00040
00041
00042
00043 virtual ~CL_InputBuffer();
00044
00045 CL_Key peek_key() const;
00046
00047
00048
00049 CL_Key get_key();
00050
00051
00052 int keys_left();
00053
00055
00056 void clear();
00057
00058
00059
00060 private:
00061 CL_Slot slot_button_press;
00062 CL_Slot slot_button_release;
00063 CL_Slot slot_key_down;
00064 CL_Slot slot_key_up;
00065
00066 void on_button_press(CL_InputDevice *device, const CL_Key &key);
00067 void on_button_release(CL_InputDevice *device, const CL_Key &key);
00068
00069 void on_key_down(CL_Component *, CL_InputDevice *device, CL_Key key, bool &retval);
00070 void on_key_up(CL_Component *, CL_InputDevice *device, CL_Key key);
00071
00072 std::queue<CL_Key> buffer;
00073 CL_InputDevice *device;
00074 };
00075
00076 #endif