-
Notifications
You must be signed in to change notification settings - Fork 6
/
Letter.h
69 lines (43 loc) · 1.01 KB
/
Letter.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
58
59
60
61
62
63
64
65
66
67
68
69
//
// Letter.h
// Design Patterns
//
// Created by Nathan Daly on 4/24/12.
// Copyright 2012 Lions Entertainment. All rights reserved.
//
#ifndef GUI_LETTER_H
#define GUI_LETTER_H
#include "Ptr_config.h"
#include <string>
#include <map>
struct SDL_Surface; // display image
namespace GUI {
class Letter {
public:
void drawself(SDL_Surface *dest, int x, int y) const;
int get_height() const;
int get_width() const;
static Letter* get_letter(char letter_);
class Print_Letter {
public:
Print_Letter(SDL_Surface *dest, int x_, int y_);
void operator() (const Letter* letter);
private:
int x, y, width;
SDL_Surface* surface;
};
SDL_Surface *image;
private:
Letter() : image (0) {}
~Letter() {}
Letter(char letter) {
std::string filename;
filename += letter;
set_image (filename);
}
void set_image(const std::string& filename);
static std::string special_chars(char letter_);
typedef std::map<char, Letter*> letter_map_t;
};
} // namespace GUI
#endif /* FLYWEIGHT_H */