#include <Icon.h>
Inheritance diagram for Icon:
Public Methods | |
| Icon () | |
| Icon (Vec2D &ul, Vec2D &lr, ATexture img) | |
| const ATexture | image () const |
| void | setImage (ATexture img) |
| void | setBounds (const Vec2D &ul, const Vec2D &lr) |
| void | setHelpString (string s) |
| void | render () const |
| void | drawOutline (Vec3D color) const |
| void | drawHelpString () const |
| virtual const vector< Vec2D > & | bounds () const |
| returns the bounding points, pts[0] is upper left, pts[1] is lower right | |
| virtual bool | contains (const Vec2D &pt) const |
Protected Attributes | |
| Vec2D | m_ul |
| Vec2D | m_lr |
| vector< Vec2D > | m_bounds |
Private Attributes | |
| ATexture | m_img |
| Vec2D | m_center |
| Vec2D | m_size |
| string | m_helpString |
|
|
Definition at line 24 of file Icon.cpp. References Vec2D.
|
|
||||||||||||||||
|
Definition at line 31 of file Icon.cpp. References m_center, Rect::m_lr, m_size, and Rect::m_ul.
|
|
|
returns the bounding points, pts[0] is upper left, pts[1] is lower right
Definition at line 51 of file Rect.h. References Rect::m_bounds. Referenced by drawOutline(), HUD::render(), HUD::translateMiniMapToWorld(), HUD::translateWorldToMiniMap(), and Map::WorldMap::worldToGridCoord().
00051 { return m_bounds; }
|
|
|
Definition at line 42 of file Rect.cpp. References Rect::m_lr, and Rect::m_ul. Referenced by drawHelpString(), HUD::isButtonStopClicked(), MilitaryUnit::move(), Overhead::overheadRender(), HUD::processMiniMapInput(), Overhead::processOverheadInput(), HUD::processOverheadInput(), and HUD::render().
|
|
|
Definition at line 55 of file Icon.cpp. References Rect::contains(), input_getMouseX(), input_getMouseY(), overlay_rect(), overlay_text(), overlay_textOut(), UINT, and Vec2D. Referenced by Overhead::overheadRender(), and HUD::render().
00056 {
00057 //if( input_mouseIdleTime() < 0.3f ) return; // cursor must be idle at least 0.4 sec
00058
00059 Vec2D mousePos( input_getMouseX(), input_getMouseY() );
00060 if( !contains(mousePos) ) return; // cursor must be inside this icon
00061
00062 string s( m_helpString );
00063 if( s.length()==0 ) s = "No Help Yet\nFix me plz";
00064 int lineCount = 0;
00065 for( UINT i=0; i<s.length(); i++ )
00066 if( s[i] == '\n' ) lineCount++;
00067 if( s[s.length()-1] != '\n' ) lineCount++;
00068
00069 FLOAT width = 0.37f;
00070 FLOAT height = lineCount*0.037f;
00071 Vec2D drawPos( mousePos ); // top-left corner of help box
00072 if( mousePos.y > 0.98f-height ) drawPos.y -= height;
00073 if( mousePos.x > 0.98f-width ) drawPos.x -= width;
00074 Vec2D drawPos2( drawPos+Vec2D(width,height) ); // lower-right corner
00075
00076 overlay_rect( drawPos, drawPos2, true, Colors::gray, BlendModes::MIX, 0.7f, 7 );
00077 overlay_rect( drawPos, drawPos2, false, Colors::white, BlendModes::NONE, 1.0f, 7 );
00078 overlay_text() << s;
00079 overlay_textOut( drawPos+Vec2D(0.003f,0.003f), 1.0f, Colors::white, NULL, 7 );
00080 }
|
|
|
Definition at line 49 of file Icon.cpp. References Rect::bounds(), and overlay_rect(). Referenced by Overhead::overheadRender(), and HUD::render().
00050 {
00051 overlay_rect( bounds()[0], bounds()[1], false, color,
00052 BlendModes::NONE, 1.0f, 6 );
00053 }
|
|
|
Definition at line 49 of file Icon.h. References ATexture, and m_img.
00049 { return m_img; }
|
|
|
Definition at line 52 of file Icon.h. References overlay_image(). Referenced by HUD::render().
00052 { if(m_img) overlay_image(m_img, m_center, m_size, BlendModes::NONE, 1.0f, 6); }
|
|
||||||||||||
|
Reimplemented from Rect. Definition at line 39 of file Icon.cpp. References Rect::m_bounds, m_center, Rect::m_lr, m_size, and Rect::m_ul. Referenced by HUD::init().
|
|
|
Definition at line 51 of file Icon.h. References m_helpString. Referenced by HUD::init(), Overhead::overhead_init(), and Overhead::overheadRender().
00051 { m_helpString = s; }
|
|
|
Definition at line 50 of file Icon.h. References m_img. Referenced by HUD::init().
00050 { m_img = img; }
|
|
|
Definition at line 42 of file Rect.h. Referenced by Rect::bounds(), Rect::Rect(), Rect::setBounds(), and setBounds(). |
|
|
Definition at line 44 of file Icon.h. Referenced by Icon(), and setBounds(). |
|
|
Definition at line 46 of file Icon.h. Referenced by setHelpString(). |
|
|
Definition at line 43 of file Icon.h. Referenced by image(), and setImage(). |
|
|
Definition at line 41 of file Rect.h. Referenced by Rect::contains(), Icon(), Rect::Rect(), Rect::setBounds(), and setBounds(). |
|
|
Definition at line 45 of file Icon.h. Referenced by Icon(), and setBounds(). |
|
|
Definition at line 40 of file Rect.h. Referenced by Rect::contains(), Icon(), Rect::Rect(), Rect::setBounds(), and setBounds(). |
1.3-rc2