the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2using namespace std;
3
4class StitchSlot;
5class Texture;
6#include "TextureHolder.h"
7
8class Stitcher
9{
10public:
11 static const int STITCH_SUCCESS = 0;
12 static const int STITCH_RETRY = 1;
13 static const int STITCH_ABORT = 2;
14
15 static const int MAX_MIPLEVEL = 0; // This should be 4 again later when we *ACTUALLY* mipmap
16 static const int MIN_TEXEL = 1 << MAX_MIPLEVEL;
17
18private:
19 set<TextureHolder *, TextureHolderLessThan> texturesToBeStitched; // = new HashSet<TextureHolder>(256);
20 vector<StitchSlot *> storage; // = new ArrayList<StitchSlot>(256);
21 int storageX;
22 int storageY;
23
24 int maxWidth;
25 int maxHeight;
26 bool forcePowerOfTwo;
27 int forcedScale;
28
29 Texture *stitchedTexture;
30
31 wstring name;
32
33 void _init(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale);
34
35public:
36 Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo);
37 Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo, int forcedScale);
38
39 int getWidth();
40 int getHeight();
41 void addTexture(TextureHolder *textureHolder);
42 Texture *constructTexture(bool mipmap = true); // 4J Added mipmap param
43 void stitch();
44 vector<StitchSlot *> *gatherAreas();
45
46private:
47 // Based on: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
48 int smallestEncompassingPowerOfTwo(int input);
49
50 bool addToStorage(TextureHolder *textureHolder);
51
52 /**
53 * Expand the current storage to take in account the new texture.
54 * This should only be called if it didn't fit anywhere.
55 *
56 * @param textureHolder
57 * @return Boolean indicating if it could accommodate for the growth
58 */
59 bool expand(TextureHolder *textureHolder);
60};