Browse Source

new resize() plus one that's takes an availableWidth for scroll masking, rasterStart/noWrap/availableWidth, move texture data into properties, moved indices out

pull/2/head
Odilitime 5 years ago
parent
commit
505b16a710
  1. 20
      src/graphics/components/TextComponent.h

20
src/graphics/components/TextComponent.h

@ -14,10 +14,6 @@ private: @@ -14,10 +14,6 @@ private:
unsigned int fontSize;
bool bold;
unsigned int color;
const unsigned int indices[6] = {
0, 1, 2,
0, 2, 3
};
std::unique_ptr<Glyph[]> glyphs;
std::vector<std::unique_ptr<float[]>> glyphVertices;
std::vector<GLuint> vertexArrayObjects;
@ -29,11 +25,21 @@ public: @@ -29,11 +25,21 @@ public:
std::string text;
TextComponent(const std::string &rawText, const int rawX, const int rawY, const unsigned int size, const bool bolded, const unsigned int hexColor, const int passedWindowWidth, const int passedWindowHeight);
~TextComponent();
void rasterize(const int rawX, const int rawY, const int passedWindowWidth, const int passedWindowHeight);
void rasterize(const int rawX, const int rawY);
void render();
void resize();
void pointToViewport(float &rawX, float &rawY, const int passedWindowWidth, const int passedWindowHeight) const;
void resize(const int passedWindowWidth, const int passedWindowHeight); // compatible adapter
void resize(const int passedWindowWidth, const int passedWindowHeight, const int passedAvailableWidth); // more detailed control
void sanitize(std::string &str);
// input needed stuff
int rasterStartX = 0; // start reading text source at and place at destination 0
int rasterStartY = 0;
bool noWrap = false; // different than overflow but related
int availableWidth = 0;
int textureWidth;
int textureHeight;
std::unique_ptr<unsigned char[]> textureData;
// backgroundColor
rgba backgroundColor;

Loading…
Cancel
Save