

Definition at line 13 of file StepDecor.h.
Public Member Functions | |
| StepDecor (const StepCounter *counter) | |
| virtual void | drawOnScreen (const View *view, SDL_Surface *screen) |
| Draw number of steps in right-top corner. | |
|
|
Definition at line 18 of file StepDecor.cpp. 00019 : m_font(Path::dataReadPath("font/font_console.ttf"), 20) 00020 { 00021 m_counter = counter; 00022 }
|
|
||||||||||||
|
Draw number of steps in right-top corner.
Implements Decor. Definition at line 28 of file StepDecor.cpp. 00029 {
00030 static const SDL_Color COLOR_ORANGE = {255, 197, 102, 255};
00031 static const SDL_Color COLOR_BLUE = {162, 244, 255, 255};
00032
00033 if (OptionAgent::agent()->getAsBool("show_steps")) {
00034 SDL_Color color;
00035 if (m_counter->isPowerful()) {
00036 color = COLOR_BLUE;
00037 }
00038 else {
00039 color = COLOR_ORANGE;
00040 }
00041
00042 std::string steps = StringTool::toString(m_counter->getStepCount());
00043 SDL_Surface *text_surface = m_font.renderTextOutlined(steps, color);
00044
00045 SDL_Rect rect;
00046 rect.x = screen->w - text_surface->w;
00047 rect.y = 10;
00048 SDL_BlitSurface(text_surface, NULL, screen, &rect);
00049 SDL_FreeSurface(text_surface);
00050 }
00051 }
|
1.4.2