Support Forum G3D Web Page |
Inherits G3D::OSWindow.
Public Member Functions | |
virtual | ~GLFWWindow () |
virtual String | _clipboardText () const override |
virtual void | _setClipboardText (const String &text) const override |
void | appendFileToFileList (String file) |
virtual String | caption () override |
The window title. More... | |
virtual String | className () const override |
void | clearDroppedFileList () |
virtual Rect2D | clientRect () const override |
Size of the inside of the window (the part that the program can render to) More... | |
bool | cursorActive () |
virtual void | decInputCaptureCount () |
virtual void | decMouseHideCount () |
virtual void | fireEvent (const GEvent &event) |
Inserts an event into the queue. More... | |
const shared_ptr< Framebuffer > & | framebuffer () const |
Returns the Framebuffer object for this window modeling the OpenGL "Hardware framebuffer", which is not an OpenGL object. More... | |
virtual Rect2D | fullRect () const override |
Shape of the window, including borders More... | |
String | getAPIName () const override |
Description of the windowing API for logging purposes (e.g. More... | |
String | getAPIVersion () const override |
Description of the windowing API for logging purposes (e.g. More... | |
GKeyMod::Value | getCurrentKeyMod () |
virtual void | getDroppedFilenames (Array< String > &files) override |
Clears the files array and then sets it to a list of all files that were dropped in the last GEventType::FILE_DROP event. More... | |
virtual void | getGameControllerState (unsigned int stickNum, Array< float > &axis, Array< bool > &button) const |
Remapping of getJoystickState() to be consistent on Windows and OS X for official Xbox360 game controllers. More... | |
virtual void | getJoystickState (unsigned int stickNum, Array< float > &axis, Array< bool > &buttons) const override |
Returns the state of the given joystick. More... | |
void | getMouseButtonState (uint8 &mouseButtons) const |
void | getMousePosition (int &x, int &y) const |
virtual void | getRelativeMouseState (Vector2 &position, uint8 &mouseButtons) const override |
Returns the current mouse position and the state of the mouse buttons. More... | |
virtual void | getRelativeMouseState (int &x, int &y, uint8 &mouseButtons) const override |
virtual void | getRelativeMouseState (double &x, double &y, uint8 &mouseButtons) const override |
virtual void | getSettings (OSWindow::Settings &settings) const override |
Return the actual properties of this window (as opposed to the desired settings from which it was initialized) More... | |
void | handleCursorEnter (int action) |
void | handleResizeFromCallback (int width, int height) |
virtual bool | hasFocus () const override |
Returns true if this window currently has [keyboard] focus (i.e. More... | |
virtual int | height () const override |
virtual void | hide () const override |
virtual void | incInputCaptureCount () |
virtual void | incMouseHideCount () |
virtual bool | inputCapture () const |
int | inputCaptureCount () const |
If the count is 1 or greater, then the keyboard and mouse focus is captured, locking the mouse to the client area of this window. More... | |
virtual bool | isIconified () const override |
Methods for returning and setting whether a window is iconified: currently, these are only implemented in GLFWWindow, so in any other case isIconified() returns false. More... | |
virtual String | joystickName (unsigned int stickNum) const override |
The name by which the OS refers to this joystick (e.g. More... | |
void | makeCurrent () const |
Makes the OpenGL context of this window current. More... | |
void | modifyCurrentKeyMod (GKeyMod::Value button, GButtonState state) |
int | mouseHideCount () const |
If the count is 1 or greater, then the keyboard and mouse focus is captured, locking the mouse to the client area of this window. More... | |
virtual bool | mouseVisible () const |
virtual int | numJoysticks () const override |
Returns 0 if there are no joysticks available. More... | |
virtual bool | pollEvent (GEvent &e) |
Checks to see if any events are waiting. More... | |
virtual void | popLoopBody () |
Pops a loop body off the stack. More... | |
virtual void | pushLoopBody (void(*body)(void *), void *arg) |
Pushes a function onto the stack of functions called by runMainLoop. More... | |
virtual void | pushLoopBody (GApp *app) |
Invokes GApplet::beginRun after the applet is on the stack. More... | |
RenderDevice * | renderDevice () const |
If a RenderDevice has been created and initialized for this window, returns that renderDevice. More... | |
virtual bool | requiresMainLoop () const override |
Windows for which this is true require a program to hand control of the main loop to OSWindow::startMainLoop. More... | |
virtual void | runMainLoop () |
Executes an event loop, invoking callback repeatedly. More... | |
virtual void | setAsCurrentGraphicsContext () const override |
Override this with the glMakeCurrent call appropriate for your window. More... | |
virtual void | setCaption (const String &title) override |
virtual void | setClientPosition (int x, int y) override |
virtual void | setClientRect (const Rect2D &dims) override |
virtual void | setFullPosition (int x, int y) override |
Only differs from setClientPosition properly on Windows. More... | |
virtual void | setFullRect (const Rect2D &dims) override |
Fails silently if unable to change the dimensions. More... | |
virtual void | setGammaRamp (const Array< uint16 > &gammaRamp) override |
gammaRamp.length() = 256 More... | |
virtual void | setIcon (const shared_ptr< Image > &src) override |
Set the icon (if supported). More... | |
virtual void | setIcon (const String &imageFilename) override |
virtual void | setIconified (bool b) override |
virtual void | setInputCapture (bool c) override |
Capture the keyboard and mouse focus, locking the mouse to the client area of this window. More... | |
void | setInputCaptureCount (int c) |
void | setMouseHideCount (int c) |
virtual void | setMouseVisible (bool b) override |
virtual void | setRelativeMousePosition (double x, double y) override |
virtual void | setRelativeMousePosition (const Vector2 &p) override |
Relative to the window origin. More... | |
void | setSize (int width, int height) |
const Settings & | settings () const |
virtual void | show () const override |
virtual void | swapGLBuffers () override |
Swap the OpenGL front and back buffers. More... | |
int | visibleCursorMode () |
virtual int | width () const override |
Measured in pixels, this is the client area of the window. More... | |
Static Public Member Functions | |
static String | clipboardText () |
Uses the current() OSWindow instance to obtain text from the operating system clipboard. More... | |
static GLFWWindow * | create (const OSWindow::Settings &settings=OSWindow::Settings()) |
static const OSWindow * | current () |
static float | defaultGuiPixelScale () |
GUI scaling for high-DPI monitors. More... | |
static GLFWWindow * | getCurrentWindowPtr () |
static void | getFullScreenResolutions (Array< Vector2int32 > &array) |
Enumerates all full-screen resolutions. More... | |
static GLFW_api_window * | getMasterWindowPtr () |
static int | numDisplays () |
Number of physical displays (e.g., monitors) reported by the operating system. More... | |
static void | popGraphicsContext () |
Pop window off the top of the stack. More... | |
static float | primaryDisplayRefreshRate (int width, int height) |
Return the maximum refresh rate supported at or above this resolution. More... | |
static Vector2 | primaryDisplaySize () |
Dimensions in pixels of the primary display. More... | |
static Vector2int32 | primaryDisplayWindowSize () |
Dimensions in pixels of a maximized (but not full-screen) window on the primary display. More... | |
static void | pushGraphicsContext (OSWindow *window) |
Push the current window on the stack. More... | |
static void | setClipboardText (const String &text) |
Uses the current() OSWindow instance to put text on the operating system clipboard. More... | |
static Vector2 | virtualDisplaySize () |
Dimensions of the bounding rectangle of all displays. More... | |
Protected Member Functions | |
void | executeLoopBody () |
Subclasses should call from their idle function. More... | |
virtual void | getOSEvents (Queue< GEvent > &events) override |
Extract new events from the underlying operating system. More... | |
virtual void | handleResize (int width, int height) |
Handles updating size settings and viewport for window size changes. More... | |
bool | notDone () |
Protected Attributes | |
Queue< GEvent > | m_eventQueue |
shared_ptr< Framebuffer > | m_framebuffer |
int | m_inputCaptureCount |
int | m_mouseHideCount |
RenderDevice * | m_renderDevice |
Settings | m_settings |
Use this to maintain settings in sub-classes. More... | |
|
virtual |
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
inline |
|
overridevirtual |
The window title.
Implements G3D::OSWindow.
|
inlineoverridevirtual |
Implements G3D::OSWindow.
|
inline |
|
overridevirtual |
Size of the inside of the window (the part that the program can render to)
Implements G3D::OSWindow.
|
staticinherited |
|
static |
|
inlinestaticinherited |
|
inline |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
static |
GUI scaling for high-DPI monitors.
|
protectedinherited |
Subclasses should call from their idle function.
Referenced by G3D::OSWindow::runMainLoop().
|
virtualinherited |
Inserts an event into the queue.
|
inherited |
Returns the Framebuffer object for this window modeling the OpenGL "Hardware framebuffer", which is not an OpenGL object.
This framebuffer has a size and format (determined by querying OpenGL on construction) but cannot have attachments.
|
inlineoverridevirtual |
Shape of the window, including borders
Implements G3D::OSWindow.
|
overridevirtual |
Description of the windowing API for logging purposes (e.g.
"SDL").
Implements G3D::OSWindow.
|
overridevirtual |
Description of the windowing API for logging purposes (e.g.
"1.2.7" for SDL 1.2.7).
Implements G3D::OSWindow.
|
inline |
|
static |
Clears the files array and then sets it to a list of all files that were dropped in the last GEventType::FILE_DROP event.
Implements G3D::OSWindow.
|
staticinherited |
Enumerates all full-screen resolutions.
|
virtualinherited |
Remapping of getJoystickState() to be consistent on Windows and OS X for official Xbox360 game controllers.
|
overridevirtual |
Returns the state of the given joystick.
Not all sticks support all buttons and axes and frequently the state of one stick overlaps the state of another. An assertion fails if stickNum > numJoysticks(). Joystick axes are normalized to the range -1, 1. Joystick axes should be in the starting order: X, Y, Z, Slider1, Slider2, rX, rY, rZ
There are few standards for joysticks. Different joysticks may have different mappings, and even a single joystick may be mapped differently on different operating systems or drivers.
Implements G3D::OSWindow.
|
inlinestatic |
void G3D::GLFWWindow::getMouseButtonState | ( | uint8 & | mouseButtons | ) | const |
void G3D::GLFWWindow::getMousePosition | ( | int & | x, |
int & | y | ||
) | const |
Extract new events from the underlying operating system.
Reimplemented from G3D::OSWindow.
|
overridevirtual |
Returns the current mouse position and the state of the mouse buttons.
It is essential to sample both simultaneously so that the mouse has not moved from the location where a click occurred.
position | In pixels, with y=up. Relative to the upper left corner of the window. |
mouseButtons | If button i is currently pressed then bit i is set. |
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Return the actual properties of this window (as opposed to the desired settings from which it was initialized)
Implements G3D::OSWindow.
void G3D::GLFWWindow::handleCursorEnter | ( | int | action | ) |
|
protectedvirtualinherited |
Handles updating size settings and viewport for window size changes.
Referenced by handleResizeFromCallback().
|
inline |
|
overridevirtual |
Returns true if this window currently has [keyboard] focus (i.e.
is in the foreground, not minimized, recieves keystrokes.)
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
Referenced by handleResizeFromCallback().
|
overridevirtual |
Reimplemented from G3D::OSWindow.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
virtual |
|
inlineinherited |
If the count is 1 or greater, then the keyboard and mouse focus is captured, locking the mouse to the client area of this window.
The use of a count instead of an explicit capture/release API allows multiple parts of a program to capture input without accidentally releasing and enclosing capture.
Referenced by G3D::OSWindow::decInputCaptureCount(), and G3D::OSWindow::incInputCaptureCount().
|
overridevirtual |
Methods for returning and setting whether a window is iconified: currently, these are only implemented in GLFWWindow, so in any other case isIconified() returns false.
Reimplemented from G3D::OSWindow.
|
overridevirtual |
|
inlineinherited |
Makes the OpenGL context of this window current.
If you have multiple windows, call this before rendering to one of them. beta
void G3D::GLFWWindow::modifyCurrentKeyMod | ( | GKeyMod::Value | button, |
GButtonState | state | ||
) |
|
inlineinherited |
If the count is 1 or greater, then the keyboard and mouse focus is captured, locking the mouse to the client area of this window.
The use of a count instead of an explicit capture/release API allows multiple parts of a program to capture input without accidentally releasing and enclosing capture.
Referenced by G3D::OSWindow::decMouseHideCount(), and G3D::OSWindow::incMouseHideCount().
|
virtual |
|
inlineprotectedinherited |
Referenced by G3D::OSWindow::runMainLoop().
|
static |
Number of physical displays (e.g., monitors) reported by the operating system.
The OSWindow implementation calls the appropriate subclass override for the current operating system.
|
overridevirtual |
Returns 0 if there are no joysticks available.
Implements G3D::OSWindow.
|
virtualinherited |
Checks to see if any events are waiting.
If there is an event, returns true and fills out the GEvent structure. Otherwise returns false.
|
staticinherited |
Pop window off the top of the stack.
|
virtualinherited |
Pops a loop body off the stack.
If the loop body was a GApplet, invokes GApplet::endRun on it. If the loop body was a GApp2, invokes GApp2::endRun on it.
|
static |
Return the maximum refresh rate supported at or above this resolution.
|
static |
Dimensions in pixels of the primary display.
The OSWindow implementation calls the appropriate subclass override for the current operating system.
|
static |
Dimensions in pixels of a maximized (but not full-screen) window on the primary display.
Task bars and menus may make this smaller than the primaryDisplaySize().
The OSWindow implementation calls the appropriate subclass override for the current operating system.
|
staticinherited |
Push the current window on the stack.
|
inlinevirtualinherited |
Pushes a function onto the stack of functions called by runMainLoop.
|
virtualinherited |
Invokes GApplet::beginRun after the applet is on the stack.
|
inlineinherited |
If a RenderDevice has been created and initialized for this window, returns that renderDevice.
Otherwise returns nullptr.
|
inlineoverridevirtual |
Windows for which this is true require a program to hand control of the main loop to OSWindow::startMainLoop.
The program's functionality may then be implemented through the "loop body" function.
That is, if requiresMainLoop returns true, you must use the following structure:
void doEvents() { GEvent e; while (window->pollEvent(e)) { ... // Event handling } } void doGraphics() { renderDevice->beginFrame(); renderDevice->clear(true, true, true); ... // draw stuff renderDevice->endFrame(); } void loopBody(void*) { // all per-frame code; event-handling, physics, networking, AI, etc. doEvents(); doLogic(); doNetwork(); doAI(); doGraphics(); // To end the program, invoke window->popLoopBody } window->pushLoopBody(callback, nullptr); window->runMainLoop(); // doesn't return
When requiresMainLoop returns false, you may use either the above structure or the following one (which puts you in more control of when graphics vs. other code is executed):
while (true) { doEvents(); doLogic(); doNetwork(); doAI(); doGraphics(); }
This design is necessary because some underlying Window APIs (e.g. ActiveX, GLUT) enforce an event-driven structure.
Reimplemented from G3D::OSWindow.
|
inlinevirtualinherited |
Executes an event loop, invoking callback repeatedly.
Put everything that you want to execute once per frame into the callback function. It is guaranteed safe to call pollEvents and all other OSWindow methods from the callback function.
The default implementation (for requiresMainLoop() == false GWindows) just calls the callback continuously. Subclasses should use the notDone() and executeLoopBody() functions.
|
overridevirtual |
Override this with the glMakeCurrent call appropriate for your window.
Protected because user methods should call push/pop methods.
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
staticinherited |
|
overridevirtual |
Only differs from setClientPosition properly on Windows.
Implements G3D::OSWindow.
|
inlineoverridevirtual |
Fails silently if unable to change the dimensions.
The value returned by getSettings will not change immediately– it waits for a size event to update.
Implements G3D::OSWindow.
gammaRamp.length() = 256
Implements G3D::OSWindow.
|
overridevirtual |
Set the icon (if supported).
Fails silently if not supported or the window has no frame. May also fail if the OSWindow implementation's underlying GUI library is too limited.
image | May have any dimension supported by underlying OS. |
Reimplemented from G3D::OSWindow.
|
overridevirtual |
Reimplemented from G3D::OSWindow.
|
overridevirtual |
Reimplemented from G3D::OSWindow.
|
overridevirtual |
Capture the keyboard and mouse focus, locking the mouse to the client area of this window.
Sets the inputCaptureCount to 1 if c is true and 0 if c is false
Implements G3D::OSWindow.
|
inlineinherited |
Referenced by G3D::OSWindow::decInputCaptureCount(), and G3D::OSWindow::incInputCaptureCount().
|
inlineinherited |
Referenced by G3D::OSWindow::decMouseHideCount(), and G3D::OSWindow::incMouseHideCount().
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Relative to the window origin.
Implements G3D::OSWindow.
void G3D::GLFWWindow::setSize | ( | int | width, |
int | height | ||
) |
|
inlineinherited |
|
overridevirtual |
Reimplemented from G3D::OSWindow.
|
overridevirtual |
|
static |
Dimensions of the bounding rectangle of all displays.
For a multi-monitor configuration, this is the net "display" size.
int G3D::GLFWWindow::visibleCursorMode | ( | ) |
|
overridevirtual |
Measured in pixels, this is the client area of the window.
Returns the same width as getSettings and clientDimensions(). Convenience method for users.
Implements G3D::OSWindow.
Referenced by handleResizeFromCallback().
|
mutableprotectedinherited |
|
protectedinherited |
Referenced by G3D::OSWindow::inputCaptureCount(), and G3D::OSWindow::setInputCaptureCount().
|
protectedinherited |
Referenced by G3D::OSWindow::mouseHideCount(), and G3D::OSWindow::setMouseHideCount().
|
protectedinherited |
|
protectedinherited |
Use this to maintain settings in sub-classes.
Referenced by G3D::OSWindow::settings().