the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2
3#include <stdint.h>
4
5class Icon_SPU
6{
7
8 int16_t x0;
9 int16_t y0;
10 int16_t x1;
11 int16_t y1;
12
13public:
14
15// static const int TYPE_TERRAIN = 0;
16// static const int TYPE_ITEM = 1;
17//
18 static const float UVAdjust = (1.0f/16.0f)/256.0f;
19
20// int getX() const { return x; }
21// int getY() const { return y; }
22// int getWidth() const { return (w<0) ? -w : w; } // can be negative, to support flipped icons (only doors for now).
23// int getHeight() const { return h; }
24
25 void set(int16_t _x, int16_t _y, int16_t _w, int16_t _h, int texWidth, int texHeight)
26 {
27 x0 = (int16_t)(4096 * (float(_x) / texWidth));
28 y0 = (int16_t)(4096 * (float(_y) / texHeight));
29 x1 = x0 + (int16_t)(4096 * (float(_w) / texWidth));
30 y1 = y0 + (int16_t)(4096 * (float(_h) / texHeight));
31 }
32
33 void flipHorizontal() { int16_t temp = x0; x0 = x1; x1 = temp; }
34 void flipVertical() { int16_t temp = y0; y0 = y1; y1 = temp; }
35
36 float getU0() const { return (float(x0) / 4096) + UVAdjust; }//sc_texWidth) + getUAdjust(); }
37 float getU1() const { return (float(x1) / 4096.0f) - UVAdjust; } //sc_texWidth) - getUAdjust(); }
38 float getU(double offset) const
39 {
40 float diff = getU1() - getU0();
41 return getU0() + (diff * ((float) offset / 16));//SharedConstants::WORLD_RESOLUTION));
42 }
43
44 float getV0() const { return (float(y0) / 4096.0f) + UVAdjust; } //sc_texHeight) + getVAdjust(); }
45 float getV1() const { return (float(y1) / 4096.0f) - UVAdjust; } //sc_texHeight) - getVAdjust(); }
46 float getV(double offset) const
47 {
48 float diff = getV1() - getV0();
49 return getV0() + (diff * ((float) offset / 16)); //SharedConstants::WORLD_RESOLUTION));
50 }
51
52// virtual wstring getName() const = 0;
53// virtual int getSourceWidth() const = 0;
54// virtual int getSourceHeight() const = 0;
55};
56