| Support Forum Library Source SourceForge Page G3D Web Page |
Inherits G3D::OSWindow.
Public Member Functions | |
| virtual | ~CarbonWindow () |
| virtual std::string | _clipboardText () const override |
| virtual void | _setClipboardText (const std::string &text) const override |
| virtual std::string | caption () |
| The window title. | |
| virtual std::string | className () const |
| virtual Rect2D | clientRect () const override |
| Size of the inside of the window (the part that the program can render to) | |
| virtual void | decInputCaptureCount () |
| virtual void | decMouseHideCount () |
| virtual void | fireEvent (const GEvent &event) |
| Inserts an event into the queue. | |
| virtual Rect2D | fullRect () const override |
| Shape of the window, including borders. | |
| std::string | getAPIName () const |
| Description of the windowing API for logging purposes (e.g. | |
| std::string | getAPIVersion () const |
| Description of the windowing API for logging purposes (e.g. | |
| virtual void | getDroppedFilenames (Array< std::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. | |
| virtual void | getJoystickState (unsigned int stickNum, Array< float > &axis, Array< bool > &buttons) const override |
| Returns the state of the given joystick. | |
| virtual void | getRelativeMouseState (Vector2 &position, uint8 &mouseButtons) const |
| Returns the current mouse position and the state of the mouse buttons. | |
| virtual void | getRelativeMouseState (int &x, int &y, uint8 &mouseButtons) const |
| virtual void | getRelativeMouseState (double &x, double &y, uint8 &mouseButtons) const |
| virtual void | getSettings (OSWindow::Settings &settings) const |
| Return the actual properties of this window (as opposed to the desired settings from which it was initialized) | |
| virtual bool | hasFocus () const |
| Returns true if this window currently has [keyboard] focus (i.e. | |
| virtual int | height () const |
| 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. | |
| virtual std::string | joystickName (unsigned int stickNum) const |
| The name by which the OS refers to this joystick (e.g. | |
| void | makeCurrent () const |
| Makes the OpenGL context of this window current. | |
| 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. | |
| virtual bool | mouseVisible () const |
| virtual int | numJoysticks () const |
| Returns 0 if there are no joysticks available. | |
| virtual bool | pollEvent (GEvent &e) |
| Checks to see if any events are waiting. | |
| virtual void | popLoopBody () |
| Pops a loop body off the stack. | |
| virtual void | pushLoopBody (void(*body)(void *), void *arg) |
| Pushes a function onto the stack of functions called by runMainLoop. | |
| virtual void | pushLoopBody (GApp *app) |
| Invokes GApplet::beginRun after the applet is on the stack. | |
| RenderDevice * | renderDevice () const |
| If a RenderDevice has been created and initialized for this window, returns that renderDevice. | |
| virtual bool | requiresMainLoop () const |
| Windows for which this is true require a program to hand control of the main loop to OSWindow::startMainLoop. | |
| virtual void | runMainLoop () |
| Executes an event loop, invoking callback repeatedly. | |
| virtual void | setCaption (const std::string &title) |
| virtual void | setClientPosition (int x, int y) override |
| virtual void | setClientRect (const Rect2D &dims) override |
| virtual void | setFullPosition (int x, int y) override |
| Fails silently if unable to change the position. | |
| virtual void | setFullRect (const Rect2D &dims) override |
| Fails silently if unable to change the dimensions. | |
| virtual void | setGammaRamp (const Array< uint16 > &gammaRamp) |
| gammaRamp.length() = 256 | |
| virtual void | setIcon (const Image::Ref &image) |
| Set the icon (if supported). | |
| virtual void | setIcon (const std::string &imageFilename) |
| virtual void | setInputCapture (bool c) |
| Capture the keyboard and mouse focus, locking the mouse to the client area of this window. | |
| void | setInputCaptureCount (int c) |
| void | setMouseHideCount (int c) |
| virtual void | setMouseVisible (bool b) |
| virtual void | setRelativeMousePosition (double x, double y) |
| virtual void | setRelativeMousePosition (const Vector2 &p) |
| Relative to the window origin. | |
| virtual void | swapGLBuffers () |
| Swap the OpenGL front and back buffers. | |
| virtual int | width () const |
| Measured in pixels, this is the client area of the window. | |
| WindowRef | windowref () const |
Static Public Member Functions | |
| static std::string | clipboardText () |
| Uses the current() OSWindow instance to obtain text from the operating system clipboard. | |
| static CarbonWindow * | create (const OSWindow::Settings &settings=OSWindow::Settings()) |
| static CarbonWindow * | create (const OSWindow::Settings &settings, WindowRef window) |
| static const OSWindow * | current () |
| static void | getFullScreenResolutions (Array< Vector2int32 > &array) |
| Enumerates all full-screen resolutions. | |
| static int | numDisplays () |
| Number of physical displays (e.g., monitors) reported by the operating system. | |
| static Vector2 | primaryDisplaySize () |
| Dimensions in pixels of the primary display. | |
| static Vector2 | primaryDisplayWindowSize () |
| Dimensions in pixels of a maximized (but not full-screen) window on the primary display. | |
| static void | setClipboardText (const std::string &text) |
| Uses the current() OSWindow instance to put text on the operating system clipboard. | |
| static Vector2 | virtualDisplaySize () |
| Dimensions of the bounding rectangle of all displays. | |
Protected Member Functions | |
| void | executeLoopBody () |
| Subclasses should call from their idle function. | |
| virtual void | getOSEvents (Queue< GEvent > &events) |
| Extract new events from the underlying operating system. | |
| virtual void | handleResize (int width, int height) |
| Handles updating size settings and viewport for window size changes. | |
| bool | notDone () |
| virtual void | reallyMakeCurrent () const |
| Override this with the glMakeCurrent call appropriate for your window. | |
Protected Attributes | |
| Queue< GEvent > | m_eventQueue |
| int | m_inputCaptureCount |
| int | m_mouseHideCount |
| RenderDevice * | m_renderDevice |
| Settings | m_settings |
| Use this to maintain settings in sub-classes. | |
Friends | |
| void | _internal::HIDCollectJoyElementsArrayHandler (const void *value, void *parameter) |
| pascal OSStatus | _internal::OnActivation (EventHandlerCallRef handlerRef, EventRef event, void *userData) |
| pascal OSStatus | _internal::OnAppQuit (EventHandlerCallRef handlerRef, EventRef event, void *userData) |
| pascal OSStatus | _internal::OnDeactivation (EventHandlerCallRef handlerRef, EventRef event, void *userData) |
| pascal OSStatus | _internal::OnDeviceScroll (EventHandlerCallRef handlerRef, EventRef event, void *userData) |
| pascal OSErr | _internal::OnDragReceived (WindowRef theWindow, void *userData, DragRef theDrag) |
| pascal OSStatus | _internal::OnWindowClosed (EventHandlerCallRef handlerRef, EventRef event, void *userData) |
| pascal OSStatus | _internal::OnWindowSized (EventHandlerCallRef handlerRef, EventRef event, void *userData) |
|
virtual |
|
overridevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Implements G3D::OSWindow.
|
virtual |
The window title.
Implements G3D::OSWindow.
|
inlinevirtual |
Implements G3D::OSWindow.
|
overridevirtual |
Size of the inside of the window (the part that the program can render to)
Implements G3D::OSWindow.
|
staticinherited |
|
static |
|
static |
|
inlinestaticinherited |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
protectedinherited |
Subclasses should call from their idle function.
Referenced by G3D::OSWindow::runMainLoop().
Inserts an event into the queue.
|
inlineoverridevirtual |
Shape of the window, including borders.
Implements G3D::OSWindow.
|
virtual |
Description of the windowing API for logging purposes (e.g.
"SDL").
Implements G3D::OSWindow.
|
virtual |
Description of the windowing API for logging purposes (e.g.
"1.2.7" for SDL 1.2.7).
Implements G3D::OSWindow.
|
overridevirtual |
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.
|
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 asserition 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
Implements G3D::OSWindow.
Extract new events from the underlying operating system.
Reimplemented from G3D::OSWindow.
|
virtual |
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.
|
virtual |
Implements G3D::OSWindow.
|
virtual |
Implements G3D::OSWindow.
|
virtual |
Return the actual properties of this window (as opposed to the desired settings from which it was initialized)
Implements G3D::OSWindow.
Handles updating size settings and viewport for window size changes.
|
virtual |
Returns true if this window currently has [keyboard] focus (i.e.
is in the foreground, not minimized, recieves keystrokes.)
Implements G3D::OSWindow.
|
virtual |
Implements 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().
|
virtual |
|
inlineinherited |
Makes the OpenGL context of this window current.
If you have multiple windows, call this before rendering to one of them. beta
|
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.
|
virtual |
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.
|
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 |
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.
|
inlinevirtualinherited |
Pushes a function onto the stack of functions called by runMainLoop.
Invokes GApplet::beginRun after the applet is on the stack.
|
inlineprotectedvirtualinherited |
Override this with the glMakeCurrent call appropriate for your window.
Reimplemented in G3D::Win32Window, and G3D::SDLWindow.
Referenced by G3D::OSWindow::makeCurrent().
|
inlineinherited |
If a RenderDevice has been created and initialized for this window, returns that renderDevice.
Otherwise returns NULL.
|
inlinevirtual |
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:
<PRE>
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, NULL); 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.
|
virtual |
Implements G3D::OSWindow.
Implements G3D::OSWindow.
Implements G3D::OSWindow.
Referenced by setClientPosition().
|
staticinherited |
Fails silently if unable to change the position.
Sets the window (not client) position.
Implements G3D::OSWindow.
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.
|
virtual |
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.
|
inlinevirtualinherited |
|
virtual |
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.
Referenced by G3D::OSWindow::decInputCaptureCount(), and G3D::OSWindow::incInputCaptureCount().
Referenced by G3D::OSWindow::decMouseHideCount(), and G3D::OSWindow::incMouseHideCount().
|
virtual |
Implements G3D::OSWindow.
|
virtual |
Implements G3D::OSWindow.
Relative to the window origin.
Implements G3D::OSWindow.
|
virtual |
|
static |
Dimensions of the bounding rectangle of all displays.
For a multi-monitor configuration, this is the net "display" size.
|
virtual |
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.
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protectedinherited |
Referenced by G3D::OSWindow::inputCaptureCount(), and G3D::OSWindow::setInputCaptureCount().
|
protectedinherited |
Referenced by G3D::OSWindow::mouseHideCount(), and G3D::OSWindow::setMouseHideCount().
|
protectedinherited |
Referenced by G3D::OSWindow::renderDevice().
|
protectedinherited |
Use this to maintain settings in sub-classes.
Referenced by setClientPosition().
1.8.2