Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10139 in orxonox.OLD for branches/playability/src/lib/gui/gl


Ignore:
Timestamp:
Dec 22, 2006, 12:21:38 AM (18 years ago)
Author:
muellmic
Message:

trying to adjust interface

Location:
branches/playability/src/lib/gui/gl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/lib/gui/gl/glgui_bar.cc

    r9869 r10139  
    7171
    7272    this->_value = value;
    73     this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value -_minimum)/ (_minimum + _maximum)
     73    this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value - _minimum) / (_maximum -_minimum)
    7474        ,this->getSizeY2D() - borderTop() - borderBottom());
    7575  }
     
    9999
    100100    this->_frontRect.setTopLeft(borderLeft(), borderTop());
    101     this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value -_minimum)/ (_minimum + _maximum)
    102                              ,this->getSizeY2D() - borderTop() - borderBottom());
     101    this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value - _minimum) / (_maximum -_minimum)
     102        ,this->getSizeY2D() - borderTop() - borderBottom());
    103103
    104104  }
  • branches/playability/src/lib/gui/gl/glgui_box.cc

    r9869 r10139  
    1818#include "glgui_box.h"
    1919#include <cassert>
     20#include <iostream>
    2021#include "debug.h"
     22#include "network_log.h"
    2123
    2224namespace OrxGui
     
    177179  void GLGuiBox::resize()
    178180  {
    179     if (orientation() == OrxGui::Vertical)
     181    if (this->orientation() == OrxGui::Vertical)
    180182    {
    181183      float height = borderTop();
     
    186188      for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
    187189      {
    188         (*widget)->setRelCoor2D(borderLeft(), height);
    189         height += (*widget)->getSizeY2D();
    190         width = fmax(width, (*widget)->getSizeX2D());
     190        float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360;
     191        float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir));
     192        float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir));
     193
     194        (*widget)->setRelCoor2D(borderLeft(), height + borderTop());
     195        height += realSizeY;
     196        width = fmax(width, realSizeX);
    191197      }
    192198
     
    205211      for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
    206212      {
     213        float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360;
     214        //std::cout << "size X: " << (*widget)->getSizeX2D() << "size Y: " << (*widget)->getSizeY2D() << '\n';
     215        float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir));
     216        float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir));
     217
    207218        (*widget)->setRelCoor2D(width, borderTop());
    208         height = fmax(height, (*widget)->getSizeY2D());
    209         width += (*widget)->getSizeX2D();
     219        height = fmax(height, realSizeY);
     220        width += realSizeX;
    210221      }
    211222
Note: See TracChangeset for help on using the changeset viewer.