#include <button.h>
Inheritance diagram for Button:
Public Member Functions | |
Button (const Rectanglei &rect, const Profile *res_profile, const std::string &resource_id, bool img_scale=true) | |
Button (const Point2i &position, const Profile *res_profile, const std::string &resource_id, bool img_scale=false) | |
virtual | ~Button () |
virtual void | Draw (const Point2i &mousePosition, Surface &surf) const |
virtual void | SetSizePosition (const Rectanglei &rect) |
Sprite * | GetSprite () |
Protected Attributes | |
bool | img_scale |
Sprite * | image |
Definition at line 30 of file button.h.
Button::Button | ( | const Rectanglei & | rect, | |
const Profile * | res_profile, | |||
const std::string & | resource_id, | |||
bool | img_scale = true | |||
) |
Definition at line 27 of file button.cpp.
00028 : Widget(rect) 00029 { 00030 image = resource_manager.LoadSprite(res_profile,resource_id); 00031 image->cache.EnableLastFrameCache(); 00032 00033 // image scalling or not 00034 img_scale = _img_scale; 00035 00036 if (img_scale) 00037 image->ScaleSize(rect.GetSize()); 00038 }
Here is the call graph for this function:
Button::Button | ( | const Point2i & | position, | |
const Profile * | res_profile, | |||
const std::string & | resource_id, | |||
bool | img_scale = false | |||
) |
Definition at line 40 of file button.cpp.
00042 { 00043 image = resource_manager.LoadSprite(res_profile, resource_id); 00044 position = m_position; 00045 size = image->GetSize(); 00046 00047 // image scalling on resize 00048 img_scale = _img_scale; 00049 }
Here is the call graph for this function:
Button::~Button | ( | ) | [virtual] |
Implements Widget.
Reimplemented in ButtonText.
Definition at line 56 of file button.cpp.
00057 { 00058 uint frame = Contains(mousePosition)?1:0; 00059 00060 image->SetCurrentFrame(frame); 00061 00062 if (img_scale) { 00063 // image scalling : easy to place image 00064 image->Blit(surf, position); 00065 } else { 00066 // centering image 00067 Point2i pos = position; 00068 00069 pos.x += (GetSizeX()/2) - (image->GetWidth()/2); 00070 pos.y += (GetSizeY()/2) - (image->GetHeight()/2); 00071 00072 image->Blit(surf, pos); 00073 } 00074 }
Here is the call graph for this function:
Here is the caller graph for this function:
Sprite* Button::GetSprite | ( | ) | [inline] |
void Button::SetSizePosition | ( | const Rectanglei & | rect | ) | [virtual] |
Implements Widget.
Definition at line 76 of file button.cpp.
00077 { 00078 StdSetSizePosition(rect); 00079 00080 if (img_scale) 00081 image->ScaleSize(size); 00082 }
Here is the call graph for this function:
Here is the caller graph for this function:
Sprite* Button::image [protected] |
bool Button::img_scale [protected] |