CG_Labs  2021.2
Classes | Public Types | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
WindowManager Class Reference

A simple class for creating and interacting with windows, using the GLFW library. More...

#include <WindowManager.hpp>

Classes

struct  WindowDatum
 

Public Types

enum class  SwapStrategy : int { disable_vsync = 0 , enable_vsync = 1 , late_swap_tearing = -1 }
 

Public Member Functions

 WindowManager ()
 
 ~WindowManager ()
 
GLFWwindow * CreateGLFWWindow (std::string const &title, WindowDatum const &data, unsigned int msaa=1u, bool fullscreen=false, bool resizable=false, SwapStrategy swap=SwapStrategy::enable_vsync)
 
void DestroyWindow (GLFWwindow *const window)
 
void NewImGuiFrame ()
 
void RenderImGuiFrame (bool show_gui)
 
void ToggleFullscreenStatusForWindow (GLFWwindow *const window) noexcept
 

Private Attributes

std::unordered_map< GLFWwindow *, std::unique_ptr< WindowDatum > > mWindowData
 

Static Private Attributes

static std::mutex mMutex
 

Detailed Description

Note: Only one instance of this class can be alive at any given time.

All windows, which were not manually destroyed using the WindowManager::DestroyWindow method, will be automatically destroyed along with the WindowManager object when it gets deleted.

Member Enumeration Documentation

◆ SwapStrategy

enum WindowManager::SwapStrategy : int
strong
Enumerator
disable_vsync 
enable_vsync 
late_swap_tearing 

Constructor & Destructor Documentation

◆ WindowManager()

WindowManager::WindowManager ( )

◆ ~WindowManager()

WindowManager::~WindowManager ( )

Member Function Documentation

◆ CreateGLFWWindow()

GLFWwindow * WindowManager::CreateGLFWWindow ( std::string const &  title,
WindowDatum const &  data,
unsigned int  msaa = 1u,
bool  fullscreen = false,
bool  resizable = false,
SwapStrategy  swap = SwapStrategy::enable_vsync 
)

◆ DestroyWindow()

void WindowManager::DestroyWindow ( GLFWwindow *const  window)

◆ NewImGuiFrame()

void WindowManager::NewImGuiFrame ( )

◆ RenderImGuiFrame()

void WindowManager::RenderImGuiFrame ( bool  show_gui)

◆ ToggleFullscreenStatusForWindow()

void WindowManager::ToggleFullscreenStatusForWindow ( GLFWwindow *const  window)
noexcept

Member Data Documentation

◆ mMutex

std::mutex WindowManager::mMutex
staticprivate

◆ mWindowData

std::unordered_map<GLFWwindow*, std::unique_ptr<WindowDatum> > WindowManager::mWindowData
private

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