Allolib  1.0
C++ Components For Interactive Multimedia
al::Window Class Reference

Window with OpenGL context. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/io/al_Window.hpp>

Classes

struct  Dim
 Window pixel dimensions. More...
 

Public Types

enum  DisplayMode : unsigned int {
  SINGLE_BUF = 1 << 0 , DOUBLE_BUF = 1 << 1 , STEREO_BUF = 1 << 2 , ACCUM_BUF = 1 << 3 ,
  ALPHA_BUF = 1 << 4 , DEPTH_BUF = 1 << 5 , STENCIL_BUF = 1 << 6 , MULTISAMPLE = 1 << 7 ,
  DEFAULT_BUF
}
 Window display mode bit flags. More...
 
enum  Cursor { NONE = 0 , POINTER = 1 , CROSSHAIR }
 Cursor icon types.
 
typedef std::vector< WindowEventHandler * > WindowEventHandlers
 

Public Member Functions

bool create (bool is_verbose=false)
 
void makeCurrent ()
 
void refresh ()
 
void close ()
 
bool shouldClose ()
 
void destroy ()
 Destroy current window and its associated graphics context.
 
const Keyboardkeyboard () const
 Get current keyboard state.
 
const Mousemouse () const
 Get current mouse state.
 
double aspect () const
 Get aspect ratio (width divided by height)
 
bool created () const
 
Cursor cursor () const
 Get current cursor type.
 
bool cursorHide () const
 Whether the cursor is hidden.
 
Dim dimensions () const
 Get current dimensions of window.
 
DisplayMode displayMode () const
 Get current display mode.
 
bool enabled (DisplayMode v) const
 Get whether display mode flag is set.
 
bool fullScreen () const
 Get whether window is in fullscreen.
 
const std::string & title () const
 Get title of window.
 
bool visible () const
 Get whether window is visible.
 
bool vsync () const
 Get whether v-sync is enabled.
 
int height () const
 Get window height, in pixels.
 
int width () const
 Get window width, in pixels.
 
int fbHeight () const
 
int fbWidth () const
 
float highres_factor ()
 
bool decorated () const
 
void cursor (Cursor v)
 Set cursor type.
 
void cursorHide (bool v)
 Set cursor hiding.
 
void cursorHideToggle ()
 Toggle cursor hiding.
 
void dimensions (const Dim &v)
 Set dimensions.
 
void dimensions (int w, int h)
 Set dimensions.
 
void dimensions (int x, int y, int w, int h)
 Set dimensions.
 
void displayMode (DisplayMode v)
 
void fullScreen (bool on, int monitorIndex=0)
 
void fullScreenToggle ()
 Toggle fullscreen.
 
void hide ()
 Hide window (if showing)
 
void iconify ()
 Iconify window.
 
void title (const std::string &v)
 Set title.
 
void vsync (bool v)
 
void decorated (bool b)
 
WindowEventHandlers & windowEventHandlers ()
 
Windowappend (WindowEventHandler &v)
 
Windowprepend (WindowEventHandler &v)
 
Windowremove (WindowEventHandler &v)
 Remove all window event handlers matching argument.
 

Static Public Member Functions

static void destroyAll ()
 Destroy all created windows.
 

Public Attributes

std::function< bool(Keyboard const &)> onKeyDown
 
std::function< bool(Keyboard const &)> onKeyUp
 
std::function< bool(Mouse const &)> onMouseDown
 
std::function< bool(Mouse const &)> onMouseUp
 
std::function< bool(Mouse const &)> onMouseDrag
 
std::function< bool(Mouse const &)> onMouseMove
 
std::function< bool(Mouse const &)> onMouseScroll
 
std::function< void(int, int)> onResize = [](int, int) {}
 
Keyboard mKeyboard
 
Mouse mMouse
 
WindowEventHandlers mWindowEventHandlers
 
Dim mDim {50, 50, 640, 480}
 
Dim mFullScreenDim {0}
 
DisplayMode mDisplayMode = DEFAULT_BUF
 
std::string mTitle = "allolib"
 
Cursor mCursor = POINTER
 
bool mCursorHide = false
 
bool mFullScreen = false
 
bool mVisible = false
 
bool mVSync = true
 
bool mDecorated = true
 
float mHighresFactor = 0
 
int mFramebufferWidth = 0
 
int mFramebufferHeight = 0
 

Protected Member Functions

bool implCreate (bool is_verbose=false)
 
bool implCreated () const
 
void implMakeCurrent ()
 
void implRefresh ()
 
void implDestroy ()
 
void implSetCursor ()
 
void implSetCursorHide ()
 
void implSetDimensions ()
 
void implSetFullScreen (int monitorIndex=0)
 
void implSetTitle ()
 
void implSetVSync ()
 
void implHide ()
 
void implIconify ()
 
void implSetDecorated (bool decorated)
 
bool implShouldClose ()
 
void implClose ()
 
Windowinsert (WindowEventHandler &v, int i)
 
void callHandlersMouseDown ()
 
void callHandlersMouseDrag ()
 
void callHandlersMouseMove ()
 
void callHandlersMouseUp ()
 
void callHandlersMouseScroll ()
 
void callHandlersKeyDown ()
 
void callHandlersKeyUp ()
 
void callHandlersResize (int w, int h)
 
void callHandlersVisibility (bool v)
 

Protected Attributes

std::unique_ptr< class WindowImpl > mImpl
 

Friends

class WindowImpl
 

Detailed Description

Window with OpenGL context.

Upon construction, the Window will add itself to its list of input event handlers and its list of window event handlers.

Definition at line 251 of file al_Window.hpp.

Member Enumeration Documentation

◆ DisplayMode

enum al::Window::DisplayMode : unsigned int

Window display mode bit flags.

Enumerator
SINGLE_BUF 

Do single-buffering

DOUBLE_BUF 

Do double-buffering

STEREO_BUF 

Do left-right stereo buffering

ACCUM_BUF 

Use accumulation buffer

ALPHA_BUF 

Use alpha buffer

DEPTH_BUF 

Use depth buffer

STENCIL_BUF 

Use stencil buffer

MULTISAMPLE 

Multisampling support

DEFAULT_BUF 

Default display mode

Definition at line 256 of file al_Window.hpp.

Member Function Documentation

◆ append()

Window& al::Window::append ( WindowEventHandler v)

Append handler to window event handler list The order of handlers in the list matches their calling order.

◆ create()

bool al::Window::create ( bool  is_verbose = false)

Create window and its associated graphics context using current settings This will create a new window only if the the window has not already been created.

Returns
whether a valid window is created

◆ created()

bool al::Window::created ( ) const

Whether window has been created providing a valid graphics context

◆ displayMode()

void al::Window::displayMode ( DisplayMode  v)

Set display mode; will recreate window if different from current

◆ fullScreen()

void al::Window::fullScreen ( bool  on,
int  monitorIndex = 0 
)

This will make the window go fullscreen without borders and, if posssible, without changing the display resolution.

◆ prepend()

Window& al::Window::prepend ( WindowEventHandler v)

Prepend handler to input event handler list The order of handlers in the list matches their calling order.

◆ vsync()

void al::Window::vsync ( bool  v)

Set whether to sync the frame rate to the monitor's refresh rate

Member Data Documentation

◆ onKeyDown

std::function<bool(Keyboard const &)> al::Window::onKeyDown
Initial value:
= [](Keyboard const &) {
return true;
}

Definition at line 368 of file al_Window.hpp.

◆ onKeyUp

std::function<bool(Keyboard const &)> al::Window::onKeyUp
Initial value:
= [](Keyboard const &) {
return true;
}

Definition at line 371 of file al_Window.hpp.

◆ onMouseDown

std::function<bool(Mouse const &)> al::Window::onMouseDown
Initial value:
= [](Mouse const &) {
return true;
}

Definition at line 374 of file al_Window.hpp.

◆ onMouseDrag

std::function<bool(Mouse const &)> al::Window::onMouseDrag
Initial value:
= [](Mouse const &) {
return true;
}

Definition at line 380 of file al_Window.hpp.

◆ onMouseMove

std::function<bool(Mouse const &)> al::Window::onMouseMove
Initial value:
= [](Mouse const &) {
return true;
}

Definition at line 383 of file al_Window.hpp.

◆ onMouseScroll

std::function<bool(Mouse const &)> al::Window::onMouseScroll
Initial value:
= [](Mouse const &) {
return true;
}

Definition at line 386 of file al_Window.hpp.

◆ onMouseUp

std::function<bool(Mouse const &)> al::Window::onMouseUp
Initial value:
= [](Mouse const &) {
return true;
}

Definition at line 377 of file al_Window.hpp.


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