diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mglpp/graphics/Texture.hpp | 11 | ||||
-rw-r--r-- | include/mglpp/mglpp.hpp | 10 | ||||
-rw-r--r-- | include/mglpp/window/Window.hpp | 3 |
3 files changed, 16 insertions, 8 deletions
diff --git a/include/mglpp/graphics/Texture.hpp b/include/mglpp/graphics/Texture.hpp index 1ea040e..6ab1fb4 100644 --- a/include/mglpp/graphics/Texture.hpp +++ b/include/mglpp/graphics/Texture.hpp @@ -14,24 +14,25 @@ namespace mgl { struct LoadOptions { bool compressed = false; bool pixel_coordinates = false; - bool mipmap = false; /* available since opengl 3.0 */ + mgl_texture_scale_type scale_type = MGL_TEXTURE_SCALE_LINEAR; }; struct ReferenceOptions { bool pixel_coordinates = false; + mgl_texture_scale_type scale_type = MGL_TEXTURE_SCALE_LINEAR; }; Texture(); - Texture(unsigned int gl_texture_id, mgl_texture_format format, const ReferenceOptions reference_options = {false}); + Texture(unsigned int gl_texture_id, mgl_texture_format format, const ReferenceOptions reference_options = {false, MGL_TEXTURE_SCALE_LINEAR}); Texture(Texture &&other); Texture& operator=(Texture &&other); ~Texture(); static Texture reference(mgl_texture ref); - bool load_from_file(const char *filepath, const LoadOptions load_options = {false, false, false}); - bool load_from_image(Image &image, const LoadOptions load_options = {false, false, false}); - bool load_from_memory(const unsigned char *data, int width, int height, mgl_image_format format, LoadOptions load_options = {false, false, false}); + bool load_from_file(const char *filepath, const LoadOptions load_options = {false, false, MGL_TEXTURE_SCALE_LINEAR}); + bool load_from_image(Image &image, const LoadOptions load_options = {false, false, MGL_TEXTURE_SCALE_LINEAR}); + bool load_from_memory(const unsigned char *data, int width, int height, mgl_image_format format, LoadOptions load_options = {false, false, MGL_TEXTURE_SCALE_LINEAR}); void clear(); vec2i get_size() const; bool is_valid() const; diff --git a/include/mglpp/mglpp.hpp b/include/mglpp/mglpp.hpp index 2e49da5..58f956d 100644 --- a/include/mglpp/mglpp.hpp +++ b/include/mglpp/mglpp.hpp @@ -1,9 +1,15 @@ #ifndef MGLPP_MGLPP_HPP #define MGLPP_MGLPP_HPP -#include <stdexcept> +#include <exception> namespace mgl { + enum class WindowSystem { + NATIVE, // Use X11 on X11 and Wayland on Wayland + X11, // Use X11 on X11 and XWayland on Wayland + WAYLAND, // Use Wayland. If user runs on X11 then it fails to connect + }; + class InitException : public std::exception { public: const char* what() const noexcept override { @@ -14,7 +20,7 @@ namespace mgl { class Init { public: // Throws InitException on failure - Init(); + Init(WindowSystem window_system = WindowSystem::NATIVE); ~Init(); bool is_connected_to_display_server(); diff --git a/include/mglpp/window/Window.hpp b/include/mglpp/window/Window.hpp index 6bd77f8..8458d71 100644 --- a/include/mglpp/window/Window.hpp +++ b/include/mglpp/window/Window.hpp @@ -55,7 +55,7 @@ namespace mgl { const char *class_name = nullptr; mgl_window_type window_type = MGL_WINDOW_TYPE_NORMAL; WindowHandle transient_for_window = 0; /* 0 = none */ - mgl_render_api render_api = MGL_RENDER_API_GLX; + mgl_graphics_api graphics_api = MGL_GRAPHICS_API_EGL; }; Window(); @@ -123,6 +123,7 @@ namespace mgl { mgl_window* internal_window(); private: mgl_window window; + bool window_created = false; }; } |