aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/je_texture.cpp
blob: 53d9bd3814e5369c37f96b05fee14b09ed187836 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "../core/je_configuration.h"
#if defined(jin_graphics)

#include <fstream>

#include "../utils/je_utils.h"
#include "../math/je_math.h"

#include "je_texture.h"

using namespace JinEngine::Math;

namespace JinEngine
{
    namespace Graphics
    {
/*
        Texture* Texture::createTexture(const char* path)
        {
            Bitmap* bitmap = Bitmap::createBitmap(path);
            Texture* texture = createTexture(bitmap);
            delete bitmap;
            return texture;
        }

        Texture* Texture::createTexture(Bitmap* bitmap)
        {
            Texture* tex = new Texture(bitmap);
            return tex;
        }
*/
        Texture::Texture()
            : Graphic()
        {
            ++gl.getStats().textures;
        }

        Texture::Texture(const char* path)
        {
            Bitmap* bitmap = new Bitmap(path);
            new (this) Texture(bitmap);
            delete bitmap;
        }

        Texture::Texture(const Bitmap* bitmap)
            : Graphic(bitmap)
        {
            ++gl.getStats().textures;
        }

        Texture::~Texture()
        {
            --gl.getStats().textures;
        }

    } // namespace Graphics
} // namespace JinEngine

#endif // defined(jin_graphics)