Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

MenuHelp.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
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  * Display help centerd on screen.
00041  */
00042     void
00043 MenuHelp::own_initState()
00044 {
00045     own_resumeState();
00046 }
00047 //-----------------------------------------------------------------
00048 /**
00049  * Help will be centred on screen.
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 

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2