-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextBox.h
58 lines (46 loc) · 1.59 KB
/
TextBox.h
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
#pragma once
#include "UIScreen.h"
#include <vector>
class TextBox : public UIScreen
{
public:
TextBox(class Game* game);
~TextBox();
// Load the text from the file, and add each word into
// the mWords vector by a white space delimeter.
// Keep formating characters such as \n and \t
void LoadText(const std::string& filePath);
// Load the font from the intended file into the mFont object
void LoadFont(const std::string& filePath);
// Draw
void Draw(SDL_Renderer* renderer) override;
// Get the width(x) and height(y) of the box as a Vector2
Vector2 GetBoxDimensions();
// Getters/Setters
int GetFontSize() const { return mFontSize; }
int GetBoxHeight() const { return mBoxHeight; }
int GetBoxWidth() const { return mBoxWidth; }
Vector2 GetBoxPosistion() const { return mBoxPosition; }
void SetFontSize(int size) { mFontSize = size; }
void SetBoxHeight(int height) { mBoxHeight = height; }
void SetBoxWidth(int width) { mBoxWidth = width; }
void SetBoxPosition(Vector2 position) { mBoxPosition = position; }
void SetTextFilePath(const std::string filePath) { mTextFilePath = filePath; }
void SetFontFilePath(const std::string filePath) { mFontFilePath = filePath; }
private:
// File paths for the Text file, and the font file
std::string mTextFilePath;
std::string mFontFilePath;
std::vector<std::string> mWords;
// Texture generated from the font
SDL_Texture* mTexture;
// Font size
int mFontSize;
// Texture height and width derived from SDL_QueryTexture
int mTexHeight;
int mTexWidth;
// The dimensions of the box
int mBoxHeight;
int mBoxWidth;
Vector2 mBoxPosition;
};