00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 #include "Teddy/PhysicalComponents/Area.h"
00026 #include "Teddy/PhysicalComponents/EventListener.h"
00027 #include "Teddy/PhysicalComponents/Projection.h"
00028 #include "Teddy/PhysicalComponents/Style.h"
00029 #include "Teddy/Graphics/View.h"
00030 #include "Teddy/Graphics/Font.h"
00031 #include "Teddy/SysSupport/Messages.h"
00032 #include "Teddy/SysSupport/StdIO.h"
00033 #ifndef SWIG
00034 #include <cassert>
00035 #endif
00036 using namespace Teddy::Graphics;
00037 
00038 
00039 namespace Teddy              {
00040 namespace PhysicalComponents {
00041 
00042 
00044  void Area::draw(){
00045     dmsg( M_WM, "%s->Area::draw()", this->getName().c_str() );
00046     dmsg( M_WM, "  %s->rect = %f, %f .. %f, %f", this->getName().c_str(), rect.min[0], rect.min[1], rect.max[0], rect.max[1] );
00047     if( drawing_ordering == pre_self ){
00048         drawSelf();
00049     }
00050 
00051     list<Area*>::iterator a_it = areas.begin();
00052     while( a_it != areas.end() ){
00053         Area *a = *a_it;
00054         const char *name = a->getName().c_str();
00055         dmsg( M_WM, "%s->Area::draw() calling %s->draw()", this->getName().c_str(), name );
00056         a->draw();
00057         a_it++;
00058     }
00059 
00060     if( drawing_ordering == post_self ){
00061         drawSelf();
00062     }
00063 }
00064 
00065 
00067  void Area::drawSelf(){
00068 }
00069 
00070 
00071 View *Area::getView() const {
00072     return view;
00073 }
00074 
00075 
00076 void Area::drawVertex( const float x1, const float y1 ){
00077     view->vertex( x1+rect.min[0], y1+rect.min[1] );
00078 }
00079 
00080 
00082 void Area::drawRect( const float x1, const float y1, const float x2, const float y2 ){
00083     view->drawRect( x1+rect.min[0], y1+rect.min[1], x2+rect.min[0], y2+rect.min[1] );
00084 }
00085 
00086 
00088 void Area::drawFillRect( const float x1, const float y1, const float x2, const float y2 ){
00089     const char *name = this->getName().c_str();
00090     msg( M_GL, "%s->Area::drawFillRect( %f, %f, %f, %f )", name, x1,y1,x2,y2 );
00091     msg( M_GL, "%s->rect.min = %f, %f", name, rect.min[0], rect.min[1] );
00092     view->drawFillRect( x1+rect.min[0], y1+rect.min[1], x2+rect.min[0], y2+rect.min[1] );
00093 }
00094 
00095 
00097 void Area::drawBiColRect( const float x1, const float y1, const float x2, const float y2, const Color &top_left, const Color &bottom_right ){
00098     view->drawBiColRect( x1+rect.min[0], y1+rect.min[1], x2+rect.min[0], y2+rect.min[1], top_left, bottom_right );
00099 }
00100 
00101 
00103 void Area::drawString( const Vector2 &pos, const char *str, Font *font ){
00104     view->drawString( pos + rect.min, str, font );
00105 }
00106 
00107 
00108 };  
00109 };  
00110