#pragma once #include #include "InputManager.h" enum MessageResponse { UNSET, NO_MESSAGE, HANDLED_MESSAGE, QUIT_MESSAGE }; // A class to create a window in windows. class Window { public: Window(const char* class_name, HINSTANCE h_instance); ~Window(); LRESULT CALLBACK wnd_proc(HWND h_wnd, UINT msg, WPARAM w_param, LPARAM l_param); // Registers m_wc with windows. bool register_class(); // Creates the window // Use -1 for x and/or y to specify centered relative to the screen. bool create_window(const char* title, int x, int y, int w, int h); // Peeks the next message for the window, translates it, and then // dispatches it. // Returns true for a regular message. False for an exit message. // When the message is an exit message, the message will not be translated // or dispatched. MessageResponse handle_message(); // Calls ShowWindow on the HWND void show(int cmd_show); // Calls UpdateWindow on the HWND void update(); // Calls CloseWindow on the HWND void close(); void set_h_glrc(HGLRC h_glrc); // Returns the HWND HWND get_h_wnd(); HGLRC get_h_glrc(); // Returns the InputManager const InputManager& get_input_manager(); private: const char* m_class_name; HINSTANCE m_h_instance = nullptr; WNDCLASSEX m_wc; HWND m_h_wnd = nullptr; HGLRC m_h_glrc = nullptr; // The OpenGL Rendering Context (Extra variable used by application) InputManager m_input_manager; };