#include <cursor.h>
Collaboration diagram for CharacterCursor:
Public Member Functions | |
void | Reset () |
void | Draw () |
void | Refresh () |
void | PointeObj (PhysicalObj *obj) |
void | FollowActiveCharacter () |
void | Hide () |
Static Public Member Functions | |
static CharacterCursor * | GetInstance () |
Public Attributes | |
Sprite * | image |
Private Member Functions | |
CharacterCursor () | |
~CharacterCursor () | |
bool | IsDisplayed () const |
Private Attributes | |
uint | time_begin_anim |
uint | last_update |
PhysicalObj * | obj_designe |
int | dy |
bool | actif |
bool | want_hide |
Static Private Attributes | |
static CharacterCursor * | singleton = NULL |
Definition at line 30 of file cursor.h.
CharacterCursor::CharacterCursor | ( | ) | [private] |
Definition at line 49 of file cursor.cpp.
00050 { 00051 actif = false; 00052 want_hide = false; 00053 time_begin_anim = 0; 00054 last_update = 0; 00055 image = NULL; 00056 dy = 0; 00057 00058 Profile *res = resource_manager.LoadXMLProfile( "graphism.xml", false); 00059 image = resource_manager.LoadSprite( res, "gfx/curseur"); 00060 resource_manager.UnLoadXMLProfile( res); 00061 }
Here is the call graph for this function:
Here is the caller graph for this function:
CharacterCursor::~CharacterCursor | ( | ) | [private] |
void CharacterCursor::Draw | ( | ) |
Definition at line 69 of file cursor.cpp.
00070 { 00071 if (!IsDisplayed()) return; 00072 if (obj_designe == NULL) return; 00073 if (obj_designe -> IsGhost()) return; 00074 00075 // Dessine le curseur autour du ver 00076 Point2i centre = obj_designe->GetCenter(); 00077 uint x = centre.x - image->GetWidth()/2; 00078 uint y = obj_designe->GetY() - image->GetHeight() - y_min; 00079 00080 image->Draw( Point2i(x, y+dy) ); 00081 }
Here is the call graph for this function:
Here is the caller graph for this function:
void CharacterCursor::FollowActiveCharacter | ( | ) |
Definition at line 137 of file cursor.cpp.
00138 { 00139 PointeObj(&ActiveCharacter()); 00140 }
Here is the call graph for this function:
Here is the caller graph for this function:
CharacterCursor * CharacterCursor::GetInstance | ( | ) | [static] |
Definition at line 42 of file cursor.cpp.
00042 { 00043 if (singleton == NULL) { 00044 singleton = new CharacterCursor(); 00045 } 00046 return singleton; 00047 }
Here is the call graph for this function:
Here is the caller graph for this function:
void CharacterCursor::Hide | ( | ) |
bool CharacterCursor::IsDisplayed | ( | ) | const [private] |
Definition at line 153 of file cursor.cpp.
00153 { 00154 return actif || (Time::GetInstance()->Read() < time_begin_anim + show_hide_time); 00155 }
Here is the call graph for this function:
Here is the caller graph for this function:
void CharacterCursor::PointeObj | ( | PhysicalObj * | obj | ) |
Definition at line 142 of file cursor.cpp.
00143 { 00144 if(actif && obj==obj_designe) 00145 return; 00146 obj_designe = obj; 00147 actif = true; 00148 want_hide = false; 00149 time_begin_anim = Time::GetInstance()->Read(); 00150 }
Here is the call graph for this function:
Here is the caller graph for this function:
void CharacterCursor::Refresh | ( | ) |
Definition at line 83 of file cursor.cpp.
00084 { 00085 if (!IsDisplayed()) return; 00086 00087 image->Scale(1.0, 1.0); 00088 00089 Time * global_time = Time::GetInstance(); 00090 00091 //The arrow is appearing: 00092 if( actif && global_time->Read() < time_begin_anim + show_hide_time ) 00093 { 00094 dy = (int)((camera.GetPosition().y - ActiveCharacter().GetY()) * (1.0 - (global_time->Read() - time_begin_anim) / (float)show_hide_time)); 00095 return; 00096 } 00097 00098 //If we want to hide the cursor, we have to wait the end of the current rebound to make the cursor disappear 00099 if(want_hide) 00100 { 00101 if( ((global_time->Read() - (time_begin_anim + show_hide_time)) % rebound_time < rebound_time / 2) 00102 && ((last_update - (time_begin_anim + show_hide_time)) % rebound_time > rebound_time / 2)) 00103 { 00104 //We are at the end of the rebound 00105 actif = false; 00106 time_begin_anim = global_time->Read(); 00107 } 00108 } 00109 00110 //The arrow is disappearing: 00111 if( !actif && global_time->Read() < time_begin_anim + show_hide_time ) 00112 { 00113 dy = (int)((camera.GetPosition().y - ActiveCharacter().GetY()) * ((global_time->Read() - time_begin_anim) / (float)show_hide_time)); 00114 return; 00115 } 00116 00117 //The arrow is rebounding: 00118 Rebound(image, dy, time_begin_anim + show_hide_time, rebound_time, -y_max - (-y_min)); 00119 00120 last_update = global_time->Read(); 00121 }
Here is the call graph for this function:
Here is the caller graph for this function:
void CharacterCursor::Reset | ( | ) |
Definition at line 130 of file cursor.cpp.
00131 { 00132 actif = false; 00133 want_hide = false; 00134 obj_designe = NULL; 00135 }
Here is the caller graph for this function:
bool CharacterCursor::actif [private] |
int CharacterCursor::dy [private] |
uint CharacterCursor::last_update [private] |
PhysicalObj* CharacterCursor::obj_designe [private] |
CharacterCursor * CharacterCursor::singleton = NULL [static, private] |
uint CharacterCursor::time_begin_anim [private] |
bool CharacterCursor::want_hide [private] |