aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/ResourceLocation.h
blob: 1274b25ab2d457a72ac8c4aaeba8cdc4a25fd2c3 (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
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "Textures.h"

typedef arrayWithLength<_TEXTURE_NAME> textureNameArray;
class ResourceLocation
{
private:
	textureNameArray m_texture;
	wstring m_path;
	bool m_preloaded;

public:
	ResourceLocation()
	{
		m_preloaded = false;
		m_path = L"";
	}

	ResourceLocation(_TEXTURE_NAME texture)
	{
		m_texture = textureNameArray(1);
		m_texture[0] = texture;
		m_preloaded = true;
	}

	ResourceLocation(wstring path)
	{
		m_path = path;
		m_preloaded = false;
	}

	ResourceLocation(intArray textures)
	{
		m_texture = textureNameArray(textures.length);
		for(unsigned int i = 0; i < textures.length; ++i)
		{
			m_texture[i] = static_cast<_TEXTURE_NAME>(textures[i]);
		}
		m_preloaded = true;
	}

	~ResourceLocation()
	{
		delete m_texture.data;
	}

	_TEXTURE_NAME getTexture()
	{
		return m_texture[0];
	}

	_TEXTURE_NAME getTexture(int idx)
	{
		return m_texture[idx];
	}

	int getTextureCount()
	{
		return m_texture.length;
	}

	wstring getPath()
	{
		return m_path;
	}

	bool isPreloaded()
	{
		return m_preloaded;
	}
};