-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLabelManager.h
More file actions
35 lines (29 loc) · 929 Bytes
/
LabelManager.h
File metadata and controls
35 lines (29 loc) · 929 Bytes
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
#pragma once
#include "SDL.h"
#include "SDL_ttf.h"
#include <iostream>
#include <map>
#include <string>
struct Label {
std::string name;
std::string text;
TTF_Font* font;
SDL_Color color;
int x, y;
SDL_Texture* texture; // Texture pré-rendue du texte
bool visible;
};
class LabelManager {
public:
LabelManager();
~LabelManager();
void createLabel(const std::string& name, const std::string& text, TTF_Font* font, const SDL_Color& color, int x, int y);
void updateLabelText(const std::string& name, const std::string& newText);
void updateLabel(const std::string& name, const std::string& text, TTF_Font* font, const SDL_Color& color);
void renderLabels(SDL_Renderer *renderer);
void setPosition(const std::string name, int x, int y);
void show(const std::string& name);
void hide(const std::string& name);
private:
std::map<std::string,Label> labels;
};