Blackcomb  prealpha
Engine-ish
Window.h
1 #ifndef BLACKCOMB_WINDOW_H
2 #define BLACKCOMB_WINDOW_H
3 
4 #include <glad/glad.h>
5 #include <GLFW/glfw3.h>
6 #include "blackcomb/input/MouseWatcher.h"
7 #include "blackcomb/misc/Coords.h"
8 
9 namespace blackcomb::base {
10  constexpr unsigned int DefaultWinWidth = 800;
11  constexpr unsigned int DefaultWinHeight = 600;
12  constexpr char DefaultWinName[] = "Blackcomb Application";
13 
17  class Window {
18  public:
19  Window();
20  Window(const char* name);
21  Window(int width, int height);
22  Window(int width, int height, const char* name);
23  void setInputMode(int mode, int value);
24  void setShouldClose(bool shouldClose);
25  bool shouldClose();
26  int getKey(int key);
27  int getMouseButton(int button);
28  void makeContextCurrent();
29  GLFWwindow* getHandle();
31  void setFramebufferSizeCallback(GLFWframebuffersizefun fbSizeCallback);
32  static void defaultSizeCallback(GLFWwindow* handle, int width, int height);
33  void setWindowTitle(const std::string& title);
34  void hide();
35  void show();
36  input::MouseWatcher mouseWatcher;
37  private:
38  GLFWwindow* handle;
39  };
40 }
41 
42 #endif //BLACKCOMB_WINDOW_H
void setFramebufferSizeCallback(GLFWframebuffersizefun fbSizeCallback)
Sets the GLFW framebuffer size callback.
Definition: Window.cpp:93
misc::Point2i getDims()
Definition: Window.cpp:83
void setShouldClose(bool shouldClose)
Inform GLFW whether or not the window should be closed.
Definition: Window.cpp:44
void makeContextCurrent()
Make this window the current OpenGL context.
Definition: Window.cpp:30
Represents a 2D point with integers.
Definition: Coords.h:43
GLFWwindow * getHandle()
Definition: Window.cpp:76
void setInputMode(int mode, int value)
Change input settings for this window.
Definition: Window.cpp:37
void setWindowTitle(const std::string &title)
Sets the window title.
Definition: Window.cpp:104
Definition: AppBase.h:9
Keeps track of mouse position and informs other components about the mouse.
Definition: MouseWatcher.h:15
int getMouseButton(int button)
Get whether a mouse button is pressed or released.
Definition: Window.cpp:69
bool shouldClose()
Definition: Window.cpp:51
Object-oriented wrapper for GLFW&#39;s window functions.
Definition: Window.h:17
void show()
Show the window.
Definition: Window.cpp:118
int getKey(int key)
Get whether a key is pressed or released.
Definition: Window.cpp:60
void hide()
Hide the window from view.
Definition: Window.cpp:111