From a2ac8b537a61fb7a7be1a3e08635ffc88e17d966 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 18 Nov 2021 06:48:50 +0100 Subject: Disable copy constructors for opengl resource items --- include/mglpp/graphics/Font.hpp | 2 ++ include/mglpp/graphics/Image.hpp | 2 ++ include/mglpp/graphics/Shader.hpp | 2 ++ include/mglpp/graphics/Texture.hpp | 5 +++++ include/mglpp/system/MemoryMappedFile.hpp | 2 ++ include/mglpp/window/Window.hpp | 2 ++ 6 files changed, 15 insertions(+) (limited to 'include') diff --git a/include/mglpp/graphics/Font.hpp b/include/mglpp/graphics/Font.hpp index ca6a146..afba8d3 100644 --- a/include/mglpp/graphics/Font.hpp +++ b/include/mglpp/graphics/Font.hpp @@ -22,6 +22,8 @@ namespace mgl { class Font { public: Font(); + Font(const Font&) = delete; + Font& operator=(const Font&) = delete; ~Font(); bool load_from_file(const MemoryMappedFile &mapped_file, unsigned int character_size); diff --git a/include/mglpp/graphics/Image.hpp b/include/mglpp/graphics/Image.hpp index a868ad6..4a55ba5 100644 --- a/include/mglpp/graphics/Image.hpp +++ b/include/mglpp/graphics/Image.hpp @@ -11,6 +11,8 @@ namespace mgl { class Image { public: Image(); + Image(const Image&) = delete; + Image& operator=(const Image&) = delete; ~Image(); bool load_from_file(const char *filepath); diff --git a/include/mglpp/graphics/Shader.hpp b/include/mglpp/graphics/Shader.hpp index 0aedc47..2d1336d 100644 --- a/include/mglpp/graphics/Shader.hpp +++ b/include/mglpp/graphics/Shader.hpp @@ -17,6 +17,8 @@ namespace mgl { }; Shader(); + Shader(const Shader&) = delete; + Shader& operator=(const Shader&) = delete; ~Shader(); bool load_from_file(const char *filepath, Type type); diff --git a/include/mglpp/graphics/Texture.hpp b/include/mglpp/graphics/Texture.hpp index 633d2cd..5ef94a0 100644 --- a/include/mglpp/graphics/Texture.hpp +++ b/include/mglpp/graphics/Texture.hpp @@ -17,16 +17,21 @@ namespace mgl { }; Texture(); + Texture(Texture &&other); ~Texture(); static Texture reference(mgl_texture ref); bool load_from_file(const char *filepath, const LoadOptions load_options = {false, false}); bool load_from_image(Image &image, const LoadOptions load_options = {false, false}); + void clear(); vec2i get_size() const; bool is_valid() const; mgl_texture* internal_texture(); + private: + Texture(const Texture&); + Texture& operator=(const Texture&); private: mgl_texture texture; bool owned = true; diff --git a/include/mglpp/system/MemoryMappedFile.hpp b/include/mglpp/system/MemoryMappedFile.hpp index 508518a..1be23d4 100644 --- a/include/mglpp/system/MemoryMappedFile.hpp +++ b/include/mglpp/system/MemoryMappedFile.hpp @@ -14,6 +14,8 @@ namespace mgl { }; MemoryMappedFile(); + MemoryMappedFile(const MemoryMappedFile&) = delete; + MemoryMappedFile& operator=(const MemoryMappedFile&) = delete; ~MemoryMappedFile(); bool load(const char *filepath, LoadOptions load_options = { true, true }); diff --git a/include/mglpp/window/Window.hpp b/include/mglpp/window/Window.hpp index 1ce399c..1b7c292 100644 --- a/include/mglpp/window/Window.hpp +++ b/include/mglpp/window/Window.hpp @@ -38,6 +38,8 @@ namespace mgl { }; Window(); + Window(const Window&) = delete; + Window& operator=(const Window&) = delete; ~Window(); bool create(const char *title, CreateParams create_params); -- cgit v1.2.3