[4744] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[5360] | 12 | main-programmer: Benjamin Grauer |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[5360] | 16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI |
---|
[1853] | 17 | |
---|
[5364] | 18 | #include "glgui_pushbutton.h" |
---|
[1853] | 19 | |
---|
[5395] | 20 | #include "text.h" |
---|
[5420] | 21 | #include "material.h" |
---|
[5395] | 22 | |
---|
[1856] | 23 | using namespace std; |
---|
[1853] | 24 | |
---|
[3245] | 25 | /** |
---|
[4838] | 26 | * standard constructor |
---|
[3245] | 27 | */ |
---|
[5364] | 28 | GLGuiPushButton::GLGuiPushButton () |
---|
[3365] | 29 | { |
---|
[5360] | 30 | this->init(); |
---|
[3365] | 31 | } |
---|
[1853] | 32 | |
---|
| 33 | |
---|
[3245] | 34 | /** |
---|
[4838] | 35 | * standard deconstructor |
---|
[3245] | 36 | */ |
---|
[5364] | 37 | GLGuiPushButton::~GLGuiPushButton() |
---|
[3543] | 38 | { |
---|
[5360] | 39 | |
---|
[3543] | 40 | } |
---|
[5360] | 41 | |
---|
| 42 | /** |
---|
| 43 | * initializes the GUI-element |
---|
| 44 | */ |
---|
[5364] | 45 | void GLGuiPushButton::init() |
---|
[5360] | 46 | { |
---|
[5364] | 47 | this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton"); |
---|
[5420] | 48 | // this->label->setRelCoor2D(10, 10); |
---|
[5360] | 49 | |
---|
[5420] | 50 | this->backMat = new Material(); |
---|
| 51 | this->backMat->setDiffuse(0, 0, 0); |
---|
| 52 | |
---|
| 53 | this->setSize2D(label->getSizeX2D()+10, label->getSizeY2D()+10); |
---|
[5360] | 54 | } |
---|
| 55 | |
---|
| 56 | /** |
---|
[5364] | 57 | * draws the GLGuiPushButton |
---|
[5360] | 58 | */ |
---|
[5395] | 59 | void GLGuiPushButton::draw() const |
---|
[5360] | 60 | { |
---|
[5420] | 61 | this->backMat->select(); |
---|
| 62 | glPushMatrix(); |
---|
| 63 | glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); |
---|
| 64 | glBegin(GL_QUADS); |
---|
| 65 | |
---|
| 66 | glVertex2d(0,0); |
---|
| 67 | glVertex2d(0, this->getSizeY2D()); |
---|
| 68 | glVertex2d(this->getSizeX2D(), this->getSizeY2D()); |
---|
| 69 | glVertex2d(this->getSizeX2D(),0); |
---|
| 70 | |
---|
| 71 | glEnd(); |
---|
| 72 | glPopMatrix(); |
---|
| 73 | |
---|
| 74 | // this->label->draw(); |
---|
[5418] | 75 | // printf("test"); |
---|
[5360] | 76 | } |
---|
[5395] | 77 | |
---|
| 78 | /** |
---|
| 79 | * updates the GLGuiPushButton |
---|
| 80 | */ |
---|
| 81 | void GLGuiPushButton::update() |
---|
| 82 | { |
---|
| 83 | |
---|
| 84 | } |
---|