#include <uMenu.h>
Public Member Functions | |
FUNCPTR | IdleFunc () |
void | SetCenter (REAL c) |
void | SetTop (REAL t) |
void | SetBot (REAL b) |
void | SetSelected (int s) |
int | NumItems () |
uMenuItem * | Item (int i) |
void | AddItem (uMenuItem *item) |
void | RemoveItem (uMenuItem *item) |
uMenu (const tOutput &t, bool exit_item=true) | |
virtual | ~uMenu () |
void | Enter () |
enters the menu; calls idle_func before rendering every frame | |
void | ReverseItems () |
void | Exit () |
void | RequestSpaceBelow (REAL x) |
Static Public Member Functions | |
static void | SetIdle (FUNCPTR idle_func) |
static bool | IdleInput () |
static void | GenericBackground () |
static bool | Message (const tOutput &message, const tOutput &interpretation, REAL timeout=-1) |
static bool | MenuActive () |
returns whether there is currently an active menu | |
Public Attributes | |
tOutput | title |
Static Public Attributes | |
static bool | wrap = true |
static bool | quickexit = false |
static bool | exitToMain = false |
Protected Member Functions | |
REAL | YPos (int num) |
virtual void | HandleEvent (SDL_Event event) |
handles a key press | |
virtual void | OnEnter () |
enters the menu; calls idle_func before rendering every frame | |
virtual void | OnExit () |
marks the menu for exit | |
int | GetNextSelectable (int start) |
int | GetPrevSelectable (int start) |
virtual void | OnRender () |
called every frame before the menu is rendered | |
Protected Attributes | |
tList< uMenuItem > | items |
REAL | menuTop |
REAL | menuBot |
REAL | yOffset |
bool | exitFlag |
REAL | spaceBelow |
REAL | center |
int | selected |
Static Protected Attributes | |
static FUNCPTR | idle |
Friends | |
class | uMenuItem |
Definition at line 49 of file uMenu.h.
uMenu::uMenu | ( | const tOutput & | t, | |
bool | exit_item = true | |||
) |
uMenu::~uMenu | ( | ) | [virtual] |
REAL uMenu::YPos | ( | int | num | ) | [protected] |
Definition at line 110 of file uMenu.cpp.
References yOffset.
Referenced by OnEnter().
00110 { 00111 return yOffset-text_height*(menuentries-num); 00112 }
FUNCPTR uMenu::IdleFunc | ( | ) | [inline] |
static void uMenu::SetIdle | ( | FUNCPTR | idle_func | ) | [inline, static] |
Definition at line 76 of file uMenu.h.
References idle.
Referenced by _wrap_UMenu_set_idle(), HandleEvent(), main(), Message(), and ret_to_MainMenu().
00076 {idle=idle_func;}
bool uMenu::IdleInput | ( | ) | [static] |
Definition at line 1327 of file uMenu.cpp.
References event, su_GetSDLInput(), and tSysTimeFloat().
Referenced by main().
01330 { 01331 #ifndef DEDICATED 01332 SDL_Event event; 01333 uInputProcessGuard inputProcessGuard; 01334 while (su_GetSDLInput(event)) 01335 { 01336 switch (event.type) 01337 { 01338 case SDL_KEYDOWN: 01339 switch (event.key.keysym.sym) 01340 { 01341 case(SDLK_ESCAPE): 01342 repeat = false; 01343 lastkey=tSysTimeFloat(); 01344 return true; 01345 break; 01346 default: 01347 break; 01348 } 01349 default: 01350 break; 01351 } 01352 } 01353 #endif 01354
void uMenu::SetCenter | ( | REAL | c | ) | [inline] |
void uMenu::SetTop | ( | REAL | t | ) | [inline] |
void uMenu::SetBot | ( | REAL | b | ) | [inline] |
Definition at line 83 of file uMenu.h.
References menuBot, and spaceBelow.
Referenced by do_chat(), and do_con().
00083 {menuBot=b;spaceBelow=1+menuBot;}
void uMenu::SetSelected | ( | int | s | ) | [inline] |
Definition at line 84 of file uMenu.h.
References selected.
Referenced by PasswordCallback(), and sg_HostGameMenu().
00084 {selected = s;}
int uMenu::NumItems | ( | ) | [inline] |
Definition at line 85 of file uMenu.h.
References items, and GrowingArrayBase::Len().
Referenced by _wrap_UMenu_num_items(), sg_ClearConnectionItems(), and gServerMenuItem::~gServerMenuItem().
uMenuItem* uMenu::Item | ( | int | i | ) | [inline] |
Definition at line 86 of file uMenu.h.
References items.
Referenced by sg_ClearConnectionItems(), and gServerMenuItem::~gServerMenuItem().
00086 { return items[i]; }
void uMenu::AddItem | ( | uMenuItem * | item | ) | [inline] |
Definition at line 610 of file uMenu.h.
References tList< T, MALLOC, REFERENCE >::Add(), uMenuItem::idnum, and items.
Referenced by gServerMenuItem::~gServerMenuItem().
void uMenu::RemoveItem | ( | uMenuItem * | item | ) | [inline] |
Definition at line 611 of file uMenu.h.
References uMenuItem::idnum, items, and tList< T, MALLOC, REFERENCE >::Remove().
Referenced by gServerMenuItem::~gServerMenuItem().
void uMenu::Enter | ( | ) | [inline] |
enters the menu; calls idle_func before rendering every frame
Definition at line 97 of file uMenu.h.
References OnEnter().
Referenced by gServerBrowser::BrowseServers(), gServerFavorites::CustomConnectMenu(), do_chat(), do_con(), gMenuItemPlayer::Enter(), gFriends::FriendsMenu(), eVoter::KickMenu(), MainMenu(), gGameSettings::Menu(), net_game(), net_options(), PasswordCallback(), ePlayerNetID::PoliceMenu(), s_InputConfigGeneric(), se_SoundMenu(), sg_EditServers(), sg_FavoritesMenu(), sg_HostGameMenu(), sg_LanguageMenu(), sg_PlayerMenu(), sg_ScreenModeMenu(), ePlayerNetID::SilenceMenu(), gTeam::TeamMenu(), viewport_menu_x(), and eVoter::VotingMenu().
00097 {OnEnter();}
void uMenu::ReverseItems | ( | ) |
Definition at line 89 of file uMenu.cpp.
References tList< T, MALLOC, REFERENCE >::Add(), uMenuItem::idnum, items, GrowingArrayBase::Len(), tList< T, MALLOC, REFERENCE >::Remove(), tArray< T, MALLOC >::SetLen(), and x.
Referenced by gServerMenu::gServerMenu(), s_InputConfigGeneric(), sg_HostGameMenu(), and gServerMenu::Update().
00089 { 00090 tList<uMenuItem> dummy = items; 00091 items.SetLen(0); 00092 00093 for (int i=dummy.Len()-1; i>=0; i--){ 00094 uMenuItem *x = dummy[i]; 00095 dummy.Remove(x, x->idnum); 00096 items.Add (x, x->idnum); 00097 } 00098 }
void uMenu::GenericBackground | ( | ) | [static] |
Definition at line 488 of file uMenu.cpp.
References idle, uCallbackMenuBackground::MenuBackground(), sr_glOut, sr_ResetRenderState(), and tDelay().
Referenced by _wrap_UMenu_generic_background(), Message(), uMenuItem::RenderBackground(), gBrowserMenuItem::RenderBackground(), and welcome().
00489 { 00490 #ifndef DEDICATED 00491 if (idle) 00492 { 00493 try 00494 { 00495 // throw tGenericException("test"); // (test exception throw to see if error handling works right) 00496 (*idle)(); 00497 } 00498 catch ( ... ) 00499 { 00500 // the idle background function is broken. Disable it and rethrow. 00501 idle = 0; 00502 throw; 00503 } 00504 } 00505 else if (sr_glOut){ 00506 uCallbackMenuBackground::MenuBackground(); 00507 } 00508 else 00509 tDelay(100000); 00510 #endif 00511 sr_ResetRenderState(true);
void uMenu::Exit | ( | ) | [inline] |
Definition at line 105 of file uMenu.h.
References OnExit().
Referenced by uMenuItemExit::Enter(), gMenuItemAutoSelect::Enter(), gMenuItemSpectate::Enter(), gMenuItemNewTeam::Enter(), gMenuItemPlayerTeam::Enter(), gMenuItemEditSubmenu::Enter(), gServerStartMenuItem::Enter(), gServerMenuItem::Enter(), gMemuItemConsole::Event(), HandleEvent(), PlayerLogIn(), ret_to_MainMenu(), and se_Cleanup().
00105 {OnExit();}
void uMenu::RequestSpaceBelow | ( | REAL | x | ) | [inline] |
Definition at line 107 of file uMenu.h.
References spaceBelow.
Referenced by ArmageTron_color_menuitem::ArmageTron_color_menuitem(), ArmageTron_viewport_menuitem::ArmageTron_viewport_menuitem(), and ArmageTronPlayer_to_viewport_menuitem::ArmageTronPlayer_to_viewport_menuitem().
00107 { 00108 if (spaceBelow<x) 00109 spaceBelow=x; 00110 }
bool uMenu::Message | ( | const tOutput & | message, | |
const tOutput & | interpretation, | |||
REAL | timeout = -1 | |||
) | [static] |
Definition at line 1357 of file uMenu.cpp.
References c, rSysDep::ClearGL(), Color(), con, DisplayText(), rTextField::EnableLineWrap(), GenericBackground(), idle, tString::Len(), NULL, quickexit, REAL, rViewport::s_viewportFullscreen, rViewport::Select(), rTextField::SetBlendColor(), rTextField::SetDefaultColor(), SetIdle(), sr_fontError, sr_glOut, sr_ResetRenderState(), sr_textOut, su_GetSDLInput(), tString::SubStr(), rSysDep::SwapGL(), tAdvanceFrame(), tSysTimeFloat(), and rITexture::UnloadAll().
Referenced by _wrap_UMenu_message__SWIG_0(), _wrap_UMenu_message__SWIG_1(), and main().
01358 : false only if the user pressed ESC 01359 bool uMenu::Message(const tOutput& message, const tOutput& interpretation, REAL to){ 01360 bool ret = true; 01361 #ifdef DEDICATED 01362 con << message << ":\n"; 01363 con << interpretation << '\n'; 01364 #else 01365 // reload textures (just in case) 01366 rITexture::UnloadAll(); 01367 01368 tAdvanceFrame(); 01369 01370 bool textOutBack = sr_textOut; 01371 sr_textOut = false; 01372 01373 FUNCPTR idle_back = idle; 01374 uMenu::SetIdle(NULL); 01375 01376 rTextField::SetDefaultColor( tColor(1,1,1,1) ); 01377 rTextField::SetBlendColor( tColor(1,1,1,1) ); 01378 01379 rSysDep::ClearGL(); 01380 rSysDep::SwapGL(); 01381 // if (sr_glOut) 01382 // { 01383 // rFont::s_defaultFont.Select(); 01384 // rFont::s_defaultFontSmall.Select(); 01385 // } 01386 rSysDep::ClearGL(); 01387 rSysDep::SwapGL(); 01388 01389 REAL timeout = tSysTimeFloat() + to; 01390 SDL_Event tEvent; 01391 01392 // catch some keyboard input 01393 { 01394 uInputProcessGuard inputProcessGuard; 01395 while (su_GetSDLInput(tEvent)); 01396 } 01397 01398 { 01399 uInputProcessGuard inputProcessGuard; 01400 01401 unsigned offset = 0; //amount of scrolling taking place 01402 //convert to an array for scrolling 01403 tString interpretationString; 01404 interpretationString << interpretation << "\n"; 01405 std::vector<tString> lines; 01406 int lastNewline = 0; 01407 for (int i = 0; i < interpretationString.Len() - 1; ++i) { 01408 if (interpretationString[i] == '\n' && i != 0) { 01409 lines.push_back(interpretationString.SubStr(lastNewline, i - lastNewline)); 01410 lastNewline = i + 1; 01411 } 01412 } 01413 while ( !quickexit && 01414 (to < 0 || tSysTimeFloat() < timeout)){ 01415 //while( !quickexit && ( !su_GetSDLInput(tEvent) || tEvent.type!=SDL_KEYDOWN) && 01416 // (to < 0 || tSysTimeFloat() < timeout)){ 01417 if ( su_GetSDLInput(tEvent) && tEvent.type==SDL_KEYDOWN) { 01418 switch (tEvent.key.keysym.sym) { 01419 case SDLK_UP: 01420 if (offset > 0) 01421 offset -= 1; 01422 continue; 01423 case SDLK_DOWN: 01424 offset += 1; 01425 continue; 01426 case SDLK_ESCAPE: 01427 ret = false; 01428 break; 01429 default: 01430 break; 01431 } 01432 break; 01433 } 01434 if ( sr_glOut ) 01435 { 01436 sr_ResetRenderState(true); 01437 rViewport::s_viewportFullscreen.Select(); 01438 01439 rSysDep::ClearGL(); 01440 01441 GenericBackground(); 01442 01443 REAL w=16*3/640.0; 01444 REAL h=32*3/480.0; 01445 01446 01447 //REAL middle=-.6; 01448 01449 tString m(message); 01450 int len = m.Len(); 01451 if (w * len > 1.8) 01452 { 01453 h = h * 1.8 / (w * len); 01454 w = 1.8 / len; 01455 } 01456 01457 Color(1,1,1); 01458 DisplayText(0,.8,w,message,sr_fontError); 01459 01460 w = 16/640.0; 01461 h = 32/480.0; 01462 01463 if (offset >= lines.size()) offset = lines.size() - 1; 01464 { 01465 rTextField c(-.8,.6, h, sr_fontError); 01466 c.EnableLineWrap(); 01467 01468 for (unsigned i = offset; i < lines.size(); ++i) 01469 c << lines[i] << "\n"; 01470 } 01471 } 01472 rSysDep::SwapGL(); 01473 tAdvanceFrame(); 01474 } 01475 } 01476 01477 // catch some keyboard input 01478 { 01479 uInputProcessGuard inputProcessGuard; 01480 while (su_GetSDLInput(tEvent)); 01481 } 01482 01483 uMenu::SetIdle(idle_back); 01484 01485 // reload textures (just in case) 01486 rITexture::UnloadAll(); 01487 01488 sr_textOut = textOutBack; 01489 #endif 01490
bool uMenu::MenuActive | ( | ) | [static] |
returns whether there is currently an active menu
Definition at line 140 of file uMenu.cpp.
Referenced by _wrap_UMenu_menu_active(), and sg_VoteMenuIdle().
00141 { 00142 return su_inMenu; 00143 }
void uMenu::HandleEvent | ( | SDL_Event | event | ) | [protected, virtual] |
handles a key press
Reimplemented in gServerMenu.
Definition at line 351 of file uMenu.cpp.
References Exit(), tException::GetDescription(), tException::GetName(), GetNextSelectable(), GetPrevSelectable(), items, tConsole::Message(), NULL, selected, SetIdle(), su_HandleEvent(), and tSysTimeFloat().
Referenced by gServerMenu::HandleEvent(), and OnEnter().
00353 { 00354 #ifndef DEDICATED 00355 if (!items[selected]->Event(event)) 00356 { 00357 // int newSelected = -1; 00358 switch (event.type){ 00359 case SDL_KEYDOWN: 00360 { 00361 if (!disphelp) 00362 lastkey=tSysTimeFloat(); 00363 switch (event.key.keysym.sym){ 00364 00365 case(SDLK_ESCAPE): 00366 repeat = false; 00367 lastkey=tSysTimeFloat(); 00368 Exit(); 00369 break; 00370 00371 case(SDLK_UP): 00372 lastkey=tSysTimeFloat(); 00373 selected = GetNextSelectable(selected); 00374 break; 00375 case(SDLK_DOWN): 00376 lastkey=tSysTimeFloat(); 00377 selected = GetPrevSelectable(selected); 00378 break; 00379 00380 case(SDLK_LEFT): 00381 items[selected]->LeftRight(-1); 00382 break; 00383 case(SDLK_RIGHT): 00384 items[selected]->LeftRight(1); 00385 break; 00386 00387 case(SDLK_SPACE): 00388 case(SDLK_KP_ENTER): 00389 case(SDLK_RETURN): 00390 repeat = false; 00391 try 00392 { 00393 su_inMenu = false; 00394 items[selected]->Enter(); 00395 } 00396 catch (tException const & e) 00397 { 00398 uMenu::SetIdle(NULL); 00399 00400 // inform user of generic errors 00401 tConsole::Message( e.GetName(), e.GetDescription(), 20 ); 00402 } 00403 #ifdef _MSC_VER 00404 #pragma warning ( disable : 4286 ) 00405 // GRR. Visual C++ dones not handle generic exceptions with the above general statement. 00406 // A specialized version is needed. The best part: it warns about the code below being redundant. 00407 catch ( tGenericException const & e ) 00408 { 00409 try 00410 { 00411 tConsole::Message( e.GetName(), e.GetDescription(), 20 ); 00412 } 00413 catch (...) 00414 { 00415 } 00416 } 00417 #endif 00418 00419 su_inMenu = true; 00420 00421 repeat = false; 00422 lastkey=tSysTimeFloat(); 00423 break; 00424 00425 default: 00426 // let the input subsystem handle events for later processing 00427 su_HandleEvent( event, true ); 00428 break; 00429 } 00430 } 00431 break; 00432 default: 00433 // let the input subsystem handle events for later processing 00434 su_HandleEvent( event, true ); 00435 break; 00436 } 00437 } 00438 00439 su_inMenu = true; 00440 #endif
void uMenu::OnEnter | ( | ) | [protected, virtual] |
enters the menu; calls idle_func before rendering every frame
Definition at line 147 of file uMenu.cpp.
References arrow(), b, c, center, rSysDep::ClearGL(), Color(), DisplayText(), rTextField::EnableLineWrap(), exitFlag, exitToMain, GetPrevSelectable(), HandleEvent(), items, GrowingArrayBase::Len(), menuBot, uCallbackMenuEnter::MenuEnter(), uCallbackMenuLeave::MenuLeave(), menuTop, OnRender(), quickexit, rCHEIGHT_NORMAL, REAL, selected, rTextField::SetBlendColor(), rTextField::SetDefaultColor(), rTextField::SetWidth(), spaceBelow, sr_alphaBlend, sr_fontMenu, sr_fontMenuTitle, sr_glOut, sr_ResetRenderState(), st_DoToDo(), su_ClearKeys(), su_GetSDLInput(), rSysDep::SwapGL(), tAdvanceFrame(), tDelay(), title, ts, tSysTimeFloat(), yOffset, and YPos().
Referenced by Enter().
00147 { 00148 #ifndef DEDICATED 00149 float nextrepeat = 0.0f; 00150 static const float repeatdelay = 0.3f; 00151 static const float repeatrate = 0.05f; 00152 SDL_Event tEventRepeat; 00153 #else 00154 return; 00155 #endif 00156 00157 // delete stuck keys, maybe a menu item catches key release events. 00158 su_ClearKeys(); 00159 00160 uCallbackMenuEnter::MenuEnter(); 00161 su_inMenu = true; 00162 00163 if (items.Len()<=0) 00164 return; 00165 00166 exitFlag=0; 00167 yOffset=menuTop; 00168 REAL lastt=0; 00169 REAL ts=0; 00170 00171 #ifndef DEDICATED 00172 lastkey=tSysTimeFloat(); 00173 static const REAL timeout=3; 00174 #endif 00175 // inverted logic (0 = last item! prev(0) = top most item) 00176 selected = GetPrevSelectable(0); 00177 while (!exitFlag && !quickexit && !exitToMain){ 00178 st_DoToDo(); 00179 tAdvanceFrame(); 00180 00181 ts=tSysTimeFloat()-lastt; 00182 lastt=tSysTimeFloat(); 00183 if (ts>.2) ts=.2; 00184 00185 menuentries=items.Len(); 00186 00187 // clamp cursor 00188 if (selected < 0 ) 00189 selected = 0; 00190 if ( selected >= items.Len()) 00191 selected = items.Len()-1; 00192 00193 #ifndef DEDICATED 00194 { 00195 SDL_Event tEvent; 00196 uInputProcessGuard inputProcessGuard; 00197 while (su_GetSDLInput(tEvent)) 00198 { 00199 REAL entertime = tSysTimeFloat(); 00200 00201 switch (tEvent.type) 00202 { 00203 case SDL_KEYDOWN: 00204 repeat = true; 00205 memcpy( &tEventRepeat, &tEvent, sizeof( SDL_Event ) ); 00206 nextrepeat = tSysTimeFloat() + repeatdelay; 00207 break; 00208 case SDL_KEYUP: 00209 repeat = false; 00210 break; 00211 } 00212 00213 this->HandleEvent( tEvent ); 00214 00215 // quit shortcut 00216 if ( quickexit ) 00217 break; 00218 00219 if ( tSysTimeFloat() - entertime > 1 ) 00220 { 00221 repeat = false; 00222 } 00223 } 00224 00225 if ( repeat && tSysTimeFloat() > nextrepeat ) 00226 { 00227 this->HandleEvent( tEventRepeat ); 00228 nextrepeat = tSysTimeFloat() + repeatrate; 00229 } 00230 } 00231 00232 // we're about to render, last chance to make changes to the menu 00233 OnRender(); 00234 00235 // clamp cursor 00236 if (selected < 0 ) 00237 selected = 0; 00238 if ( selected >= items.Len()) 00239 selected = items.Len()-1; 00240 #endif 00241 // quit shortcut 00242 if ( quickexit ) 00243 break; 00244 00245 00246 menuBot=-1+spaceBelow; 00247 00248 const REAL border=.3; 00249 const REAL smallborder=.1; 00250 00251 menuentries=items.Len(); 00252 00253 REAL ysel=YPos(selected); 00254 00255 if (ysel<menuBot+border) 00256 yOffset+=(menuBot+border-ysel)*6*ts; 00257 00258 if (ysel>menuTop-border) 00259 yOffset+=(menuTop-border-ysel)*6*ts; 00260 00261 if (ysel<menuBot) 00262 yOffset+=(menuBot-ysel); 00263 00264 if (ysel>menuTop-smallborder) 00265 yOffset+=(menuTop-smallborder-ysel); 00266 00267 if (YPos(0)>menuBot+smallborder) 00268 yOffset+=menuBot+smallborder-YPos(0); 00269 00270 if (YPos(menuentries-1)<menuTop-smallborder) 00271 yOffset+=menuTop-smallborder-YPos(menuentries-1); 00272 00273 #ifndef DEDICATED 00274 sr_ResetRenderState(true); 00275 items[selected]->RenderBackground(); 00276 00277 if (selected >= items.Len()) selected = items.Len()-1; 00278 if (items.Len() <= 0) 00279 return; 00280 00281 if (sr_glOut && !exitFlag && !quickexit){ 00282 items[selected]->Render(center,YPos(selected),1,true); 00283 00284 for (int i=items.Len()-1;i>=0;i--) 00285 if (i!=selected){ 00286 REAL y=YPos(i); 00287 REAL alpha=1; 00288 const REAL b=.1; 00289 if (y<menuBot+b) 00290 alpha=(y-menuBot)/b; 00291 if (y>menuTop-b) 00292 alpha=(menuTop-y)/b; 00293 if (y>menuBot && y<menuTop) 00294 { 00295 rTextField::SetDefaultColor( tColor(1,1,1,1) ); 00296 rTextField::SetBlendColor( tColor(1,1,1,1) ); 00297 items[i]->Render(center,y,alpha,false); 00298 } 00299 } 00300 00301 rTextField::SetDefaultColor( tColor(1,1,1,1) ); 00302 rTextField::SetBlendColor( tColor(1,1,1,1) ); 00303 00304 Color(.6,.6,1,1); 00305 ::DisplayText(0,menuTop+text_height*titlefac 00306 ,text_height*titlefac, 00307 title,sr_fontMenuTitle,0); 00308 00309 glDisable(GL_TEXTURE_2D); 00310 //glDisable(GL_TEXTURE); 00311 Color(1,.2,.2,.5); 00312 if (YPos(0)<menuBot+smallborder && (int(tSysTimeFloat()))%2) 00313 arrow(.9,menuBot+.1,-1,.05); 00314 if (YPos(menuentries-1)>menuTop && (int(tSysTimeFloat())+1)%2) 00315 arrow(.9,menuTop,1,.05); 00316 00317 if (tSysTimeFloat()-lastkey>timeout){ 00318 disphelp=true; 00319 if (sr_alphaBlend) 00320 glColor4f(1,.8,.8,tSysTimeFloat()-lastkey-timeout); 00321 else 00322 Color(tSysTimeFloat()-lastkey-timeout, 00323 .8*(tSysTimeFloat()-lastkey-timeout), 00324 .8*(tSysTimeFloat()-lastkey-timeout)); 00325 00326 rTextField c(-.95f,menuBot-.04f,rCHEIGHT_NORMAL, sr_fontMenu); 00327 c.SetWidth(1.9f-items[selected]->SpaceRight()); 00328 c.EnableLineWrap(); 00329 c << items[selected]->Help(); 00330 } 00331 else disphelp=false; 00332 } 00333 else 00334 #endif 00335 if ( !sr_glOut ) 00336 { 00337 tDelay( 10000 ); 00338 } 00339 00340 #ifndef DEDICATED 00341 rSysDep::SwapGL(); 00342 rSysDep::ClearGL(); 00343 #endif 00344 } 00345 00346 repeat = false; 00347 00348 uCallbackMenuLeave::MenuLeave(); 00349 su_inMenu = false;
void uMenu::OnExit | ( | ) | [protected, virtual] |
int uMenu::GetNextSelectable | ( | int | start | ) | [protected] |
Definition at line 465 of file uMenu.cpp.
References items, and GrowingArrayBase::Len().
Referenced by HandleEvent().
00467 { 00468 int next = start+1; 00469 while (next!=start) 00470 { 00471 if (next>=items.Len()) 00472 { 00473 if (this->wrap) 00474 next = 0; 00475 else 00476 break; 00477 } 00478 if (items[next]->IsSelectable()) 00479 { 00480 return next; 00481 } 00482 next++; 00483 } 00484 return start;
int uMenu::GetPrevSelectable | ( | int | start | ) | [protected] |
Definition at line 443 of file uMenu.cpp.
References items, GrowingArrayBase::Len(), and wrap.
Referenced by HandleEvent(), and OnEnter().
00445 { 00446 int prev = start-1; 00447 while (prev!=start) 00448 { 00449 if (prev<0) 00450 { 00451 if (wrap) 00452 prev = items.Len()-1; 00453 else 00454 break; 00455 } 00456 if (items[prev]->IsSelectable()) 00457 { 00458 return prev; 00459 } 00460 prev--; 00461 } 00462 return start;
void uMenu::OnRender | ( | ) | [protected, virtual] |
called every frame before the menu is rendered
Reimplemented in gServerMenu.
Definition at line 519 of file uMenu.cpp.
Referenced by OnEnter(), and gServerMenu::OnRender().
tList<uMenuItem> uMenu::items [protected] |
Definition at line 53 of file uMenu.h.
Referenced by AddItem(), GetNextSelectable(), GetPrevSelectable(), gServerMenu::gServerMenu(), HandleEvent(), Item(), NumItems(), OnEnter(), RemoveItem(), ReverseItems(), uMenuItem::uMenuItem(), gServerMenu::Update(), gServerMenu::~gServerMenu(), ~uMenu(), and uMenuItem::~uMenuItem().
FUNCPTR uMenu::idle [static, protected] |
Definition at line 54 of file uMenu.h.
Referenced by GenericBackground(), IdleFunc(), Message(), and SetIdle().
REAL uMenu::menuTop [protected] |
REAL uMenu::menuBot [protected] |
REAL uMenu::yOffset [protected] |
bool uMenu::exitFlag [protected] |
REAL uMenu::spaceBelow [protected] |
REAL uMenu::center [protected] |
int uMenu::selected [protected] |
Definition at line 65 of file uMenu.h.
Referenced by gServerMenu::gServerMenu(), HandleEvent(), OnEnter(), SetSelected(), uMenu(), and gServerMenu::Update().
bool uMenu::wrap = true [static] |
Definition at line 69 of file uMenu.h.
Referenced by GetPrevSelectable(), MainMenu(), UMenu_wrap_get(), and UMenu_wrap_set().
bool uMenu::quickexit = false [static] |
Definition at line 70 of file uMenu.h.
Referenced by ConnectToServerCore(), filter(), GameLoop(), main(), Message(), gGame::NetSync(), OnEnter(), SDLMain::quit:, sg_HostGame(), su_GetSDLInput(), SDLApplication::terminate:, UMenu_quickexit_get(), and UMenu_quickexit_set().
bool uMenu::exitToMain = false [static] |
Definition at line 71 of file uMenu.h.
Referenced by OnEnter(), UMenu_exitToMain_get(), and UMenu_exitToMain_set().