CMSC23700 Common Code Library
Support code for CS23700 programming projects
cs237-window.hxx
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 2015 John Reppy (http://cs.uchicago.edu/~jhr)
10  * All rights reserved.
11  */
12 
13 #ifndef _CS237_WINDOW_HXX_
14 #define _CS237_WINDOW_HXX_
15 
16 #ifndef _CS237_HXX_
17 #error "c237-vec2.hxx should not be included directly"
18 #endif
19 
20 namespace cs237 {
21 
23  class Window {
24  public:
25 
27  virtual ~Window ();
28 
31  void Refresh ();
32 
34  void Hide ()
35  {
36  glfwHideWindow (this->_win);
37  this->_isVis = false;
38  }
39 
41  void Show ()
42  {
43  glfwShowWindow (this->_win);
44  this->_isVis = true;
45  }
46 
49  virtual void Draw () = 0;
50 
53  virtual void SetProjectionMatrix () = 0;
54 
57  void Reshape (int wid, int ht);
58 
60  void Iconify (bool iconified);
61 
62  protected:
71  Window (std::string title, int wid, int ht, bool resizable, GLFWwindow *share = nullptr);
72 
73  GLFWwindow *_win;
74  int _wid, _ht;
75  bool _isVis;
76  };
77 
78 } // namespace cs237
79 
80 #endif // !_CS237_WINDOW_HXX_
void Iconify(bool iconified)
method invoked on Iconify events.
virtual ~Window()
destructor: it destroys the underlying GLFW window
virtual void Draw()=0
Window(std::string title, int wid, int ht, bool resizable, GLFWwindow *share=nullptr)
void Show()
Show the window (a no-op if it is already visible)
Definition: cs237-window.hxx:41
abstract base class for simple GLFW windows used to view buffers, etc.
Definition: cs237-window.hxx:23
bool _isVis
true, when the window is visible
Definition: cs237-window.hxx:75
Definition: cs237-aabb.hxx:18
void Hide()
Hide the window.
Definition: cs237-window.hxx:34
int _wid
Definition: cs237-window.hxx:74
void Reshape(int wid, int ht)
virtual void SetProjectionMatrix()=0
GLFWwindow * _win
the underlying window
Definition: cs237-window.hxx:73
int _ht
window dimensions
Definition: cs237-window.hxx:74