39 lines
772 B
C
39 lines
772 B
C
|
/* This widget roughly mimics a "Label" from GTK.
|
||
|
* It lets us put a writable text area at a particular part of
|
||
|
* the screen, and then write to it / change its text as we like
|
||
|
*/
|
||
|
|
||
|
#ifndef _LABEL_H_
|
||
|
#define _LABEL_H_
|
||
|
|
||
|
#include "entity.h"
|
||
|
#include <SDL_ttf.h>
|
||
|
#include <string>
|
||
|
|
||
|
using std::string;
|
||
|
|
||
|
class Label : public Entity
|
||
|
{
|
||
|
public:
|
||
|
Label(string text, int x, int y, TTF_Font* font = NULL,
|
||
|
int colour = 0x000000);
|
||
|
|
||
|
bool init() {}
|
||
|
void render(SDL_Surface* display);
|
||
|
void iterate() {}
|
||
|
|
||
|
string get_text() const { return text; }
|
||
|
|
||
|
void set_text(string new_text) { text = new_text; }
|
||
|
void set_colour(int new_colour) { colour = new_colour; }
|
||
|
|
||
|
private:
|
||
|
string text;
|
||
|
TTF_Font* font;
|
||
|
int x;
|
||
|
int y;
|
||
|
int colour;
|
||
|
};
|
||
|
|
||
|
#endif
|