reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofAppBaseWindow.h
Go to the documentation of this file.
1#pragma once
2
3#include "ofWindowSettings.h"
4#include "ofConstants.h"
5
6class ofBaseApp;
8class ofCoreEvents;
9
10#if defined(TARGET_LINUX) && !defined(TARGET_OPENGLES)
11struct __GLXcontextRec;
12typedef __GLXcontextRec * GLXContext;
13#endif
14
15#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY)
16typedef unsigned long Window;
17struct _XDisplay;
18typedef struct _XDisplay Display;
19#endif
20
22public:
23
25 virtual ~ofAppBaseWindow(){}
26
27 virtual void setup(const ofWindowSettings & settings)=0;
28 virtual void update()=0;
29 virtual void draw()=0;
30 virtual bool getWindowShouldClose(){
31 return false;
32 }
33 virtual void setWindowShouldClose(){}
34 virtual void close(){}
35 virtual ofCoreEvents & events() = 0;
36 virtual std::shared_ptr<ofBaseRenderer> & renderer() = 0;
37
38 virtual void hideCursor(){}
39 virtual void showCursor(){}
40
41 virtual void setWindowPosition(int x, int y){}
42 virtual void setWindowShape(int w, int h){}
43
44 virtual glm::vec2 getWindowPosition(){ return glm::vec2(); }
45 virtual glm::vec2 getWindowSize(){ return glm::vec2(); }
46 virtual glm::vec2 getScreenSize(){ return glm::vec2(); }
47
48 virtual void setOrientation(ofOrientation orientation){ }
50 virtual bool doesHWOrientation(){ return false; }
51
52 //this is used by ofGetWidth and now determines the window width based on orientation
53 virtual int getWidth(){ return 0; }
54 virtual int getHeight(){ return 0; }
55
56 virtual void setWindowTitle(std::string title){}
57
59
60 virtual void setFullscreen(bool fullscreen){}
61 virtual void toggleFullscreen(){}
62
63 virtual void enableSetupScreen(){}
64 virtual void disableSetupScreen(){}
65
66 virtual void setVerticalSync(bool enabled){}
67 virtual void setClipboardString(const std::string& text){}
68 virtual std::string getClipboardString(){ return ""; }
69
70 virtual void makeCurrent(){}
71 virtual void swapBuffers(){}
72 virtual void startRender(){}
73 virtual void finishRender(){}
74
75 virtual void * getWindowContext(){ return nullptr; }
76
77#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY)
78 virtual Display* getX11Display(){ return nullptr; }
79 virtual Window getX11Window(){ return 0; }
80#endif
81
82#if defined(TARGET_LINUX) && !defined(TARGET_OPENGLES)
83 virtual GLXContext getGLXContext(){ return 0; }
84#endif
85
86#if defined(TARGET_LINUX) && defined(TARGET_OPENGLES)
87 virtual EGLDisplay getEGLDisplay(){ return 0; }
88 virtual EGLContext getEGLContext(){ return 0; }
89 virtual EGLSurface getEGLSurface(){ return 0; }
90#endif
91
92#if defined(TARGET_OSX)
93 virtual void * getNSGLContext(){ return nullptr; }
94 virtual void * getCocoaWindow(){ return nullptr; }
95#endif
96
97#if defined(TARGET_WIN32)
98 virtual HGLRC getWGLContext(){ return 0; }
99 virtual HWND getWin32Window(){ return 0; }
100#endif
101};
102
104public:
106 virtual void setup(const ofGLWindowSettings & settings)=0;
107 void setup(const ofWindowSettings & settings){
108 const ofGLWindowSettings * glSettings = dynamic_cast<const ofGLWindowSettings*>(&settings);
109 if(glSettings){
110 setup(*glSettings);
111 }else{
112 setup(ofGLWindowSettings(settings));
113 }
114 }
115};
116
118public:
120 virtual void setup(const ofGLESWindowSettings & settings)=0;
121 void setup(const ofWindowSettings & settings){
122 const ofGLESWindowSettings * glSettings = dynamic_cast<const ofGLESWindowSettings*>(&settings);
123 if(glSettings){
124 setup(*glSettings);
125 }else{
126 setup(ofGLESWindowSettings(settings));
127 }
128 }
129};
Definition ofAppBaseWindow.h:117
virtual void setup(const ofGLESWindowSettings &settings)=0
void setup(const ofWindowSettings &settings)
Definition ofAppBaseWindow.h:121
virtual ~ofAppBaseGLESWindow()
Definition ofAppBaseWindow.h:119
Definition ofAppBaseWindow.h:103
void setup(const ofWindowSettings &settings)
Definition ofAppBaseWindow.h:107
virtual void setup(const ofGLWindowSettings &settings)=0
virtual ~ofAppBaseGLWindow()
Definition ofAppBaseWindow.h:105
Definition ofAppBaseWindow.h:21
virtual void setWindowPosition(int x, int y)
Definition ofAppBaseWindow.h:41
virtual void update()=0
virtual void setVerticalSync(bool enabled)
Definition ofAppBaseWindow.h:66
virtual ofCoreEvents & events()=0
virtual void * getWindowContext()
Definition ofAppBaseWindow.h:75
virtual void setClipboardString(const std::string &text)
Definition ofAppBaseWindow.h:67
ofAppBaseWindow()
Definition ofAppBaseWindow.h:24
virtual void makeCurrent()
Definition ofAppBaseWindow.h:70
virtual void startRender()
Definition ofAppBaseWindow.h:72
virtual int getWidth()
Definition ofAppBaseWindow.h:53
virtual void setFullscreen(bool fullscreen)
Definition ofAppBaseWindow.h:60
virtual std::shared_ptr< ofBaseRenderer > & renderer()=0
virtual glm::vec2 getWindowSize()
Definition ofAppBaseWindow.h:45
virtual void setWindowTitle(std::string title)
Definition ofAppBaseWindow.h:56
virtual bool doesHWOrientation()
Definition ofAppBaseWindow.h:50
virtual glm::vec2 getWindowPosition()
Definition ofAppBaseWindow.h:44
virtual bool getWindowShouldClose()
Definition ofAppBaseWindow.h:30
virtual void draw()=0
virtual glm::vec2 getScreenSize()
Definition ofAppBaseWindow.h:46
virtual void setWindowShouldClose()
Definition ofAppBaseWindow.h:33
virtual ofWindowMode getWindowMode()
Definition ofAppBaseWindow.h:58
virtual void close()
Definition ofAppBaseWindow.h:34
virtual std::string getClipboardString()
Definition ofAppBaseWindow.h:68
virtual void setOrientation(ofOrientation orientation)
Definition ofAppBaseWindow.h:48
virtual void showCursor()
Definition ofAppBaseWindow.h:39
virtual ~ofAppBaseWindow()
Definition ofAppBaseWindow.h:25
virtual void toggleFullscreen()
Definition ofAppBaseWindow.h:61
virtual ofOrientation getOrientation()
Definition ofAppBaseWindow.h:49
virtual void enableSetupScreen()
Definition ofAppBaseWindow.h:63
virtual void setup(const ofWindowSettings &settings)=0
virtual void disableSetupScreen()
Definition ofAppBaseWindow.h:64
virtual int getHeight()
Definition ofAppBaseWindow.h:54
virtual void finishRender()
Definition ofAppBaseWindow.h:73
virtual void hideCursor()
Definition ofAppBaseWindow.h:38
virtual void setWindowShape(int w, int h)
Definition ofAppBaseWindow.h:42
virtual void swapBuffers()
Definition ofAppBaseWindow.h:71
Definition ofBaseApp.h:14
The base renderer interface.
Definition ofGraphicsBaseTypes.h:279
Definition ofEvents.h:326
Definition ofWindowSettings.h:120
Definition ofWindowSettings.h:92
Definition ofWindowSettings.h:38
void * EGLSurface
Definition ofAppEGLWindow.h:29
void * EGLContext
Definition ofAppEGLWindow.h:30
unsigned long Window
Definition ofAppEGLWindow.h:21
void * EGLDisplay
Definition ofAppEGLWindow.h:27
struct _XDisplay Display
Definition ofAppEGLWindow.h:23
ofOrientation
Used to represent the available screen orientations.
Definition ofWindowSettings.h:25
@ OF_ORIENTATION_DEFAULT
Represents the default screen orientation.
Definition ofWindowSettings.h:27
ofWindowMode
Used to represent the available windowing modes for the application.
Definition ofWindowSettings.h:8
@ OF_WINDOW
A floating application window.
Definition ofWindowSettings.h:10