our_dick/include/gfx/window.hpp

105 lines
2.5 KiB
C++

/**
This file is a part of our_dick
Copyright (C) 2022 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUR_DICK_GRAPHICS_WINDOW_HPP
#define OUR_DICK_GRAPHICS_WINDOW_HPP
#include "glfw_init.hpp"
#include <GLFW/glfw3.h>
#include <rml/vec.hpp>
namespace gfx{
class window
{
public:
enum class mousemode : int{
DISABLED,
HIDDEN,
NORMAL,
};
protected:
GLFWwindow* m_window = nullptr;
glfw_system m_glfw_handle;
protected:
window(void);
window(const window&) = delete; //Implement in derived classes
window(window&&);
~window(void);
window& operator=(const window&) = delete; //Implement in derived classes
window& operator=(window&&);
public:
GLFWwindow* raw(void);
const GLFWwindow* raw(void)const;
operator GLFWwindow*(void);
operator const GLFWwindow*(void)const;
void destroy(void);
void set_size(const rml::vec2i&);
void set_size(int w, int h);
void set_width(int w);
void set_height(int h);
void set_title(const char* t);
void set_pos(const rml::vec2i&);
void set_pos(int x, int y);
void set_x(int x);
void set_y(int y);
void set_visible(bool b = true);
void toggle_visible(void);
void set_resizable(bool b = true);
void set_decorated(bool b = true);
void set_always_on_top(bool b = true);
void set_antialias(int level);
void set_should_close(bool b = true);
void set_mousemode(mousemode m);
void set_key_callback(void);
//TODO callbacks
rml::vec2i get_size(void)const;
int get_width(void)const;
int get_height(void)const;
rml::vec2i get_pos(void)const;
int get_posx(void)const;
int get_posy(void)const;
rml::vec2d get_cursor_pos(void)const;
double get_cursor_posx(void)const;
double get_cursor_posy(void)const;
bool get_key(int key, int action)const;
bool is_visible(void)const;
bool is_resizable(void)const;
bool is_decorated(void)const;
bool is_always_on_top(void)const;
bool is_fullscreen(void)const;
bool should_close(void)const;
};
}
#endif