Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 25, 2007, 3:05:01 AM (17 years ago)
Author:
patrick
Message:

merged playability. but got strange bug

Location:
branches/playability.new
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability.new

    • Property svn:ignore
      •  

        old new  
        1010autom4te.cache
        1111aclocal.m4
         12tags
         13test.bmp
         14config.sub
         15config.guess
         16OrxonoxPlayability.kdevses
         17OrxonoxPlayability.kdevelop.pcs
  • branches/playability.new/src/lib/gui/gl/glgui_box.cc

    r9869 r10362  
    1818#include "glgui_box.h"
    1919#include <cassert>
     20#include <iostream>
    2021#include "debug.h"
     22#include "network_log.h"
     23
    2124
    2225namespace OrxGui
     
    177180  void GLGuiBox::resize()
    178181  {
    179     if (orientation() == OrxGui::Vertical)
     182    if (this->orientation() == OrxGui::Vertical)
    180183    {
    181184      float height = borderTop();
     
    186189      for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
    187190      {
    188         (*widget)->setRelCoor2D(borderLeft(), height);
    189         height += (*widget)->getSizeY2D();
    190         width = fmax(width, (*widget)->getSizeX2D());
     191        //float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360;
     192        //float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir));
     193        //float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir));
     194        float realSizeX, realSizeY;
     195        int angleAbs = (int)(*widget)->getAbsDir2D();
     196        int angleRel = (int)(*widget)->getRelDir2D();
     197        //std::cout << "absangle: " << angleAbs << ", relangle: " << angleRel << '\n';
     198        if ((*widget)->getAbsDir2D() == 0 || (*widget)->getAbsDir2D() == 180)
     199        {
     200          realSizeX = (*widget)->getSizeX2D();
     201          realSizeY = (*widget)->getSizeY2D();
     202          //std::cout<<"box vertical, widget 0or180";
     203        }
     204        else if ((*widget)->getAbsDir2D() == 90 || (*widget)->getAbsDir2D() == 270)
     205        {
     206          realSizeX = (*widget)->getSizeY2D();
     207          realSizeY = (*widget)->getSizeX2D();
     208          //std::cout<<"box vertical, widget 90or270";
     209        }
     210
     211        (*widget)->setRelCoor2D(borderLeft(), height + borderTop());
     212        height += realSizeY;
     213        width = fmax(width, realSizeX);
    191214      }
    192215
     
    205228      for (widget = this->_children.begin(); widget != this->_children.end(); ++widget)
    206229      {
     230        //float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360;
     231        //std::cout << "size X: " << (*widget)->getSizeX2D() << "size Y: " << (*widget)->getSizeY2D() << '\n';
     232        //float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir));
     233        //float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir));
     234        float realSizeX, realSizeY;
     235        int angleAbs = (int)(*widget)->getAbsDir2D();
     236        int angleRel = (int)(*widget)->getRelDir2D();
     237        //std::cout << "absangle: " << angleAbs << ", relangle: " << angleRel << '\n';
     238        if ((*widget)->getAbsDir2D() == 0 || (*widget)->getAbsDir2D() == 180)
     239        {
     240          realSizeX = (*widget)->getSizeX2D();
     241          realSizeY = (*widget)->getSizeY2D();
     242          //std::cout<<"box horicontal, widget 0or180";
     243        }
     244        else if ((*widget)->getAbsDir2D() == 90 || (*widget)->getAbsDir2D() == 270)
     245        {
     246          realSizeX = (*widget)->getSizeY2D();
     247          realSizeY = (*widget)->getSizeX2D();
     248          //std::cout<<"box horicontal, widget 90or270";
     249        }
     250
    207251        (*widget)->setRelCoor2D(width, borderTop());
    208         height = fmax(height, (*widget)->getSizeY2D());
    209         width += (*widget)->getSizeX2D();
     252        height = fmax(height, realSizeY);
     253        width += realSizeX;
    210254      }
    211255
Note: See TracChangeset for help on using the changeset viewer.