|
Orrery
A GPU-accelerated N-body gravitational simulator
|
A window, its context, and an orbit camera the mouse drives. More...
#include <orrery/viz/viewer_window.hpp>
Public Member Functions | |
| ViewerWindow (const WindowOptions &options) | |
| Create the window and make its context current on this thread. | |
| ViewerWindow (const ViewerWindow &)=delete | |
| ViewerWindow & | operator= (const ViewerWindow &)=delete |
| ViewerWindow (ViewerWindow &&)=delete | |
| ViewerWindow & | operator= (ViewerWindow &&)=delete |
| std::size_t | width () const noexcept |
| The size of the drawable surface in pixels. | |
| std::size_t | height () const noexcept |
| bool | should_close () const noexcept |
| void | request_close () noexcept |
| Ask the window to close, which the loop notices on its next turn. | |
| void | poll () |
| Handle everything that has happened since the last call. | |
| bool | pressed (Key key) const noexcept |
| Whether key went down during the most recent poll. | |
| bool | held (Key key) const noexcept |
| Whether key is held down now, for the controls that should repeat. | |
| void | present () |
| OrbitCamera & | camera () noexcept |
| const OrbitCamera & | camera () const noexcept |
Static Public Member Functions | |
| static GlProcedureLoader | loader () noexcept |
| How the renderer resolves OpenGL entry points. | |
A window, its context, and an orbit camera the mouse drives.
|
explicit |
Create the window and make its context current on this thread.
Throws std::runtime_error if the window system cannot be initialised or a context of the version the renderer needs cannot be created. The second is the case worth a clear message: a machine with no OpenGL 3.3 driver is a machine this renderer cannot run on, and saying so is more use than a black window.
|
nodiscardnoexcept |
The size of the drawable surface in pixels.
Not the size the window was asked for: on a display with a scale factor the two differ, and it is this one the viewport and the render target have to match.
| void orrery::viz::ViewerWindow::poll | ( | ) |
Handle everything that has happened since the last call.
Moves the camera for any dragging or scrolling, refreshes the drawable size, and records which of the keys above were pressed. The key state this leaves behind is edge triggered: pressed answers whether a key went down during this call, not whether it is down now, so holding one does not repeat.