00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "MenuHelp.h"
00010
00011 #include "Path.h"
00012 #include "WiPara.h"
00013
00014 #include "Labels.h"
00015 #include "Font.h"
00016 #include "HelpInput.h"
00017 #include "OptionAgent.h"
00018 #include "SurfaceTool.h"
00019
00020
00021 MenuHelp::MenuHelp()
00022 {
00023 Font usedFont(Path::dataReadPath("font/font_menu.ttf"), 14);
00024 SDL_Color usedColor = {255, 255, 255, 255};
00025
00026 Labels labels(Path::dataReadPath("script/labels.lua"));
00027 m_help = new WiPara(labels.getLabel("help"), usedFont, usedColor);
00028
00029 takeHandler(new HelpInput(this));
00030 registerDrawable(this);
00031 registerDrawable(m_help);
00032 }
00033
00034 MenuHelp::~MenuHelp()
00035 {
00036 delete m_help;
00037 }
00038
00039
00040
00041
00042 void
00043 MenuHelp::own_initState()
00044 {
00045 own_resumeState();
00046 }
00047
00048
00049
00050
00051 void
00052 MenuHelp::own_resumeState()
00053 {
00054 int contentW = m_help->getW();
00055 int contentH = m_help->getH();
00056 OptionAgent *options = OptionAgent::agent();
00057 int screenW = options->getAsInt("screen_width");
00058 int screenH = options->getAsInt("screen_height");
00059
00060 m_help->setShift(
00061 V2((screenW - contentW) / 2, (screenH - contentH) / 2));
00062 }
00063
00064 void
00065 MenuHelp::drawOn(SDL_Surface *screen)
00066 {
00067 SDL_Color gray = {0x00, 0x00, 0x00, 128};
00068 SurfaceTool::alphaFill(screen, NULL, gray);
00069 }
00070