- Timestamp:
- Jun 16, 2006, 10:23:05 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 14 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defs/class_id.h
r8490 r8518 363 363 CL_GLGUI_IMAGE = 0x00000b70, 364 364 365 CL_GLGUI_NOTIFIER = 0x00000b80, 366 365 367 // QT_GUI 366 368 CL_GUI_SAVEABLE = 0x00b10000, -
trunk/src/lib/graphics/graphics_engine.cc
r8490 r8518 405 405 this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel); 406 406 } 407 408 void GraphicsEngine::toggleFullscreen() 409 { 410 if (this->fullscreenFlag == SDL_FULLSCREEN) 411 this->fullscreenFlag = 0; 412 else 413 this->fullscreenFlag = SDL_FULLSCREEN; 414 this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel); 415 } 416 407 417 408 418 /** -
trunk/src/lib/graphics/graphics_engine.h
r8490 r8518 44 44 int setResolution(int width, int height, int bpp); 45 45 void setFullscreen(bool fullscreen = false); 46 void toggleFullscreen(); 46 47 static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0); 47 48 -
trunk/src/lib/graphics/text_engine/text.cc
r8448 r8518 159 159 } 160 160 161 162 /** 163 * @brief clears the Text Line (empies it). 164 */ 165 void Text::clear() 166 { 167 text.clear(); 168 this->setupTextWidth(); 169 } 161 170 162 171 /** -
trunk/src/lib/graphics/text_engine/text.h
r8448 r8518 40 40 const std::string& operator<<(const std::string& appendText); 41 41 void removeCharacters(unsigned int chars); 42 void clear(); 42 43 43 44 /// SETUP -
trunk/src/lib/gui/gl/Makefile.am
r8145 r8518 29 29 glgui_image.cc \ 30 30 glgui_window.cc \ 31 glgui_cursor.cc 31 glgui_cursor.cc \ 32 \ 33 specials/glgui_notifier.cc 32 34 33 35 … … 54 56 glgui_image.h \ 55 57 glgui_window.h \ 56 glgui_cursor.h 58 glgui_cursor.h \ 59 \ 60 specials/glgui_notifier.h 61 57 62 58 63 -
trunk/src/lib/gui/gl/glgui_inputline.cc
r8448 r8518 48 48 this->setFocusable(true); 49 49 50 this->_clearOnEnter = false; 50 51 this->_text.setParent2D(this); 51 52 this->_text.setRelCoor2D(4,4); … … 100 101 } 101 102 103 void GLGuiInputLine::clear() 104 { 105 this->_text.clear(); 106 this->changedText(); 107 } 108 102 109 /** 103 110 * @brief If the Text has been changed this function is called. … … 124 131 } 125 132 133 /** 134 * @brief handles the EnterPush-Event. 135 * 136 * Emmits th EnterPushed Signal with the current Line, 137 * and if _clearOnEnter is pushed clears the Line. 138 */ 139 void GLGuiInputLine::pushEnter() 140 { 141 emit(this->enterPushed(this->_text.getText())); 142 if (this->_clearOnEnter) 143 this->clear(); 144 } 145 126 146 127 147 /** … … 140 160 this->pressedKeyName = SDLK_BACKSPACE; 141 161 this->removeCharacters(1); 162 return true; 163 } 164 else if(event.type == SDLK_RETURN || event.type == SDLK_KP_ENTER) 165 { 166 this->pushEnter(); 142 167 return true; 143 168 } -
trunk/src/lib/gui/gl/glgui_inputline.h
r8448 r8518 38 38 void appendCharacter(char character); 39 39 void removeCharacters(unsigned int chars); 40 void clear(); 41 42 void clearOnEnter(bool clear = true) { this->_clearOnEnter = clear; }; 40 43 41 44 virtual void removedFocus(); … … 47 50 48 51 DeclareSignal1(textChanged, const std::string&); 52 DeclareSignal1(enterPushed, const std::string&); 49 53 50 54 protected: … … 57 61 private: 58 62 void init(); 63 void pushEnter(); 59 64 void changedText(); 65 60 66 61 67 private: 62 68 Text _text; //!< The Text to display inside of the InputLine. 69 bool _clearOnEnter; //!< Clear on Enter 63 70 64 71 Uint16 pressedKey; //!< the pressed key that will be repeated. -
trunk/src/lib/gui/gl/glgui_style.cc
r8450 r8518 29 29 GLGuiStyle::GLGuiStyle (const TiXmlElement* root) 30 30 { 31 _font = NULL; 32 this->reset(); 33 34 31 35 if (root != NULL) 32 36 this->loadParams(root); … … 43 47 } 44 48 49 void GLGuiStyle::reset() 50 { 51 this->setBorderLeft(1.0); 52 this->setBorderRight(1.0); 53 this->setBorderTop(1.0); 54 this->setBorderBottom(1.0); 55 56 this->setTextSize(20.0); 57 this->setBackgroundColor(1.0); 58 this->setForegroundColor(1.0); 59 60 this->setFeaturePosition(FeatureLeft); 61 this->setFont(NULL); 62 63 this->setAnimated(true); 64 this->setAnimatedStateChanges(true); 65 } 66 45 67 void GLGuiStyle::loadParams(const TiXmlElement* root) 46 { 47 } 68 {} 48 69 49 70 void GLGuiStyle::setBorderLeft(float value) … … 54 75 55 76 void GLGuiStyle::setBorderLeft(float value, OrxGui::State state) 56 {} 77 { 78 _style[state]._borderLeft = value; 79 } 57 80 58 81 void GLGuiStyle::setBorderLeftS(float value, const std::string& state) 59 {} 82 { 83 } 60 84 61 85 … … 67 91 68 92 void GLGuiStyle::setBorderRight(float value, OrxGui::State state) 69 {} 93 { 94 _style[state]._borderRight = value; 95 } 70 96 71 97 void GLGuiStyle::setBorderRightS(float value, const std::string& state) … … 80 106 81 107 void GLGuiStyle::setBorderTop(float value, OrxGui::State state) 82 {} 108 { 109 _style[state]._borderTop = value; 110 } 83 111 84 112 void GLGuiStyle::setBorderTopS(float value, const std::string& state) … … 93 121 94 122 void GLGuiStyle::setBorderBottom(float value, OrxGui::State state) 95 {} 123 { 124 _style[state]._borderBottom = value; 125 } 96 126 97 127 void GLGuiStyle::setBorderBottomS(float value, const std::string& state) … … 106 136 107 137 void GLGuiStyle::setTextSize(float value, OrxGui::State state) 108 {} 138 { 139 _style[state]._textSize = value; 140 } 109 141 110 142 void GLGuiStyle::setTextSizeS(float value, const std::string& state) … … 119 151 120 152 void GLGuiStyle::setBackgroundColor(const Color& color, OrxGui::State state) 121 {} 153 { 154 _style[state]._backgroundColor = color; 155 } 122 156 123 157 void GLGuiStyle::setBackgroundColorS(float r, float g, float b, float a, const std::string& state) … … 132 166 133 167 void GLGuiStyle::setBackgroundTexture(const Texture& texture, OrxGui::State state) 134 {} 168 { 169 _style[state]._backgroundTexture = texture; 170 } 135 171 136 172 void GLGuiStyle::setBackgroundTexture(const std::string& textureName, const std::string& state) … … 145 181 146 182 void GLGuiStyle::setForegroundColor(const Color& color, OrxGui::State state) 147 {} 183 { 184 _style[state]._foregroundColor = color; 185 } 148 186 149 187 void GLGuiStyle::setForegroundColorS(float r, float g, float b, float a, const std::string& state) … … 158 196 159 197 void GLGuiStyle::setFeaturePosition(const std::string& featurePosition) 160 { 161 162 } 198 {} 163 199 164 200 … … 179 215 } 180 216 181 void GLGuiStyle:: animatedStateChanges(bool animated)217 void GLGuiStyle::setAnimatedStateChanges(bool animated) 182 218 { 183 219 this->_animatedStateChanges = animated; -
trunk/src/lib/gui/gl/glgui_style.h
r8448 r8518 43 43 44 44 /// SETUP 45 void reset(); 45 46 void loadParams(const TiXmlElement* root); 46 47 … … 85 86 86 87 void setAnimated(bool animated); 87 void animatedStateChanges(bool animated);88 void setAnimatedStateChanges(bool animated); 88 89 89 90 private: -
trunk/src/lib/gui/gl/glgui_widget.h
r8448 r8518 66 66 void disconnect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver); 67 67 68 69 GLGuiStyle& style() { return this->_style; }; 70 const GLGuiStyle style() const { return this->_style; }; 68 71 69 72 /// MATERIAL (looks) -
trunk/src/story_entities/simple_game_menu.cc
r8376 r8518 42 42 43 43 #include "glgui.h" 44 #include "gui/gl/specials/glgui_notifier.h" 44 45 45 46 //! This creates a Factory to fabricate a SimpleGameMenu … … 88 89 { 89 90 91 OrxGui::GLGuiNotifier* notifier = new OrxGui::GLGuiNotifier(); 92 notifier->show(); 93 notifier->setAbsCoor2D(300, 300); 94 95 96 90 97 OrxGui::GLGuiBox* box = new OrxGui::GLGuiBox(); 91 98 { … … 100 107 box->pack(rdnpb); 101 108 109 OrxGui::GLGuiCheckButton* fullscreen = new OrxGui::GLGuiCheckButton("Fullscreen"); 110 fullscreen->connect(SIGNAL(fullscreen, toggled), GraphicsEngine::getInstance(), SLOT(GraphicsEngine, setFullscreen)); 111 112 box->pack(fullscreen); 113 102 114 OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine(); 103 115 input->setText("input some text here"); 104 input->connect(SIGNAL(input, textChanged), this, SLOT(SimpleGameMenu, TEST)); 116 input->connect(SIGNAL(input, textChanged), notifier, SLOT(OrxGui::GLGuiNotifier, pushNotifyMessage)); 117 105 118 box->pack(input); 106 119 -
trunk/src/util/hud.cc
r8448 r8518 23 23 #include "glgui_widget.h" 24 24 25 #include "glgui_inputline.h" 26 #include "specials/glgui_notifier.h" 27 25 28 /** 26 29 * standard constructor … … 39 42 this->resY = 1; 40 43 44 this->inputLine = new OrxGui::GLGuiInputLine(); 45 this->inputLine->setParent2D(this); 46 this->notifier = new OrxGui::GLGuiNotifier(); 47 this->notifier->setParent2D(this); 48 notifier->setAbsCoor2D(100,100); 49 50 51 41 52 } 42 53 … … 47 58 Hud::~Hud () 48 59 { 60 delete this->inputLine; 61 delete this->notifier; 49 62 // delete what has to be deleted here 50 63 } … … 56 69 } 57 70 71 void Hud::notifyUser(const std::string& message) 72 { 73 this->notifier->pushNotifyMessage(message); 74 } 75 58 76 void Hud::setBackGround() 59 { 60 } 77 {} 61 78 62 79 void Hud::setEnergyWidget(OrxGui::GLGuiWidget* widget) … … 74 91 this->energyWidget->backMaterial().setDiffuseMap("hud_energy_background.png"); 75 92 this->energyWidget->backMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 76 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");77 this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/93 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 94 this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ 78 95 } 79 96 … … 82 99 83 100 void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget) 84 { 85 } 101 {} 86 102 87 103 void Hud::setArmorWidget(OrxGui::GLGuiWidget* widget) 88 { 89 } 104 {} 90 105 91 106 void Hud::setWeaponManager(WeaponManager* weaponMan) … … 123 138 if (this->weaponManager != NULL) 124 139 for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++) 125 {126 Weapon* weapon = this->weaponManager->getWeapon(i);127 if (weapon != NULL)128 140 { 129 weapon->getEnergyWidget()->show(); 130 weapon->getEnergyWidget()->backMaterial().setDiffuse( .8,.2,.11); 131 weapon->getEnergyWidget()->backMaterial().setTransparency(.1); 132 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); 133 // weapon->getEnergyWidget()->frontMaterial().setTransparency(.6); 134 this->weaponsWidgets.push_back(weapon->getEnergyWidget()); 141 Weapon* weapon = this->weaponManager->getWeapon(i); 142 if (weapon != NULL) 143 { 144 weapon->getEnergyWidget()->show(); 145 weapon->getEnergyWidget()->backMaterial().setDiffuse( .8,.2,.11); 146 weapon->getEnergyWidget()->backMaterial().setTransparency(.1); 147 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); 148 // weapon->getEnergyWidget()->frontMaterial().setTransparency(.6); 149 this->weaponsWidgets.push_back(weapon->getEnergyWidget()); 150 } 135 151 } 136 }137 152 this->updateResolution(); 138 153 } 139 154 140 155 void Hud::addWeaponWidget(OrxGui::GLGuiWidget* widget) 141 { 142 } 156 {} 143 157 144 158 void Hud::removeWeaponWidget(OrxGui::GLGuiWidget* widget) 145 { 146 } 159 {} 147 160 148 161 void Hud::updateResolution() … … 162 175 for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos+=.03) 163 176 { 164 165 177 (*weaponWidget)->setSize2D(.02*this->resX, .2 *this->resY); 178 (*weaponWidget)->setAbsCoor2D(pos*this->resX, .75*this->resY); 166 179 167 180 } … … 171 184 void Hud::tick(float dt) 172 185 { 173 if (this->resY != State::getResY() || this->resX != State::getResY()) 186 if (this->resY != State::getResY() || this->resX != State::getResX()) 187 { 174 188 this->updateResolution(); 189 } 190 175 191 } 176 192 177 193 void Hud::draw() const 178 194 { 179 // GLGuiWidget::draw();195 // GLGuiWidget::draw(); 180 196 } 181 197 -
trunk/src/util/hud.h
r8448 r8518 10 10 // FORWARD DECLARATION 11 11 class TiXmlElement; 12 12 13 class WeaponManager; 13 namespace OrxGui { class GLGuiWidget; } 14 namespace OrxGui { 15 class GLGuiWidget; 16 class GLGuiNotifier; 17 class GLGuiInputLine; 18 19 } 14 20 15 21 //! A class that renders a HUD. … … 23 29 24 30 virtual void loadParams(const TiXmlElement* root); 31 32 void notifyUser(const std::string& message); 33 25 34 26 35 void setBackGround(); … … 49 58 OrxGui::GLGuiWidget* armorWidget; 50 59 60 OrxGui::GLGuiNotifier* notifier; 61 OrxGui::GLGuiInputLine* inputLine; 62 51 63 WeaponManager* weaponManager; 52 64
Note: See TracChangeset
for help on using the changeset viewer.