Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
orrery::viz::ViewerWindow Class Reference

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
ViewerWindowoperator= (const ViewerWindow &)=delete
 ViewerWindow (ViewerWindow &&)=delete
ViewerWindowoperator= (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 ()
OrbitCameracamera () noexcept
const OrbitCameracamera () const noexcept

Static Public Member Functions

static GlProcedureLoader loader () noexcept
 How the renderer resolves OpenGL entry points.

Detailed Description

A window, its context, and an orbit camera the mouse drives.

Constructor & Destructor Documentation

◆ ViewerWindow()

orrery::viz::ViewerWindow::ViewerWindow ( const WindowOptions & options)
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.

Member Function Documentation

◆ width()

std::size_t orrery::viz::ViewerWindow::width ( ) const
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.

◆ poll()

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.


The documentation for this class was generated from the following file: