K3dGui.h

Go to the documentation of this file.
00001 
00011 /***************************************************************************
00012  *   Copyright (C) 2007 by Jan Koci   *
00013  *   honza.koci@email.cz   *
00014  *   http://kengine.sourceforge.net/tutorial/
00015  *                                                                         *
00016  *   This program is free software; you can redistribute it and/or modify  *
00017  *   it under the terms of the GNU General Public License as published by  *
00018  *   the Free Software Foundation; either version 2 of the License, or     *
00019  *   (at your option) any later version.                                   *
00020  *                                                                         *
00021  *   This program is distributed in the hope that it will be useful,       *
00022  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00023  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00024  *   GNU General Public License for more details.                          *
00025  *                                                                         *
00026  *   You should have received a copy of the GNU General Public License     *
00027  *   along with this program; if not, write to the                         *
00028  *   Free Software Foundation, Inc.,                                       *
00029  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00030  ***************************************************************************/
00031 
00032 #pragma once
00033 
00034 #include <SDL/SDL.h>
00035 #include <SDL/SDL_opengl.h>
00036 #include <SDL/SDL_image.h>
00037 
00038 #include <guichan.hpp>
00039 #include <guichan/sdl.hpp>
00040 #include <guichan/opengl.hpp>
00041 // A class used to load images for OpenGL using SDL
00042 #include <guichan/opengl/openglsdlimageloader.hpp>
00043 #include <GL/gl.h>
00044 
00045 #include <iostream>
00046 using namespace std;
00047 
00048 #include "../System/K3dString.h"
00049 #include "../Script/K3dLua.h"
00050 #include "../System/GameData/K3dGameData.h"
00051 #include "K3dGuiIcon.h"
00052 #include "K3dGuiListModel.h"
00053 #include "K3dGuiSlider.h"
00054 #include "K3dGuiWindow.h"
00055 #include "K3dGuiLabel.h"
00056 #include "K3dGuiButton.h"
00057 #include "K3dGuiImageFont.h"
00058 #include "K3dGuiTextField.h"
00059 #include "K3dGuiTextBox.h"
00060 #include "K3dGuiScrollArea.h"
00061 #include "K3dGuiScrollArea.h"
00062 #include "K3dGuiListBox.h"
00063 #include "K3dGuiDropDown.h"
00064 #include "K3dGuiCheckBox.h"
00065 #include "K3dGuiRadioButton.h"
00066 #include "K3dGuiImage.h"
00067 #include "K3dGuiContainer.h"
00068 
00069 
00070 typedef std::vector<K3dGuiWindow*> TGuiWindow;
00071 typedef std::vector<K3dGuiLabel*> TGuiLabel;
00072 typedef std::vector<K3dGuiIcon*> TGuiIcon;
00073 typedef std::vector<K3dGuiButton*> TGuiButton;
00074 typedef std::vector<K3dGuiImageFont*> TGuiFont;
00075 typedef std::vector<K3dGuiTextField*> TGuiTextField;
00076 typedef std::vector<K3dGuiTextBox*> TGuiTextBox;
00077 typedef std::vector<K3dGuiScrollArea*> TGuiScrollArea;
00078 typedef std::vector<K3dGuiListBox*> TGuiListBox;
00079 typedef std::vector<K3dGuiDropDown*> TGuiDropDown;
00080 typedef std::vector<K3dGuiCheckBox*> TGuiCheckBox;
00081 typedef std::vector<K3dGuiRadioButton*> TGuiRadioButton;
00082 typedef std::vector<K3dGuiSlider*> TGuiSlider;
00083 typedef std::vector<K3dGuiImage*> TGuiImage;
00084 typedef std::vector<K3dGuiContainer*> TGuiContainer;
00085 typedef std::vector<K3dGuiListModel*> TGuiListModelArray;
00086 
00093 class K3dGui//: public gcn::Gui
00094 {
00095                 K3dGameData *m_pGameData;       
00096                 gcn::Gui *m_pGui;
00097                 TGuiListModelArray m_tGuiListModelArray;
00098                 TGuiWindow m_tGuiWindowArray;
00099                 TGuiLabel m_tGuiLabelArray;
00100                 TGuiIcon m_tGuiIconArray;
00101                 TGuiButton m_tGuiButtonArray;
00102                 TGuiFont m_tGuiFontArray;
00103                 TGuiTextField m_tGuiTextFieldArray;
00104                 TGuiTextBox m_tGuiTextBoxArray;
00105                 TGuiScrollArea m_tGuiScrollAreaArray;
00106                 TGuiListBox m_tGuiListBoxArray;
00107                 TGuiDropDown m_tGuiDropDownArray;
00108                 TGuiCheckBox m_tGuiCheckBoxArray;
00109                 TGuiRadioButton m_tGuiRadioButtonArray;
00110                 TGuiSlider m_tGuiSliderArray;
00111                 TGuiImage m_tGuiImageArray;
00112                 TGuiContainer m_tGuiContainerArray;
00113 
00114                 /*
00115                 * Guichan SDL stuff we need
00116                 */
00117                 gcn::SDLInput* m_pInput;             // Input driver
00118                 gcn::OpenGLGraphics* m_pGraphics;       // Graphics driver
00119                 gcn::OpenGLSDLImageLoader* m_pImageLoader; // For loading images
00120 
00121                 K3dLua *m_pLua;                 
00122                 K3dString m_strFc;              
00123                 K3dString m_strOut;             
00124                 bool m_bIsGuiDeleted;   
00125                 bool m_bIsLoadGui;              
00126 
00127                 void LoadGuiImages();
00128                 void LoadGuiIcons();
00129                 void LoadGuiWindows();
00130                 void LoadGuiFonts();
00131                 void LoadGuiLabels();
00132                 void LoadGuiButtons();
00133                 void LoadGuiTextFields();
00134                 void LoadGuiTextBoxes();
00135                 void LoadGuiScrollAreas();
00136                 void CreateScrollArea ( const char* _strContent );
00137                 void LoadGuiListBoxes();
00138                 void LoadGuiListModels();
00139                 void CreateListBox ( const char* _strContent );
00140                 void LoadGuiDropDown();
00141                 void CreateDropDown ( const char* _strContent );
00142                 void LoadGuiCheckBoxes();
00143                 void LoadGuiRadioButtons();
00144                 void LoadGuiSliders();
00145                 void LoadGuiContainers();
00146                 K3dGuiSlider *FindSlider ( const char* _strSliderName );
00147                 K3dGuiIcon *FindIcon ( const char* _strName );
00148                 K3dGuiLabel *FindLabel ( const char* _strName );
00149                 K3dGuiButton *FindButton ( const char* _strName );
00150                 K3dGuiTextField *FindTextField ( const char* _strName );
00151                 K3dGuiScrollArea *FindScrollArea ( const char* _strName );
00152                 K3dGuiDropDown *FindDropDown ( const char* _strName );
00153                 K3dGuiCheckBox *FindCheckBox ( const char* _strName );
00154                 K3dGuiObject *FindGuiObject ( const char* _strName );
00155                 K3dGuiListModel *FindListModel ( const char* _strName );
00156                 K3dGuiRadioButton *FindRadioButton ( const char* _strName );
00157                 K3dGuiImage *FindImage ( const char* _strName );
00158                 K3dGuiWindow *FindWindow ( const char* _strName );
00159                 void SetGuiDependencies();
00160         public:
00161 
00162                 K3dGui ( K3dGameData *_pGameData );
00163                 ~K3dGui();
00164 
00165                 void DrawGui();
00166                 void SetTargetPlane ( const int _iWidth, const int _iHeight );
00167                 void LoadGui();
00168                 void DeleteGui();
00169                 int FindContainerId ( const char* _strName );
00170                 int FindButtonId ( const char* _strName );
00171                 int FindWindowId ( const char* _strName );
00172                 int FindListModelId ( const char* _strName );
00173                 int FindListBoxId ( const char* _strName );
00174                 int FindGuiObjectId ( const char* _strName, const int _iObjType );
00175                 void HideGui ( const int _iObjId, const int _iObjType );
00176                 void ShowGui ( const int _iObjId, const int _iObjType );
00177                 void HideWindow ( const int _iObjId );
00178                 void ShowWindow ( const int _iObjId );
00179                 void HideContainer ( const int _iObjId );
00180 
00181                 gcn::SDLInput* GetInput()
00182                 {
00183                         return m_pInput;
00184                 }
00185 
00189                 K3dGuiButton* GetGuiButton ( const int _iButtonId )
00190                 {
00191                         return m_tGuiButtonArray[_iButtonId];
00192                 }
00193 
00197                 K3dGuiListModel* GetGuiListModel ( const int _iListModelId )
00198                 {
00199                         return m_tGuiListModelArray[_iListModelId];
00200                 }
00201 
00205                 K3dGuiListBox* GetGuiListBox ( const int _iListBoxId )
00206                 {
00207                         return m_tGuiListBoxArray[_iListBoxId];
00208                 }
00209 };
00210 

Generated on Thu Aug 16 23:53:26 2007 for K3dEngine by  doxygen 1.5.0