source:
orxonox.OLD/trunk/src/lib/gui/gl/glgui_fixedposition_box.cc
| Last change on this file was 9869, checked in by bensch, 19 years ago | |
|---|---|
| File size: 1.5 KB | |
| Rev | Line | |
|---|---|---|
| [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 | |
| [9546] | 18 | #include "glgui_fixedposition_box.h" |
| 19 | #include "glgui_handler.h" | |
| [9549] | 20 | |
| [8450] | 21 | #include <cassert> |
| [1853] | 22 | |
| [7779] | 23 | namespace OrxGui |
| [3365] | 24 | { |
| [9869] | 25 | ObjectListDefinition(GLGuiFixedpositionBox); |
| [7779] | 26 | /** |
| 27 | * standard constructor | |
| 28 | */ | |
| [9546] | 29 | GLGuiFixedpositionBox::GLGuiFixedpositionBox (OrxGui::Position position, OrxGui::Orientation orientation) |
| [9547] | 30 | : GLGuiBox(orientation) |
| [9554] | 31 | { |
| [9869] | 32 | this->registerObject(this, GLGuiFixedpositionBox::_objectList); |
| 33 | ||
| [9554] | 34 | this->subscribeEvent(ES_ALL, EV_VIDEO_RESIZE); |
| [9556] | 35 | this->setPosition(position); |
| [9554] | 36 | } |
| [1853] | 37 | |
| 38 | ||
| [9546] | 39 | void GLGuiFixedpositionBox::setPosition(OrxGui::Position position) |
| [5393] | 40 | { |
| [9546] | 41 | this->_position = position; |
| [9547] | 42 | this->resize(); |
| [5393] | 43 | } |
| 44 | ||
| [7779] | 45 | |
| [9546] | 46 | void GLGuiFixedpositionBox::resize() |
| [5393] | 47 | { |
| [9546] | 48 | GLGuiBox::resize(); |
| [8035] | 49 | |
| [9547] | 50 | switch (this->_position) |
| [7779] | 51 | { |
| [9546] | 52 | case OrxGui::Center: |
| [9558] | 53 | this->setAbsCoor2D((GLGuiHandler::getInstance()->resolution() - this->getSize2D()) / 2.0); |
| [9546] | 54 | break; |
| [9547] | 55 | default: |
| 56 | printf("not done mode yet!!\n"); | |
| [7779] | 57 | } |
| [8035] | 58 | } |
| 59 | ||
| [9554] | 60 | void GLGuiFixedpositionBox::process(const Event& event) |
| 61 | { | |
| 62 | switch(event.type) | |
| 63 | { | |
| 64 | case EV_VIDEO_RESIZE: | |
| 65 | this->resize(); | |
| 66 | break; | |
| 67 | ||
| 68 | } | |
| 69 | ||
| 70 | } | |
| 71 | ||
| 72 | ||
| [5360] | 73 | } |
Note: See TracBrowser
for help on using the repository browser.










