- english
- /
- japanese
functions
- ofDoesHWOrientation()
- ofExit()
- ofGetAppPtr()
- ofGetFrameNum()
- ofGetFrameRate()
- ofGetHeight()
- ofGetLastFrameTime()
- ofGetOrientation()
- ofGetScreenHeight()
- ofGetScreenWidth()
- ofGetWidth()
- ofGetWindowHeight()
- ofGetWindowMode()
- ofGetWindowPositionX()
- ofGetWindowPositionY()
- ofGetWindowRect()
- ofGetWindowSize()
- ofGetWindowWidth()
- ofHideCursor()
- ofRunApp()
- ofSetAppPtr()
- ofSetFrameRate()
- ofSetFullscreen()
- ofSetOrientation()
- ofSetVerticalSync()
- ofSetWindowPosition()
- ofSetWindowShape()
- ofSetWindowTitle()
- ofSetupOpenGL()
- ofShowCursor()
- ofSleepMillis()
- ofToggleFullscreen()
ofGetAppPtr()
ofBaseApp ofGetAppPtr()
Useful to access the variables in the main app from other classes. The pointer returned by this function has to be cast from an ofBaseApp pointer, to a pointer to your inherited class, before being used.
ie:
//testApp.h
class testApp: public ofBaseApp{
...
int someVar;
}
//myClass.cpp
void myClass::method(){
doSomething( ((testApp*)ofGetAppPtr())->someVar );
}
ofGetWindowMode()
int ofGetWindowMode()
eg:
int mode = ofGetWindowMode();
if(mode == OF_WINDOW){
printf("mode is: window mode
");
}else if(mode == OF_FULLSCREEN){
printf("mode is: fullscreen mode
");
}else if(mode == OF_GAME_MODE){
printf("mode is: game mode
");
}
note: this code is implemented inside the ofAppRunner
ofGetWindowPositionX()
int ofGetWindowPositionX()
note: this code is implemented inside the ofAppRunner
ofGetWindowPositionY()
int ofGetWindowPositionY()
note: this code is implemented inside the ofAppRunner
ofHideCursor()
void ofHideCursor()
Hides the mouse cursor makes the cursor invisible. note: this code is implemented inside the ofAppRunner.
ofRunApp(...)
void ofRunApp(ofBaseApp * app)
Begins the openGL cycle of the application. It's only called once from main function in main.cpp after setting the window with ofSetupOpenGL.
From 0.06 the app is deleted on exit, so you need to call this function as shown in syntax:
ofRunApp(new testApp);
Previous versions of the examples can be using this syntax:
testApp app; ofRunApp(&app);
which will make the app crash when closing it.
ofSetFrameRate(...)
void ofSetFrameRate(int targetRate)
Attempts to set the frame rate to a given target by sleeping a certain amount per frame. The results of this may vary based if vertical sync is enabled or disabled (either at the card level or via code), because this locks the drawing to intervals where the screen refreshes.
ofSetFrameRate(...)
void ofSetFrameRate(int targetRate)
Attempts to set the frame rate to a given target by sleeping a certain amount per frame. The results of this may vary based if vertical sync is enabled or disabled (either at the card level or via code), because this locks the drawing to intervals where the screen refreshes. note: this code is implemented inside the ofAppRunner
ofSetFullscreen(...)
void ofSetFullscreen(bool fullscreen)
Change the app window mode to fullscreen or window depending on the boolean parameter. Enables or disables fullscreen mode for your app's window. note: this code is implemented inside the ofAppRunner.
ofSetWindowPosition(...)
void ofSetWindowPosition(int x)
Sets the window position in the screen to x,y expressed in pixels.
ofSetWindowPosition(...)
void ofSetWindowPosition(int x, int y)
Moves the app window to the x and y coordinates specified. For example: coordinates of (0,0) would set the top-left corner of your app window to the top-left corner of the screen. note: this code is implemented inside the ofAppRunner
ofSetWindowShape(...)
void ofSetWindowShape(int width)
Sets the window size to w,h expressed in pixels. This size is that of the drawable area, doesn't include the borders of the window.
ofSetWindowShape(...)
void ofSetWindowShape(int width, int height)
Sets the dimension of your app's window. note: this code is implemented inside the ofAppRunner
ofSetupOpenGL(...)
void ofSetupOpenGL(ofAppBaseWindow * windowPtr, int w, int h, int screenMode)
Sets up the window aspect and mode. This function should be called only from the main function in main.cpp.
w and h are the width and height of the window.
screenMode can be one of:
-
OF_WINDOW: normal window
-
OF_FULLSCREEN: fullscreen, the size of the app will be that of the current screen resolution. The w and h parameters will be ignored. This mode with the default glut window is just a window of the size of the screen without borders.
-
OF_GAME_MODE: fullscreen, the size of the app will be that passed as an argument to the function. The screen resolution will be also changed to fit that size so if the computer doesn't support that resolution, chances are that it won't work. Under glut this is real fullscreen and it's meant to be faster than window and fullscreen modes. Under linux this is the only way of getting fullscreen.
From 0.06 you can also pass a diferent version of ofAppBaseWindow than the default glut one. To pass a different windowing toolkit than glut, first create an instance of it, and then pass a pointer to it to ofSetupOpenGL.
ie:
ofAppCocoaWindow window;
ofSetupOpenGL(&window, 800, 600, OF_WINDOW);
You need to have the windowing toolkit files included in your project.
ofSetupOpenGL(...)
void ofSetupOpenGL(int w, int h, int screenMode)
Sets up the window aspect and mode. This function should be called only from the main function in main.cpp.
w and h are the width and height of the window.
screenMode can be one of:
-
OF_WINDOW: normal window
-
OF_FULLSCREEN: fullscreen, the size of the app will be that of the current screen resolution. The w and h parameters will be ignored.
ofShowCursor()
void ofShowCursor()
Shows the mouse cursor again when it's been hidden with ofHideCursor makes the cursor visible. note: this code is implemented inside the ofAppRunner
Last updated
Tuesday, 18 June 2013 17:22:38 UTC
-
b9108c2c3a74b748f90c430e68d4bbb155402a77

