forked from badman12345/osmose-rpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextWriter.h-o
40 lines (35 loc) · 1.04 KB
/
TextWriter.h-o
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
/*****************************************************************************
*
* File: TextWriter.h
*
* Project: Osmose emulator.
*
* Description: This class is use to display textual information into
* a SDL_Surface.
*
* Author: Vedder Bruno
* Date: 26/02/2005, 14h13
*
* URL: http://bcz.emu-france.com/
*****************************************************************************/
#ifndef TEXT_WRITER_H
#define TEXT_WRITER_H
#include <iomanip>
#include <SDL/SDL.h>
#define MESSAGE_LENGTH 31
class TextWriter
{
public:
TextWriter(); // Constructor.
void addText(const char *msg, unsigned int seconds); // Add message for n seconds.
void update(SDL_Surface *s, bool); // Update SDL_Surface.
unsigned int getDuration();
private:
unsigned short fontCols[4]; // 16bits cols for font color.
char message[MESSAGE_LENGTH];
bool hasMessage;
unsigned int messageDuration;
void writeChar(SDL_Surface *s,unsigned char c, unsigned int x, unsigned int y);
unsigned char asciiToFont(unsigned char);
};
#endif