Go to the documentation of this file.00001 #ifndef _OF_EVENTS
00002 #define _OF_EVENTS
00003
00004 #include "ofConstants.h"
00005
00006 #ifdef OF_USING_POCO
00007
00008 #ifndef OF_EVENTS_ADDON
00009 #include "ofEventUtils.h"
00010
00011
00012
00013
00014
00015 class ofEventArgs{};
00016
00017 class ofKeyEventArgs : public ofEventArgs {
00018 public:
00019 int key;
00020 };
00021
00022 class ofMouseEventArgs : public ofEventArgs {
00023 public:
00024 int x;
00025 int y;
00026 int button;
00027 };
00028
00029 class ofAudioEventArgs : public ofEventArgs {
00030 public:
00031 float* buffer;
00032 int bufferSize;
00033 int nChannels;
00034 };
00035
00036 class ofResizeEventArgs : public ofEventArgs {
00037 public:
00038 int width;
00039 int height;
00040 };
00041 #else
00042 #include "ofxEventUtils.h"
00043 #endif
00044
00045
00046 class ofCoreEvents {
00047 public:
00048 ofEvent<ofEventArgs> setup;
00049 ofEvent<ofEventArgs> update;
00050 ofEvent<ofEventArgs> draw;
00051 ofEvent<ofEventArgs> exit;
00052 ofEvent<ofResizeEventArgs> windowResized;
00053
00054 ofEvent<ofKeyEventArgs> keyPressed;
00055 ofEvent<ofKeyEventArgs> keyReleased;
00056
00057 ofEvent<ofMouseEventArgs> mouseMoved;
00058 ofEvent<ofMouseEventArgs> mouseDragged;
00059 ofEvent<ofMouseEventArgs> mousePressed;
00060 ofEvent<ofMouseEventArgs> mouseReleased;
00061
00062 ofEvent<ofAudioEventArgs> audioReceived;
00063 ofEvent<ofAudioEventArgs> audioRequested;
00064
00065 void disable(){
00066 setup.disable();
00067 draw.disable();
00068 update.disable();
00069 exit.disable();
00070 keyPressed.disable();
00071 keyReleased.disable();
00072 mouseDragged.disable();
00073 mouseReleased.disable();
00074 mousePressed.disable();
00075 mouseMoved.disable();
00076 audioReceived.disable();
00077 audioRequested.disable();
00078 }
00079
00080 void enable(){
00081 setup.enable();
00082 draw.enable();
00083 update.enable();
00084 exit.enable();
00085 keyPressed.enable();
00086 keyReleased.enable();
00087 mouseDragged.enable();
00088 mouseReleased.enable();
00089 mousePressed.enable();
00090 mouseMoved.enable();
00091 audioReceived.enable();
00092 audioRequested.enable();
00093 }
00094 };
00095
00096
00097
00098 extern ofCoreEvents ofEvents;
00099
00100 #endif
00101
00102 #endif
00103