Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8008 in orxonox.OLD for branches


Ignore:
Timestamp:
May 31, 2006, 1:30:25 AM (19 years ago)
Author:
bensch
Message:

orxonox/gui: image-implementation

Location:
branches/gui/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/defs/class_id.h

    r7919 r8008  
    336336  CL_GLGUI_INPUTLINE            =    0x00000b60,
    337337  CL_GLGUI_TEXTFIELD            =    0x00000b61,
     338  CL_GLGUI_IMAGE                =    0x00000b70,
    338339
    339340  // QT_GUI
  • branches/gui/src/lib/gui/gl_gui/Makefile.am

    r7919 r8008  
    2525                glgui_inputline.cc \
    2626                glgui_textfield.cc \
     27                glgui_image.cc \
    2728                glgui_window.cc \
    2829                glgui_cursor.cc
     
    4748                glgui_inputline.h \
    4849                glgui_textfield.h \
     50                glgui_image.h \
    4951                glgui_window.h \
    5052                glgui_cursor.h
  • branches/gui/src/lib/gui/gl_gui/glgui.h

    r7928 r8008  
    2222#include "glgui_inputline.h"
    2323#include "glgui_textfield.h"
     24#include "glgui_image.h"
    2425
    2526
  • branches/gui/src/lib/gui/gl_gui/glgui_image.cc

    r7779 r8008  
    4343  void GLGuiImage::init()
    4444  {
    45     this->setClassID(CL_GLGUI_, "GLGuiImage");
     45    this->setClassID(CL_GLGUI_IMAGE, "GLGuiImage");
     46
     47    this->frontMaterial().setDiffuseMap(this->texture);
     48
     49    this->resize();
     50  }
     51
     52
     53  void GLGuiImage::loadImageFromTexture(const Texture& texture)
     54  {
     55    this->texture = texture;
     56  }
     57
     58  void GLGuiImage::loadImageFromFile(const std::string& fileName)
     59  {
     60    this->texture.loadImage(fileName);
     61  }
     62
     63  void GLGuiImage::loadImageFromSDLSurface(SDL_Surface* surface)
     64  {
     65    //this->texture.loadSurface(surface);
     66  }
     67
     68  void GLGuiImage::loadImageFromDisplayList(GLuint texture)
     69  {
     70//    this->texture.setTexture(texture);
     71  }
     72
     73  void GLGuiImage::resize()
     74  {
     75    this->frontRect().setTopLeft(1, 1);
     76    this->frontRect().setSize(this->getSizeX2D() -2, this->getSizeY2D() -2);
     77    GLGuiWidget::resize();
     78  }
     79
     80
     81  /**
     82   * @brief draws the GLGuiImage
     83   */
     84  void GLGuiImage::draw() const
     85  {
     86    this->beginDraw();
     87    GLGuiWidget::draw();
     88
     89    this->frontMaterial().select();
     90    this->drawRect(this->frontRect());
     91    this->endDraw();
     92
    4693
    4794  }
    48 
    49   /**
    50    * draws the GLGuiImage
    51    */
    52   void GLGuiImage::draw()
    53   {
    54   }
    5595}
  • branches/gui/src/lib/gui/gl_gui/glgui_image.h

    r7779 r8008  
    88#define _GLGUI_IMAGE_H
    99
    10 #include "base_object.h"
     10#include "glgui_widget.h"
    1111
    1212// FORWARD DECLARATION
     
    2626    virtual ~GLGuiImage();
    2727
    28     void init();
    29     void loadImageFromFile(const char* fileName);
     28    void loadImageFromTexture(const Texture& texture);
     29
     30    void loadImageFromFile(const std::string& fileName);
    3031    void loadImageFromSDLSurface(SDL_Surface* surface);
    31     void loadImageFromDisplayList(GLuint displayList);
     32    void loadImageFromDisplayList(GLuint texture);
    3233
    33     virtual void draw();
     34    virtual void draw() const;
     35
     36    DeclareSignal0(imageChanged);
    3437
    3538  private:
     39    void init();
     40    virtual void resize();
    3641
     42  private:
     43    Texture       texture;
    3744  };
    3845}
  • branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc

    r7985 r8008  
    9898
    9999    this->frontMaterial().select();
    100     glBegin(GL_QUADS);
    101 
    102     glTexCoord2i(0,0); glVertex2d(1, 1);
    103     glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1);
    104     glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1);
    105     glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1);
    106 
    107     glEnd();
     100    this->drawRect(this->frontRect());
    108101    this->endDraw();
    109102    //   this->label->draw();
  • branches/gui/src/lib/gui/gl_gui/glgui_textfield.cc

    r7919 r8008  
    4343  {
    4444    this->setClassID(CL_GLGUI_TEXTFIELD, "GLGuiTextfield");
    45 
    46 
    4745  }
    4846
    4947  /**
    50    * draws the GLGuiTextfield
     48   * @brief draws the GLGuiTextfield
    5149   */
    5250  void GLGuiTextfield::draw() const
    5351  {
     52    this->beginDraw();
     53    GLGuiWidget::draw();
     54
     55    this->frontMaterial().select();
     56    this->drawRect(this->frontRect());
     57    this->endDraw();
    5458  }
    5559}
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.cc

    r7988 r8008  
    163163  ;
    164164
     165  void GLGuiWidget::setWidgetSize(const Vector2D& size)
     166  {
     167    this->setSize2D(size);
     168    this->resize();
     169
     170  }
     171
     172
     173  void GLGuiWidget::setWidgetSize(float x, float y)
     174  {
     175    this->setWidgetSize(Vector2D(x, y));
     176  }
    165177
    166178
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.h

    r8002 r8008  
    8888    void setBorderSize(float borderSize);
    8989
     90    void setWidgetSize(const Vector2D& size);
     91    void setWidgetSize(float x, float y);
     92
    9093
    9194    void setBackgroundColor(float x, float y, float z) { this->backMaterial().setDiffuse(x,y,z); };
  • branches/gui/src/story_entities/simple_game_menu.cc

    r8007 r8008  
    114114  box->showAll();
    115115
     116  OrxGui::GLGuiImage* image = new OrxGui::GLGuiImage();
     117  image->show();
     118  image->setWidgetSize(200, 200);
     119  image->setAbsCoor2D(300, 300);
    116120
    117121  OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
Note: See TracChangeset for help on using the changeset viewer.