#include <uMenu.h>
Public Member Functions | |
uMenuItem (uMenu *M, const tOutput &help) | |
virtual | ~uMenuItem () |
virtual tString | Help () |
virtual void | Render (REAL, REAL, REAL=1, bool=0) |
virtual void | RenderBackground () |
virtual void | LeftRight (int) |
virtual void | LeftRightRelease () |
virtual void | Enter () |
virtual bool | Event (SDL_Event &) |
virtual REAL | SpaceRight () |
int | GetID () |
virtual bool | IsSelectable () |
Protected Member Functions | |
void | DisplayText (REAL x, REAL y, const char *text, bool selected, REAL alpha=1, int center=0, int cursor=0, int cursorPos=0, rTextField::ColorMode colorMode=rTextField::COLOR_USE, float maxWidth=2.) |
void | DisplayTextSpecial (REAL x, REAL y, const char *text, bool selected, REAL alpha=1, int center=0) |
void | SetColor (bool selected, REAL alpha) |
Sets the color of text output for this menuitem. | |
Protected Attributes | |
uMenu * | menu |
tOutput | helpText |
Private Member Functions | |
uMenuItem () | |
Private Attributes | |
int | idnum |
Friends | |
class | uMenu |
Definition at line 137 of file uMenu.h.
virtual uMenuItem::~uMenuItem | ( | ) | [inline, virtual] |
void uMenuItem::DisplayText | ( | REAL | x, | |
REAL | y, | |||
const char * | text, | |||
bool | selected, | |||
REAL | alpha = 1 , |
|||
int | center = 0 , |
|||
int | cursor = 0 , |
|||
int | cursorPos = 0 , |
|||
rTextField::ColorMode | colorMode = rTextField::COLOR_USE , |
|||
float | maxWidth = 2. | |||
) | [protected] |
Definition at line 550 of file uMenu.cpp.
References rTextField::COLOR_USE, rTextField::GetTextLength(), REAL, SetColor(), sr_fontMenu, and sr_glOut.
Referenced by DisplayTextSpecial(), uMenuItemSelection< bool >::Render(), uMenuItemString::Render(), uMenuItemInt::Render(), ArmageTronPlayer_to_viewport_menuitem::Render(), and ArmageTron_viewport_menuitem::Render().
00553 { 00554 #ifndef DEDICATED 00555 if (sr_glOut){ 00556 SetColor( selected, alpha ); 00557 00558 REAL th = text_height; 00559 00560 REAL availw = 1.9f; 00561 if (center < 0) availw = (.9f-x); 00562 if (center > 0) availw = (x + .9f); 00563 if (availw > maxWidth) availw = maxWidth; 00564 00565 float usedwidth=rTextField::GetTextLength(tString(text), th, colorMode == rTextField::COLOR_USE); 00566 if (usedwidth > availw) 00567 { 00568 th *= availw/(usedwidth); 00569 } 00570 00571 ::DisplayText(x,y,th,text,sr_fontMenu,center,c,cp, colorMode); 00572 } 00573 #endif
void uMenuItem::DisplayTextSpecial | ( | REAL | x, | |
REAL | y, | |||
const char * | text, | |||
bool | selected, | |||
REAL | alpha = 1 , |
|||
int | center = 0 | |||
) | [protected] |
Definition at line 575 of file uMenu.cpp.
References DisplayText().
Referenced by uMenuItemExit::Render(), uMenuItemAction::Render(), uMenuItemSubmenu::Render(), gMenuItemPlayer::Render(), gMenuItemStatus::Render(), gMenuItemAutoSelect::Render(), gMenuItemSpectate::Render(), gMenuItemNewTeam::Render(), and gMenuItemPlayerTeam::Render().
00578 { 00579 /* 00580 if(selected) 00581 glColor3f(.9,.3,.3); 00582 else 00583 glColor3f(.7,.7,1); 00584 00585 ::DisplayText(x,y,text_width,text_height,text,center); 00586 */ 00587 00588 DisplayText(x,y,text,selected,alpha,center);
virtual tString uMenuItem::Help | ( | ) | [inline, virtual] |
Reimplemented in SwigDirector_UMenuItemAction, uMenuItemInput, uMenuItemSelection< T >, uMenuItemSelection< tString >, uMenuItemSelection< rScreenSize >, uMenuItemSelection< int >, uMenuItemSelection< Vote >, and uMenuItemSelection< bool >.
Definition at line 169 of file uMenu.h.
References helpText.
Reimplemented in eMenuItemPassword, SwigDirector_UMenuItemAction, ArmageTron_viewport_menuitem, ArmageTronPlayer_to_viewport_menuitem, gServerMenuItem, gServerStartMenuItem, gMenuItemPlayerTeam, gMenuItemNewTeam, gMenuItemSpectate, gMenuItemAutoSelect, gMenuItemSpacer, gMenuItemStatus, gMenuItemPlayer, uMenuItemInput, uMenuItemExit, uMenuItemSelection< T >, uMenuItemInt, uMenuItemString, uMenuItemStringWithHistory, uMenuItemSubmenu, uMenuItemAction, uMenuItemSelection< tString >, uMenuItemSelection< rScreenSize >, uMenuItemSelection< int >, uMenuItemSelection< Vote >, and uMenuItemSelection< bool >.
Definition at line 172 of file uMenu.h.
Referenced by gBrowserMenuItem::RenderBackground().
virtual void uMenuItem::RenderBackground | ( | ) | [inline, virtual] |
Reimplemented in SwigDirector_UMenuItemAction, ArmageTron_viewport_menuitem, ArmageTronPlayer_to_viewport_menuitem, ArmageTron_color_menuitem, gBrowserMenuItem, and gServerMenuItem.
Definition at line 174 of file uMenu.h.
References uMenu::GenericBackground(), and menu.
Referenced by ArmageTron_color_menuitem::RenderBackground(), ArmageTronPlayer_to_viewport_menuitem::RenderBackground(), and ArmageTron_viewport_menuitem::RenderBackground().
00174 { 00175 menu->GenericBackground(); 00176 };
virtual void uMenuItem::LeftRight | ( | int | ) | [inline, virtual] |
Reimplemented in SwigDirector_UMenuItemAction, ArmageTronPlayer_to_viewport_menuitem, uMenuItemSelection< T >, uMenuItemToggle, uMenuItemInt, uMenuItemSelection< tString >, uMenuItemSelection< rScreenSize >, uMenuItemSelection< int >, uMenuItemSelection< Vote >, and uMenuItemSelection< bool >.
Definition at line 179 of file uMenu.h.
virtual void uMenuItem::LeftRightRelease | ( | ) | [inline, virtual] |
virtual void uMenuItem::Enter | ( | ) | [inline, virtual] |
Reimplemented in eMenuItemKick, SwigDirector_UMenuItemAction, gServerMenuItem, gServerStartMenuItem, gMenuItemEditSubmenu, gMenuItemPlayerTeam, gMenuItemNewTeam, gMenuItemSpectate, gMenuItemAutoSelect, gMenuItemPlayer, uMenuItemInput, uMenuItemExit, uMenuItemToggle, uMenuItemSubmenu, uMenuItemAction, uMenuItemFunction, and uMenuItemFunctionInt.
Definition at line 182 of file uMenu.h.
virtual bool uMenuItem::Event | ( | SDL_Event & | ) | [inline, virtual] |
Reimplemented in eMenuItemUserName, eMenuItemPassword, eMenuItemChat, SwigDirector_UMenuItemAction, gMemuItemConsole, gBrowserMenuItem, gServerMenuItem, uMenuItemInput, uMenuItemString, and uMenuItemStringWithHistory.
Definition at line 184 of file uMenu.h.
Referenced by gBrowserMenuItem::Event().
virtual REAL uMenuItem::SpaceRight | ( | ) | [inline, virtual] |
Reimplemented in SwigDirector_UMenuItemAction, ArmageTron_viewport_menuitem, ArmageTronPlayer_to_viewport_menuitem, and ArmageTron_color_menuitem.
Definition at line 188 of file uMenu.h.
Referenced by _wrap_UMenuItem_space_right().
int uMenuItem::GetID | ( | ) | [inline] |
Definition at line 190 of file uMenu.h.
References idnum.
Referenced by _wrap_UMenuItem_get_id(), and gServerMenu::Update().
00190 {return idnum;}
virtual bool uMenuItem::IsSelectable | ( | ) | [inline, virtual] |
Reimplemented in SwigDirector_UMenuItemAction, gMenuItemSpacer, and gMenuItemStatus.
Definition at line 192 of file uMenu.h.
Referenced by _wrap_UMenuItem_is_selectable().
void uMenuItem::SetColor | ( | bool | selected, | |
REAL | alpha | |||
) | [protected] |
Sets the color of text output for this menuitem.
selected | flag indicating whether the menu item is currently selected | |
alpha | transparency to use |
Definition at line 536 of file uMenu.cpp.
References REAL, rTextField::SetBlendColor(), rTextField::SetDefaultColor(), sin(), and tSysTimeFloat().
Referenced by DisplayText(), gServerStartMenuItem::Render(), and gServerMenuItem::Render().
00538 { 00539 // rTextField::SetBlendColor( tColor(.8+.2*sin(time),.3-.1*sin(time),.3-.1*sin(time),alpha) ); 00540 rTextField::SetDefaultColor( tColor(1,1,1,alpha) ); 00541 00542 if (selected) 00543 { 00544 REAL time=tSysTimeFloat()*10; 00545 REAL intensity = 1+.3*sin(time); 00546 rTextField::SetDefaultColor( tColor(.8,.3,.3,alpha) ); 00547 rTextField::SetBlendColor( tColor(intensity,intensity,intensity,alpha) ); 00548 }
int uMenuItem::idnum [private] |
Definition at line 140 of file uMenu.h.
Referenced by uMenu::AddItem(), GetID(), uMenu::RemoveItem(), uMenu::ReverseItems(), uMenuItem(), and ~uMenuItem().
uMenu* uMenuItem::menu [protected] |
Definition at line 141 of file uMenu.h.
Referenced by uMenuItemExit::Enter(), gMenuItemAutoSelect::Enter(), gMenuItemSpectate::Enter(), gMenuItemNewTeam::Enter(), gMenuItemPlayerTeam::Enter(), gMenuItemEditSubmenu::Enter(), gServerStartMenuItem::Enter(), gServerMenuItem::Enter(), gServerMenuItem::Event(), uMenuItemString::MyMenu(), gServerStartMenuItem::Render(), gServerMenuItem::Render(), RenderBackground(), gBrowserMenuItem::RenderBackground(), uMenuItem(), gServerMenuItem::~gServerMenuItem(), and ~uMenuItem().
tOutput uMenuItem::helpText [protected] |
Definition at line 144 of file uMenu.h.
Referenced by uMenuItemSelection< bool >::Help(), Help(), eVoteItem::UpdateMenuItem(), and eVoteItem::~eVoteItem().