aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-30 17:30:43 +0200
committerdec05eba <dec05eba@protonmail.com>2022-03-30 17:30:43 +0200
commit14e64e64c7da7535e62c275980669d9cf56b7a6d (patch)
tree67a2491600d07e2896b47710c2a175b77ae9af50 /src
parent2c879c34c9aeddae528d2818f7baa6a915d5d77a (diff)
Add move assignment to texture, fix move constructor not setting owner field
Diffstat (limited to 'src')
-rw-r--r--src/graphics/Texture.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/graphics/Texture.cpp b/src/graphics/Texture.cpp
index 794c563..86c4ac0 100644
--- a/src/graphics/Texture.cpp
+++ b/src/graphics/Texture.cpp
@@ -9,7 +9,22 @@ namespace mgl {
Texture::Texture(Texture &&other) {
memcpy(&texture, &other.texture, sizeof(mgl_texture));
+ owned = other.owned;
+
+ other.texture.id = 0;
+ other.owned = false;
+ }
+
+ Texture& Texture::operator=(Texture &&other) {
+ if(owned)
+ mgl_texture_unload(&texture);
+
+ memcpy(&texture, &other.texture, sizeof(mgl_texture));
+ owned = other.owned;
+
other.texture.id = 0;
+ other.owned = false;
+ return *this;
}
Texture::~Texture() {