Skip to content

Commit

Permalink
making ofShader
Browse files Browse the repository at this point in the history
  • Loading branch information
base committed Nov 14, 2011
1 parent 5d69282 commit 1f97489
Show file tree
Hide file tree
Showing 6 changed files with 431 additions and 124 deletions.
7 changes: 3 additions & 4 deletions app/ofBaseApp.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ This function gets called when ever we resize the application window. You receiv
### void keyPressed( int key ) ### {#keyPressed}
This function gets called when a key is pressed. The value key can be tested against.

There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT
There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT


### void keyReleased( int key ) ### {#keyReleased}
This function gets called when a key is released. The value key can be tested against.

There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT
There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT

### void mouseMoved( int x, int y ) ### {#mouseMoved}
This function gets when ever the mouse moves. You receive the x and y corrdinates of the mouse.
Expand All @@ -39,9 +39,8 @@ This function gets when ever the mouse moves.

### void mouseReleased(int x, int y, int button ) ### {#mouseReleased}
This function gets when ever the mouse moves. You receive the x and y corrdinates of the mouse and the button that was released.

### void dragEvent(ofDragInfo dragInfo) ### {#dragEvent}
Sends an [ofDragInfo](../events/ofEvents.htm#ofDragInfo) event.

### void gotMessage(ofMessage msg) ### {#gotMessage}

47 changes: 47 additions & 0 deletions events/ofEventUtils.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

## ofEvent ##

define ofEvent as a poco FIFOEvent to create your own events use: ofEvent<argType> myEvent

### ofEvent() ###

### ofEvent(const ofEvent<ArgumentsType> & mom) ###
allow copy of events, by copying everything except the mutex

### ofEvent<ArgumentsType> & operator=(const ofEvent<ArgumentsType> & mom) ###


### void ofAddListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(const void*, ArgumentsType&)) ##

register any method of any class to an event. the method must provide one of the following
signatures:
void method(ArgumentsType & args)
void method(const void * sender, ArgumentsType &args)
ie:
ofAddListener(addon.newIntEvent, this, &Class::method)

### void ofAddListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(ArgumentsType&)) ###



### void ofRemoveListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(const void*, ArgumentsType&)) ###

unregister any method of any class to an event.
the method must provide one the following
signatures:
void method(ArgumentsType & args)
void method(const void * sender, ArgumentsType &args)
ie:
ofAddListener(addon.newIntEvent, this, &Class::method)

### void ofRemoveListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(ArgumentsType&)) ###

### void ofNotifyEvent(EventType & event, ArgumentsType & args, SenderType * sender) ###
notifies an event so all the registered listeners
get called
ie:
ofNotifyEvent(addon.newIntEvent, intArgument, this)
or in case there's no sender:
ofNotifyEvent(addon.newIntEvent, intArgument)

### void ofNotifyEvent(EventType & event, ArgumentsType & args) ##
140 changes: 140 additions & 0 deletions events/ofEvents.htm
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,144 @@ <h3 id="void_ofunregistertoucheventslistenerclass__listener">void ofUnregisterTo
<h3 id="void_ofunregistergetmessageslistenerclass__listener">void ofUnregisterGetMessages(ListenerClass * listener)</h3>
<p>Stop the listener from listening to message events.</p>
<h3 id="void_ofunregisterdrageventslistenerclass__listener">void ofUnregisterDragEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to drag events.</p><h2 id="ofdraginfo">ofDragInfo</h2>
<p>Passed to the <a href="../app/ofBaseApp.htm">ofBaseApp</a> in the <a href="../app/ofBaseApp.htm#dragEvent">dragEvent</a> method.</p>
<h3 id="files">vector <string> files</h3>
<p>All the files included in the drag events</p>
<h3 id="position">ofPoint position</h3>
<p>The location in the app where the drag event terminated, i.e. where you dropped the file/s.</p>
<h2 id="ofKeyEventArgs">ofKeyEventArgs</h2>
<p>Sent during <a href="../app/ofBaseApp.htm#keyPressed">keyPressed</a> and <a href="../app/ofBaseApp.htm#keyReleased">keyReleased</a> events.</p>
<h2 id="ofMouseEventArgs">ofMouseEventArgs</h2>
<p>Sent to [ofBaseApp}(../app/ofBaseApp.htm) during <a href="../app/ofBaseApp.htm#mousePressed">mousePressed</a> <a href="../app/ofBaseApp.htm#mouseReleased">mouseReleased</a> and <a href="../app/ofBaseApp.htm#mouseDrag">mouseDrag</a> notifications.</p>
<h2 id="ofTouchEventArgs">ofTouchEventArgs</h2>
<p>These are sent to any any registered listeners when the device detects touches. Most commonly this is the ofBaseApp in the <a href="../app/ofBaseApp.htm#touchDown">touchDown</a>, <a href="../app/ofBaseApp.htm#touchUp">touchUp</a>, <a href="../app/ofBaseApp.htm#touchUp">touchUp</a>, <a href="../app/ofBaseApp.htm#touchDoubleTap">touchDoubleTap</a>, <a href="../app/ofBaseApp.htm#touchCancelled">touchCancelled</a> method.</p>
<h3 id="id">int id</h3>
<p>The id of the touch.</p>
<h3 id="time">int time</h3>
<p>For taps or presses this is the time in seconds. Not currently used.</p>
<h3 id="x">float x</h3>
<p>Application coordinate location of the event</p>
<h3 id="y">float y</h3>
<p>Application coordinate location of the event</p>
<h3 id="numTouches">int numTouches</h3>
<p>How many touch points the event involves. Not currently used.</p>
<h3 id="width">float width</h3>
<p>The width of the touch area. Not currently used.</p>
<h3 id="height">float height</h3>
<p>The height of the touch area. Not currently used.</p>
<h3 id="angle">float angle</h3>
<p>If there are two touches this is the angle between them. Not currently used.</p>
<h3 id="minoraxis">float minoraxis</h3>
<p>The shorter axis of a touch area. Not currently used.</p>
<h3 id="majoraxis">float majoraxis</h3>
<p>The longer axis of a touch area. Not currently used.</p>
<h3 id="pressure">float pressure</h3>
<p>If your device is recording pressure, this represents the pressure of the touch. Not currently used.</p>
<h3 id="xspeed">float xspeed</h3>
<p>For touch drag events, this is the approximation of the speed of the movement along the x-axis. Not currently used.</p>
<h3 id="yspeed">float yspeed</h3>
<p>For touch drag events, this is the approximation of the speed of the movement along the y-axis. Not currently used.</p>
<h3 id="xaccel">float xaccel</h3>
<p>For touch drag events, this is the approximation of the acceleration of the movement along the x-axis. Not currently used.</p>
<h3 id="yaccel">float yaccel</h3>
<p>For touch drag events, this is the approximation of the acceleration of the movement along the y-axis. Not currently used.</p>
<h2 id="ofAudioEventArgs">ofAudioEventArgs</h2>
<h3 id="buffer">float* buffer</h3>
<h3 id="bufferSize">int bufferSize</h3>
<h3 id="nChannels">int nChannels</h3>
<h2 id="ofResizeEventArgs">ofResizeEventArgs</h2>
<p>### int width ### {#width}</p>
<p>### int height ### {#height}</p>
<h2 id="ofEvents">ofEvents</h2>
<p>Below are the public methods of ofEvents</p>
<h3 id="ofRegisterMouseEvents">void ofRegisterMouseEvents(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has mousePressed, mouseReleased, mouseMoved, and mouseDragged methods to handle the events being dispatched to it.</p>
<h3 id="ofRegisterKeyEvents">void ofRegisterKeyEvents(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has keyPressed, keyReleased methods to handle the events being dispatched to it.</p>
<h3 id="ofRegisterTouchEvents">void ofRegisterTouchEvents(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has touchDown, touchMoved, touchUp, touchDoubleTap, touchCancelled methods to handle the events being dispatched to it.</p>
<h3 id="ofRegisterGetMessages">void ofRegisterGetMessages(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has a gotMessage method to handle the events being dispatched to it.</p>
<h3 id="void_ofregisterdrageventslistenerclass__listener">void ofRegisterDragEvents(ListenerClass * listener)</h3>
<p>Register the drag events to the listener. This assumes that the listener has the dragEvent method to handle the events being dispatched to it.</p>
<h3 id="void_ofunregistermouseeventslistenerclass__listener">void ofUnregisterMouseEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to mouse events.</p>
<h3 id="void_ofunregisterkeyeventslistenerclass__listener">void ofUnregisterKeyEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to key events.</p>
<h3 id="void_ofunregistertoucheventslistenerclass__listener">void ofUnregisterTouchEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to touch events.</p>
<h3 id="void_ofunregistergetmessageslistenerclass__listener">void ofUnregisterGetMessages(ListenerClass * listener)</h3>
<p>Stop the listener from listening to message events.</p>
<h3 id="void_ofunregisterdrageventslistenerclass__listener">void ofUnregisterDragEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to drag events.</p><h2 id="ofdraginfo">ofDragInfo</h2>
<p>Passed to the <a href="../app/ofBaseApp.htm">ofBaseApp</a> in the <a href="../app/ofBaseApp.htm#dragEvent">dragEvent</a> method.</p>
<h3 id="files">vector <string> files</h3>
<p>All the files included in the drag events</p>
<h3 id="position">ofPoint position</h3>
<p>The location in the app where the drag event terminated, i.e. where you dropped the file/s.</p>
<h2 id="ofKeyEventArgs">ofKeyEventArgs</h2>
<p>Sent during <a href="../app/ofBaseApp.htm#keyPressed">keyPressed</a> and <a href="../app/ofBaseApp.htm#keyReleased">keyReleased</a> events.</p>
<h2 id="ofMouseEventArgs">ofMouseEventArgs</h2>
<p>Sent to [ofBaseApp}(../app/ofBaseApp.htm) during <a href="../app/ofBaseApp.htm#mousePressed">mousePressed</a> <a href="../app/ofBaseApp.htm#mouseReleased">mouseReleased</a> and <a href="../app/ofBaseApp.htm#mouseDrag">mouseDrag</a> notifications.</p>
<h2 id="ofTouchEventArgs">ofTouchEventArgs</h2>
<p>These are sent to any any registered listeners when the device detects touches. Most commonly this is the ofBaseApp in the <a href="../app/ofBaseApp.htm#touchDown">touchDown</a>, <a href="../app/ofBaseApp.htm#touchUp">touchUp</a>, <a href="../app/ofBaseApp.htm#touchUp">touchUp</a>, <a href="../app/ofBaseApp.htm#touchDoubleTap">touchDoubleTap</a>, <a href="../app/ofBaseApp.htm#touchCancelled">touchCancelled</a> method.</p>
<h3 id="id">int id</h3>
<p>The id of the touch.</p>
<h3 id="time">int time</h3>
<p>For taps or presses this is the time in seconds. Not currently used.</p>
<h3 id="x">float x</h3>
<p>Application coordinate location of the event</p>
<h3 id="y">float y</h3>
<p>Application coordinate location of the event</p>
<h3 id="numTouches">int numTouches</h3>
<p>How many touch points the event involves. Not currently used.</p>
<h3 id="width">float width</h3>
<p>The width of the touch area. Not currently used.</p>
<h3 id="height">float height</h3>
<p>The height of the touch area. Not currently used.</p>
<h3 id="angle">float angle</h3>
<p>If there are two touches this is the angle between them. Not currently used.</p>
<h3 id="minoraxis">float minoraxis</h3>
<p>The shorter axis of a touch area. Not currently used.</p>
<h3 id="majoraxis">float majoraxis</h3>
<p>The longer axis of a touch area. Not currently used.</p>
<h3 id="pressure">float pressure</h3>
<p>If your device is recording pressure, this represents the pressure of the touch. Not currently used.</p>
<h3 id="xspeed">float xspeed</h3>
<p>For touch drag events, this is the approximation of the speed of the movement along the x-axis. Not currently used.</p>
<h3 id="yspeed">float yspeed</h3>
<p>For touch drag events, this is the approximation of the speed of the movement along the y-axis. Not currently used.</p>
<h3 id="xaccel">float xaccel</h3>
<p>For touch drag events, this is the approximation of the acceleration of the movement along the x-axis. Not currently used.</p>
<h3 id="yaccel">float yaccel</h3>
<p>For touch drag events, this is the approximation of the acceleration of the movement along the y-axis. Not currently used.</p>
<h2 id="ofAudioEventArgs">ofAudioEventArgs</h2>
<h3 id="buffer">float* buffer</h3>
<h3 id="bufferSize">int bufferSize</h3>
<h3 id="nChannels">int nChannels</h3>
<h2 id="ofResizeEventArgs">ofResizeEventArgs</h2>
<p>### int width ### {#width}</p>
<p>### int height ### {#height}</p>
<h2 id="ofEvents">ofEvents</h2>
<p>Below are the public methods of ofEvents</p>
<h3 id="ofRegisterMouseEvents">void ofRegisterMouseEvents(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has mousePressed, mouseReleased, mouseMoved, and mouseDragged methods to handle the events being dispatched to it.</p>
<h3 id="ofRegisterKeyEvents">void ofRegisterKeyEvents(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has keyPressed, keyReleased methods to handle the events being dispatched to it.</p>
<h3 id="ofRegisterTouchEvents">void ofRegisterTouchEvents(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has touchDown, touchMoved, touchUp, touchDoubleTap, touchCancelled methods to handle the events being dispatched to it.</p>
<h3 id="ofRegisterGetMessages">void ofRegisterGetMessages(ListenerClass * listener)</h3>
<p>Register the mouse events to the listener. This assumes that the listener has a gotMessage method to handle the events being dispatched to it.</p>
<h3 id="ofRegisterDragEvents">void ofRegisterDragEvents(ListenerClass * listener)</h3>
<p>Register the drag events to the listener. This assumes that the listener has the dragEvent method to handle the events being dispatched to it.</p>
<h3 id="ofUnregisterMouseEvents">void ofUnregisterMouseEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to mouse events.</p>
<h3 id="ofUnregisterKeyEvents">void ofUnregisterKeyEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to key events.</p>
<h3 id="ofUnregisterTouchEvents">void ofUnregisterTouchEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to touch events.</p>
<h3 id="ofUnregisterGetMessages">void ofUnregisterGetMessages(ListenerClass * listener)</h3>
<p>Stop the listener from listening to message events.</p>
<h3 id="ofUnregisterDragEvents">void ofUnregisterDragEvents(ListenerClass * listener)</h3>
<p>Stop the listener from listening to drag events.</p>

0 comments on commit 1f97489

Please sign in to comment.