aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/Texture.cpp
blob: 0e6123cab12a3c6dac02ab47d4f2ff8b6b5cd585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "../../include/mglpp/graphics/Texture.hpp"

namespace mgl {
    Texture::Texture() {
        texture.id = 0;
    }

    Texture::~Texture() {
        mgl_texture_unload(&texture);
    }

    bool Texture::load_from_file(const char *filepath) {
        if(texture.id)
            return false;
        /* TODO: use the last arg (load options) */
        return mgl_texture_load_from_file(&texture, filepath, nullptr) == 0;
    }

    vec2i Texture::size() const {
        return { texture.width, texture.height };
    }

    mgl_texture* Texture::internal_texture() {
        return &texture;
    }
}