Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6295 in orxonox.OLD


Ignore:
Timestamp:
Dec 26, 2005, 3:01:14 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: new GUI-functionality

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/material.cc

    r5437 r6295  
    7575{
    7676  // setting diffuse color
    77   //  glColor3f (diffuse[0], diffuse[1], diffuse[2]);
     77  glColor3f (diffuse[0], diffuse[1], diffuse[2]);
    7878  glMaterialfv(GL_FRONT, GL_DIFFUSE, this->diffuse);
    7979
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r6142 r6295  
    2525#include "graphics_engine.h"
    2626#include "load_param.h"
    27 #include "parser/tinyxml/tinyxml.h"
    2827#include "class_list.h"
    2928
     
    4241
    4342/**
    44  * standard constructor
     43 * @brief standard constructor
    4544 * @param parent the parent to set for this Element2D
    4645 *
     
    6059
    6160/**
    62  * standard deconstructor
     61 * @brief standard deconstructor
    6362 *
    6463 * There are two general ways to delete an Element2D
     
    9796
    9897/**
    99  * initializes a Element2D
     98 * @brief initializes a Element2D
    10099 */
    101100void Element2D::init()
     
    121120
    122121/**
    123  * Loads the Parameters of an Element2D from...
     122 * @brief Loads the Parameters of an Element2D from...
    124123 * @param root The XML-element to load from
    125124 */
     
    160159
    161160  // cycling properties
    162   if (root != NULL)
    163   {
    164     LOAD_PARAM_START_CYCLE(root, element);
    165     {
    166       LoadParam_CYCLE(element, "parent", this, Element2D, addChild2D)
    167           .describe("adds a new Child to the current Node.");
    168     }
    169     LOAD_PARAM_END_CYCLE(element);
    170   }
     161  LOAD_PARAM_START_CYCLE(root, element);
     162  {
     163    LoadParam_CYCLE(element, "parent", this, Element2D, addChild2D)
     164        .describe("adds a new Child to the current Node.");
     165  }
     166  LOAD_PARAM_END_CYCLE(element);
    171167}
    172168
     
    511507void Element2D::addChild2D (Element2D* child)
    512508{
     509  assert(child != NULL);
    513510  if( likely(child->parent != NULL))
    514511  {
     
    662659void Element2D::eraseChild(Element2D* child)
    663660{
     661  assert (this != NULL && child != NULL);
    664662  std::list<Element2D*>::iterator childIT = std::find(this->children.begin(), this->children.end(), child);
    665663  this->children.erase(childIT);
     
    667665
    668666/**
    669  * sets the mode of this parent manually
     667 * @brief sets the mode of this parent manually
    670668 * @param parentMode a String representing this parentingMode
    671669 */
     
    10511049
    10521050/**
    1053  *  creates the one and only NullElement2D
    1054  * @param absCoordinate the cordinate of the Parent (normally Vector(0,0,0))
     1051 * @brief creates the one and only NullElement2D
    10551052 */
    10561053NullElement2D::NullElement2D () : Element2D(NULL, E2D_LAYER_BELOW_ALL)
  • trunk/src/lib/gui/gl_gui/glgui_bar.cc

    r6287 r6295  
    2121
    2222/**
    23  * standard constructor
     23 * @brief standard constructor
    2424*/
    2525GLGuiBar::GLGuiBar ()
     
    3131
    3232/**
    33  * standard deconstructor
    34 */
     33 * @brief standard deconstructor
     34 */
    3535GLGuiBar::~GLGuiBar()
    3636{
     
    3939
    4040/**
    41  * initializes the GUI-element
     41 * @brief initializes the GUI-element
    4242 */
    4343void GLGuiBar::init()
    4444{
    4545  this->setClassID(CL_GLGUI_BAR, "GLGuiBar");
     46
     47  this->frontMat.setDiffuse(1,0,0);
     48  this->frontMat.setTransparency(.99);
     49
     50  this->setSize2D(50, 10);
    4651
    4752  this->value = 0.5f;
     
    5156
    5257/**
    53  * draws the GLGuiBar
     58 * @brief draws the GLGuiBar
    5459 */
    5560void GLGuiBar::draw() const
    5661{
     62  this->startDraw();
    5763
    58   printf("TEST %f %f\n", this->getAbsCoor2D().x, this->getAbsCoor2D().y);
    5964  GLGuiWidget::draw();
    6065
     66  this->frontMat.select();
    6167  glBegin(GL_QUADS);
    6268
    63   glVertex2d(.1, .1);
    64   glVertex2d(.1, this->getSizeY2D()* .8 * (value/maximum));
    65   glVertex2d(this->getSizeX2D(), this->getSizeY2D() * .8 * (value/maximum));
    66   glVertex2d(this->getSizeX2D(), .1);
     69  glVertex2f(.1 * this->getSizeX2D(), .1 * this->getSizeY2D());
     70  glVertex2f(.1 * this->getSizeX2D(), this->getSizeY2D()* .9 * (value/maximum));
     71  glVertex2f(this->getSizeX2D() * .9, this->getSizeY2D() * .9 * (value/maximum));
     72  glVertex2f(this->getSizeX2D() * .9, .1 * this->getSizeY2D());
    6773
    6874  glEnd();
     75  this->endDraw();
    6976}
  • trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc

    r6287 r6295  
    4646{
    4747  this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");
     48  this->frontMat.setDiffuse(1,0,0);
    4849//  this->label->setRelCoor2D(10, 10);
    4950}
     
    5657  this->startDraw();
    5758
    58   GLGuiButton::draw();
     59//  GLGuiButton::draw();
    5960
     61  this->frontMat.select();
    6062  glBegin(GL_QUADS);
    6163
  • trunk/src/lib/gui/gl_gui/glgui_widget.cc

    r6287 r6295  
    5454//  this->setParent2D((Element2D*)NULL);
    5555
    56   this->backMat = new Material();
    57   this->backMat->setDiffuse(0, 0, 0);
     56  this->backMat.setDiffuse(.1, .5, .5);
     57  this->backMat.setTransparency(.9);
    5858
    59   this->frontMat = NULL;
    6059  this->frontModel = 0;
    6160
     
    111110void GLGuiWidget::draw() const
    112111{
    113   this->backMat->select();
     112  this->backMat.select();
    114113
    115114  glBegin(GL_QUADS);
    116 
    117 
    118   glVertex2d(0,0);
    119   glVertex2d(0, this->getSizeY2D());
    120   glVertex2d(this->getSizeX2D(), this->getSizeY2D());
    121   glVertex2d(this->getSizeX2D(),0);
    122 
     115   glVertex2d(0, 0);
     116   glVertex2d(0, this->getSizeY2D());
     117   glVertex2d(this->getSizeX2D(), this->getSizeY2D());
     118   glVertex2d(this->getSizeX2D(), 0);
    123119  glEnd();
    124120}
  • trunk/src/lib/gui/gl_gui/glgui_widget.h

    r6287 r6295  
    1010#include "event.h"
    1111
     12#include "material.h"
     13
    1214#include "glincl.h"
    1315#include "executor/executor.h"
     
    1921{
    2022  GLGuiSignal_click     = 0,
    21   GLGuiSignal_release   = 1,
    22   GLGuiSignal_rollOn    = 2,
    23   GLGuiSignal_rollOff   = 3,
    24   GLGuiSignal_open      = 4,
    25   GLGuiSignal_close     = 5,
    26   GLGuiSignal_destroy   = 6,
     23  GLGuiSignal_release,
     24  GLGuiSignal_rollOn,
     25  GLGuiSignal_rollOff,
     26  GLGuiSignal_open,
     27  GLGuiSignal_close,
     28  GLGuiSignal_destroy,
    2729
    28   GLGuiSignalCount      = 7,
     30  GLGuiSignalCount,
    2931} GLGuiSignalType;
    3032
     
    6870    inline void endDraw() const { glPopMatrix(); };
    6971
    70   private:
    71     Material*             backMat;
     72  protected:
     73    Material              backMat;
    7274    GLuint                backModel;
    7375
    74     Material*             frontMat;
     76    Material              frontMat;
    7577    GLuint                frontModel;
    7678
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6288 r6295  
    135135  this->mouseDir = this->getAbsDir();
    136136
    137 //    GLGuiButton* button = new GLGuiPushButton();
    138 //    button->show();
    139 //    button->setLabel("orxonox");
    140 //    button->setBindNode(this);
    141 
     137/*   GLGuiButton* button = new GLGuiPushButton();
     138   button->show();
     139   button->setLabel("orxonox");
     140   button->setBindNode(this);*/
     141//    GLGuiBar* bar = new GLGuiBar();
     142//    bar->show();
     143//    bar->setValue(7.0);
     144//    bar->setMaximum(10);
     145//    bar->setSize2D( 20, 100);
     146//    bar->setAbsCoor2D( 10, 200);
     147//
    142148  //add events to the eventlist
    143149  registerEvent(SDLK_w);
Note: See TracChangeset for help on using the changeset viewer.