Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8518 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Jun 16, 2006, 10:23:05 AM (18 years ago)
Author:
bensch
Message:

merged the gui back to the trunk

Location:
trunk/src/lib
Files:
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/graphics_engine.cc

    r8490 r8518  
    405405  this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel);
    406406}
     407
     408void 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
    407417
    408418/**
  • trunk/src/lib/graphics/graphics_engine.h

    r8490 r8518  
    4444    int setResolution(int width, int height, int bpp);
    4545    void setFullscreen(bool fullscreen = false);
     46    void toggleFullscreen();
    4647    static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
    4748
  • trunk/src/lib/graphics/text_engine/text.cc

    r8448 r8518  
    159159}
    160160
     161
     162/**
     163 * @brief clears the Text Line (empies it).
     164 */
     165void Text::clear()
     166{
     167  text.clear();
     168  this->setupTextWidth();
     169}
    161170
    162171/**
  • trunk/src/lib/graphics/text_engine/text.h

    r8448 r8518  
    4040    const std::string& operator<<(const std::string& appendText);
    4141    void removeCharacters(unsigned int chars);
     42    void clear();
    4243
    4344    /// SETUP
  • trunk/src/lib/gui/gl/Makefile.am

    r8145 r8518  
    2929                glgui_image.cc \
    3030                glgui_window.cc \
    31                 glgui_cursor.cc
     31                glgui_cursor.cc \
     32                \
     33                specials/glgui_notifier.cc
    3234
    3335
     
    5456                glgui_image.h \
    5557                glgui_window.h \
    56                 glgui_cursor.h
     58                glgui_cursor.h \
     59                \
     60                specials/glgui_notifier.h
     61
    5762
    5863
  • trunk/src/lib/gui/gl/glgui_inputline.cc

    r8448 r8518  
    4848    this->setFocusable(true);
    4949
     50    this->_clearOnEnter = false;
    5051    this->_text.setParent2D(this);
    5152    this->_text.setRelCoor2D(4,4);
     
    100101  }
    101102
     103  void GLGuiInputLine::clear()
     104  {
     105    this->_text.clear();
     106    this->changedText();
     107  }
     108
    102109  /**
    103110   * @brief If the Text has been changed this function is called.
     
    124131  }
    125132
     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
    126146
    127147  /**
     
    140160        this->pressedKeyName = SDLK_BACKSPACE;
    141161        this->removeCharacters(1);
     162        return true;
     163      }
     164      else if(event.type == SDLK_RETURN || event.type == SDLK_KP_ENTER)
     165      {
     166        this->pushEnter();
    142167        return true;
    143168      }
  • trunk/src/lib/gui/gl/glgui_inputline.h

    r8448 r8518  
    3838    void appendCharacter(char character);
    3939    void removeCharacters(unsigned int chars);
     40    void clear();
     41
     42    void clearOnEnter(bool clear = true) { this->_clearOnEnter = clear; };
    4043
    4144    virtual void removedFocus();
     
    4750
    4851    DeclareSignal1(textChanged, const std::string&);
     52    DeclareSignal1(enterPushed, const std::string&);
    4953
    5054  protected:
     
    5761  private:
    5862    void init();
     63    void pushEnter();
    5964    void changedText();
     65
    6066
    6167  private:
    6268    Text                    _text;            //!< The Text to display inside of the InputLine.
     69    bool                    _clearOnEnter;    //!< Clear on Enter
    6370
    6471    Uint16                  pressedKey;       //!< the pressed key that will be repeated.
  • trunk/src/lib/gui/gl/glgui_style.cc

    r8450 r8518  
    2929  GLGuiStyle::GLGuiStyle (const TiXmlElement* root)
    3030  {
     31    _font = NULL;
     32    this->reset();
     33
     34
    3135    if (root != NULL)
    3236      this->loadParams(root);
     
    4347  }
    4448
     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
    4567  void GLGuiStyle::loadParams(const TiXmlElement* root)
    46   {
    47   }
     68  {}
    4869
    4970  void GLGuiStyle::setBorderLeft(float value)
     
    5475
    5576  void GLGuiStyle::setBorderLeft(float value, OrxGui::State state)
    56 {}
     77  {
     78    _style[state]._borderLeft = value;
     79  }
    5780
    5881  void GLGuiStyle::setBorderLeftS(float value, const std::string& state)
    59   {}
     82  {
     83  }
    6084
    6185
     
    6791
    6892  void GLGuiStyle::setBorderRight(float value, OrxGui::State state)
    69 {}
     93  {
     94    _style[state]._borderRight = value;
     95  }
    7096
    7197  void GLGuiStyle::setBorderRightS(float value, const std::string& state)
     
    80106
    81107  void GLGuiStyle::setBorderTop(float value, OrxGui::State state)
    82 {}
     108  {
     109    _style[state]._borderTop = value;
     110  }
    83111
    84112  void GLGuiStyle::setBorderTopS(float value, const std::string& state)
     
    93121
    94122  void GLGuiStyle::setBorderBottom(float value, OrxGui::State state)
    95 {}
     123  {
     124    _style[state]._borderBottom = value;
     125  }
    96126
    97127  void GLGuiStyle::setBorderBottomS(float value, const std::string& state)
     
    106136
    107137  void GLGuiStyle::setTextSize(float value, OrxGui::State state)
    108 {}
     138  {
     139    _style[state]._textSize = value;
     140  }
    109141
    110142  void GLGuiStyle::setTextSizeS(float value, const std::string& state)
     
    119151
    120152  void GLGuiStyle::setBackgroundColor(const Color& color, OrxGui::State state)
    121 {}
     153  {
     154    _style[state]._backgroundColor = color;
     155  }
    122156
    123157  void GLGuiStyle::setBackgroundColorS(float r, float g, float b, float a, const std::string& state)
     
    132166
    133167  void GLGuiStyle::setBackgroundTexture(const Texture& texture, OrxGui::State state)
    134 {}
     168  {
     169    _style[state]._backgroundTexture = texture;
     170  }
    135171
    136172  void GLGuiStyle::setBackgroundTexture(const std::string& textureName, const std::string& state)
     
    145181
    146182  void GLGuiStyle::setForegroundColor(const Color& color, OrxGui::State state)
    147   {}
     183  {
     184    _style[state]._foregroundColor = color;
     185  }
    148186
    149187  void GLGuiStyle::setForegroundColorS(float r, float g, float b, float a, const std::string& state)
     
    158196
    159197  void GLGuiStyle::setFeaturePosition(const std::string& featurePosition)
    160   {
    161 
    162   }
     198  {}
    163199
    164200
     
    179215  }
    180216
    181   void GLGuiStyle::animatedStateChanges(bool animated)
     217  void GLGuiStyle::setAnimatedStateChanges(bool animated)
    182218  {
    183219    this->_animatedStateChanges = animated;
  • trunk/src/lib/gui/gl/glgui_style.h

    r8448 r8518  
    4343
    4444    /// SETUP
     45    void reset();
    4546    void loadParams(const TiXmlElement* root);
    4647
     
    8586
    8687    void setAnimated(bool animated);
    87     void animatedStateChanges(bool animated);
     88    void setAnimatedStateChanges(bool animated);
    8889
    8990  private:
  • trunk/src/lib/gui/gl/glgui_widget.h

    r8448 r8518  
    6666    void disconnect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver);
    6767
     68
     69    GLGuiStyle& style() { return this->_style; };
     70    const GLGuiStyle style() const { return this->_style; };
    6871
    6972    /// MATERIAL (looks)
Note: See TracChangeset for help on using the changeset viewer.