Sky Class Reference

#include <sky.h>

Collaboration diagram for Sky:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Sky ()
void Init ()
void Reset ()
void Draw ()
void Free ()

Private Member Functions

void RedrawParticleList (std::list< Rectanglei > &list)
void RedrawParticle (const Rectanglei &particle) const
Point2i GetSkyPos () const

Private Attributes

Surface image
Point2i lastPos
Point2i tstVect
Point2i margin

Detailed Description

Definition at line 32 of file sky.h.


Constructor & Destructor Documentation

Sky::Sky (  ) 

Definition at line 32 of file sky.cpp.

00032         {
00033 }


Member Function Documentation

void Sky::Draw (  ) 

Definition at line 54 of file sky.cpp.

00055 {
00056   if( lastPos != camera.GetPosition() ){
00057         lastPos = camera.GetPosition();
00058         RedrawParticle(camera);
00059     return;
00060   }
00061   
00062   RedrawParticleList(*world.to_redraw_now);
00063   RedrawParticleList(*world.to_redraw_particles_now);
00064 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sky::Free (  ) 

Definition at line 50 of file sky.cpp.

00050               {
00051         image.Free();
00052 }

Here is the call graph for this function:

Here is the caller graph for this function:

Point2i Sky::GetSkyPos (  )  const [private]

Definition at line 79 of file sky.cpp.

00079                             {
00080         return (Point2i(1, 1) - tstVect) * camera.GetPosition() * SKY_SPEED;
00081 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sky::Init (  ) 

Definition at line 35 of file sky.cpp.

00035               {
00036         // That is temporary -> image will be loaded directly without alpha chanel
00037         Surface tmp_image = ActiveMap().ReadImgSky();
00038         tmp_image.SetAlpha( 0, 0);
00039         image = tmp_image.DisplayFormat();
00040 
00041         tstVect = image.GetSize().inf( camera.GetSize() );
00042         margin = tstVect * (camera.GetSize() - image.GetSize())/2;
00043 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sky::RedrawParticle ( const Rectanglei particle  )  const [private]

Definition at line 73 of file sky.cpp.

00073                                                         {
00074     Rectanglei ds(GetSkyPos() + particle.GetPosition() - camera.GetPosition() - margin, 
00075                     particle.GetSize() );
00076     AppWormux::GetInstance()->video.window.Blit(image, ds, particle.GetPosition() - camera.GetPosition());
00077 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sky::RedrawParticleList ( std::list< Rectanglei > &  list  )  [private]

Definition at line 66 of file sky.cpp.

00066                                                      {
00067   std::list<Rectanglei>::iterator it;
00068 
00069   for( it = list.begin(); it != list.end(); ++it )
00070           RedrawParticle(*it);
00071 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Sky::Reset (  ) 

Definition at line 45 of file sky.cpp.

00045                {
00046         Init();
00047         lastPos.SetValues(INT_MAX, INT_MAX);
00048 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Surface Sky::image [private]

Definition at line 34 of file sky.h.

Point2i Sky::lastPos [private]

Definition at line 35 of file sky.h.

Point2i Sky::margin [private]

Definition at line 37 of file sky.h.

Point2i Sky::tstVect [private]

Definition at line 36 of file sky.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:15:48 2007 for Wormux by  doxygen 1.4.7