[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 | |
---|
[7892] | 18 | #include "glgui_inputline.h" |
---|
[1853] | 19 | |
---|
[7779] | 20 | namespace OrxGui |
---|
[3365] | 21 | { |
---|
[7779] | 22 | /** |
---|
| 23 | * standard constructor |
---|
| 24 | */ |
---|
[7892] | 25 | GLGuiInputLine::GLGuiInputLine () |
---|
[7779] | 26 | { |
---|
| 27 | this->init(); |
---|
[4320] | 28 | |
---|
[7779] | 29 | } |
---|
[1853] | 30 | |
---|
| 31 | |
---|
[7779] | 32 | /** |
---|
| 33 | * standard deconstructor |
---|
| 34 | */ |
---|
[7892] | 35 | GLGuiInputLine::~GLGuiInputLine() |
---|
[7779] | 36 | { |
---|
| 37 | } |
---|
[5360] | 38 | |
---|
[7779] | 39 | /** |
---|
| 40 | * initializes the GUI-element |
---|
| 41 | */ |
---|
[7892] | 42 | void GLGuiInputLine::init() |
---|
[7779] | 43 | { |
---|
[7892] | 44 | this->setClassID(CL_GLGUI_INPUTLINE, "GLGuiInputLine"); |
---|
| 45 | this->text.setParent2D(this); |
---|
| 46 | this->text.setFont("fonts/final_frontier.ttf", 20); |
---|
[5360] | 47 | |
---|
[7892] | 48 | this->setText("SUPERTEST"); |
---|
| 49 | this->setSize2D( this->text.getSize2D()); |
---|
| 50 | |
---|
[7779] | 51 | } |
---|
[5360] | 52 | |
---|
[7892] | 53 | void GLGuiInputLine::setText(const std::string& text) |
---|
| 54 | { |
---|
| 55 | this->text.setText(text); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | void GLGuiInputLine::append(const std::string& appendText) |
---|
| 59 | { |
---|
| 60 | this->text.append(appendText); |
---|
| 61 | |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | void GLGuiInputLine::removeCharacters(unsigned int chars) |
---|
| 65 | { |
---|
| 66 | this->text.removeCharacters(chars); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | |
---|
[7779] | 71 | /** |
---|
[7892] | 72 | * draws the GLGuiInputLine |
---|
[7779] | 73 | */ |
---|
[7892] | 74 | void GLGuiInputLine::draw() const |
---|
[7779] | 75 | { |
---|
[7892] | 76 | this->startDraw(); |
---|
| 77 | GLGuiWidget::draw(); |
---|
| 78 | |
---|
| 79 | this->frontMaterial().select(); |
---|
| 80 | glBegin(GL_QUADS); |
---|
| 81 | |
---|
| 82 | glTexCoord2i(0,0); glVertex2d(3, 3); |
---|
| 83 | glTexCoord2i(0,1); glVertex2d(3, this->getSizeY2D() - 3); |
---|
| 84 | glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 3, this->getSizeY2D() -3); |
---|
| 85 | glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 3, 3); |
---|
| 86 | |
---|
| 87 | glEnd(); |
---|
| 88 | this->endDraw(); |
---|
[7779] | 89 | } |
---|
[5360] | 90 | } |
---|