CMSC23700 Common Code Library
Support code for CS23700 programming projects
cs237::Window Class Referenceabstract

abstract base class for simple GLFW windows used to view buffers, etc. More...

#include <cs237-window.hxx>

Public Member Functions

virtual ~Window ()
 destructor: it destroys the underlying GLFW window More...
 
void Refresh ()
 
void Hide ()
 Hide the window. More...
 
void Show ()
 Show the window (a no-op if it is already visible) More...
 
virtual void Draw ()=0
 
virtual void SetProjectionMatrix ()=0
 
void Reshape (int wid, int ht)
 
void Iconify (bool iconified)
 method invoked on Iconify events. More...
 

Protected Member Functions

 Window (std::string title, int wid, int ht, bool resizable, GLFWwindow *share=nullptr)
 

Protected Attributes

GLFWwindow * _win
 the underlying window More...
 
int _wid
 
int _ht
 window dimensions More...
 
bool _isVis
 true, when the window is visible More...
 

Detailed Description

abstract base class for simple GLFW windows used to view buffers, etc.

Constructor & Destructor Documentation

virtual cs237::Window::~Window ( )
virtual

destructor: it destroys the underlying GLFW window

cs237::Window::Window ( std::string  title,
int  wid,
int  ht,
bool  resizable,
GLFWwindow *  share = nullptr 
)
protected

base-class constructor

Parameters
titlethe string to display in the title bar of the window
widthe desired window width
htthe desired window height
resizableif true, then the window will be resizable
sharea pointer to a window to share resources with (default is nullptr)

Note that after creating a Window object, the Window will be the current context

Member Function Documentation

virtual void cs237::Window::Draw ( )
pure virtual

virtual draw method provided by derived classes to draw the contents of the window. It is called by Refresh.

void cs237::Window::Hide ( )
inline

Hide the window.

void cs237::Window::Iconify ( bool  iconified)

method invoked on Iconify events.

void cs237::Window::Refresh ( )

Refresh the contents of the window. This method is also invoked on Refresh events.

void cs237::Window::Reshape ( int  wid,
int  ht 
)

method invoked on Reshape events. It resets the viewport and the projection matrix (see SetProjectionMatrix)

virtual void cs237::Window::SetProjectionMatrix ( )
pure virtual

virtual method for setting the projection matrix. This method should be called once after the window is created.

void cs237::Window::Show ( )
inline

Show the window (a no-op if it is already visible)

Member Data Documentation

int cs237::Window::_ht
protected

window dimensions

bool cs237::Window::_isVis
protected

true, when the window is visible

int cs237::Window::_wid
protected
GLFWwindow* cs237::Window::_win
protected

the underlying window


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