- >forum
- >github
- >addons
- >slack
- >blog
- >donations
class methods
For example, one `ofv0.11.0osxrelease/` folder and one `ofv0.10.1osxrelease/` folder, each with their own `apps/` folder. Even when new versions of openFrameworks are released, your old apps will still compile with old versions of openFrameworks. The examples folder is a great place to start. Make Terminal windows stand out with profiles. When you’re logged in to several servers, unique background colours and window titles specified in profiles help you easily spot the right Terminal window. Use profiles built into Terminal, or create your own custom profiles. How to create profiles for Terminal windows.
variables
Extends
This class extends others, you can call their methods on an instance of ofBaseApp too:
The openFrameworks engine is contained in the 'app' category. The project works, similar to processing, in that you have a base class which extends a class that already exists. In the case of OF, there is a class called 'ofBaseApp' which contains various event driven functions. When you create an OF project, you use a main.cpp which is the boot-strap, that kicks off the application and another class, which inherits the properties of ofBaseApp. Essentially, when you write code in the testApp, you are re-writing already defined functions that exist in OF, such as update, draw, etc.
In versions pre 0.06 this class was called ofSimpleApp
void ofBaseApp::dragEvent(ofDragInfo dragInfo)
void ofBaseApp::dragged(ofDragInfo &drag)
void ofBaseApp::draw()
This function gets called regularly just after update. It's where you draw things:
void ofBaseApp::draw(ofEventArgs &args)
void ofBaseApp::exit()
Add this function to your ofApp to have it called at the moment before the app is terminated. This is useful for doing cleanup stuff or making sure files are saved before the app terminates. If you want to terminate the execution of your ofApp (from the inside), call ofExit().
void ofBaseApp::exit(ofEventArgs &args)
void ofBaseApp::gotMessage(ofMessage msg)
void ofBaseApp::keyPressed(int key)
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
void ofBaseApp::keyPressed(ofKeyEventArgs &key)
void ofBaseApp::keyReleased(int key)
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
void ofBaseApp::keyReleased(ofKeyEventArgs &key)
void ofBaseApp::messageReceived(ofMessage &message)
void ofBaseApp::mouseDragged(int x, int y, int button)
This function gets called when the mouse is moving and the button is down. The button (left 0, center 1, right 2) variable can be used to test against left or right button drags. You also receive the x and y coordinates of the mouse.
Documentation from code comments
Called on the active window when the mouse is dragged, i.e.moved with a button pressed
void ofBaseApp::mouseDragged(ofMouseEventArgs &mouse)
void ofBaseApp::mouseEntered(int x, int y)
Documentation from code comments
Called on the active window when the mouse cursor enters thewindow area
Note that the mouse coordinates are the last known x/y before theevent occurred, i.e. from the previous frame
void ofBaseApp::mouseEntered(ofMouseEventArgs &mouse)
void ofBaseApp::mouseExited(int x, int y)
Documentation from code comments
Called on the active window when the mouse cursor leaves thewindow area
Note that the mouse coordinates are the last known x/y before theevent occurred, i.e. from the previous frame
void ofBaseApp::mouseExited(ofMouseEventArgs &mouse)
void ofBaseApp::mouseMoved(int x, int y)
This function gets when ever the mouse moves. You receive the x and y coordinates of the mouse.
Documentation from code comments
Called on the active window when the mouse is moved
void ofBaseApp::mouseMoved(ofMouseEventArgs &mouse)
void ofBaseApp::mousePressed(int x, int y, int button)
This function gets called when the mouse is pushed down. The button (left 0, center 1, right 2) is passed in, along with the x and y coordinate.
Openframeworks Mac App Terminal App
Documentation from code comments
Called on the active window when a mouse button is pressed
void ofBaseApp::mousePressed(ofMouseEventArgs &mouse)
void ofBaseApp::mouseReleased(int x, int y, int button)
This function gets called when the mouse is released. The button (left 0, center 1, right 2) is passed in, along with the x and y coordinate.
Documentation from code comments
Called on the active window when a mouse button is released
void ofBaseApp::mouseReleased(ofMouseEventArgs &mouse)
void ofBaseApp::mouseScrolled(int x, int y, float scrollX, float scrollY)
Documentation from code comments
Openframeworks Mac App Terminal Password
Called on the active window when the mouse wheel is scrolled
void ofBaseApp::mouseScrolled(ofMouseEventArgs &mouse)
Openframeworks Mac App Terminal Download
void ofBaseApp::setup()
This function gets called once, just at the start of the app. It would be a good place, for example, to allocate variables or load in any files.
void ofBaseApp::setup(ofEventArgs &args)
void ofBaseApp::touchCancelled(int x, int y, int id)
void ofBaseApp::touchCancelled(ofTouchEventArgs &touch)
void ofBaseApp::touchDoubleTap(int x, int y, int id)
void ofBaseApp::touchDoubleTap(ofTouchEventArgs &touch)
void ofBaseApp::touchDown(int x, int y, int id)
void ofBaseApp::touchDown(ofTouchEventArgs &touch)
void ofBaseApp::touchMoved(int x, int y, int id)
void ofBaseApp::touchMoved(ofTouchEventArgs &touch)
void ofBaseApp::touchUp(int x, int y, int id)
void ofBaseApp::touchUp(ofTouchEventArgs &touch)
void ofBaseApp::update()
This function gets called repeatedly. It gets called just before draw, so it is an ideal place to do any updating of variables. For example, imagine you have a variable already defined in your ofApp.h called 'xpos'
Openframeworks Mac
void ofBaseApp::update(ofEventArgs &args)
void ofBaseApp::windowResized(int w, int h)
This function gets called when ever we resize the application window. You receive the new width (w) and the new height (h) of the window.
void ofBaseApp::windowResized(ofResizeEventArgs &resize)
int ofBaseApp::mouseX
int ofBaseApp::mouseY
Terminal User Guide
Each window in Terminal represents an instance of a shell process. The window contains a prompt that indicates you can enter a command. The prompt you see depends on your Terminal and shell preferences, but it often includes the name of the host you’re logged in to, your current working folder, your user name, and a prompt symbol. For example, if a user named michael is using the default zsh shell, the prompt appears as:
This indicates that the user named michael is logged in to a computer named MacBook-Pro, and the current folder is his home folder, indicated by the tilde (~).
Open Terminal
On your Mac, do one of the following:
Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal.
In the Finder , open the /Applications/Utilities folder, then double-click Terminal.
Quit Terminal
In the Terminal app on your Mac, choose Terminal > Quit Terminal.
Quit a shell session
In the Terminal app on your Mac, in the window running the shell process you want to quit, type
exit
, then press Return.
This ensures that commands actively running in the shell are closed. If anything’s still in progress, a dialog appears.
If you want to change the shell exit behavior, see Change Profiles Shell preferences.