Key captures in cgame
Posted: Fri May 10, 2013 7:34 pm
Hey all,
I'm trying to add an introduction menu to display when a client initially connects to a server. It does a key capture, bringing up the cursor allowing you to click on a button to join the game. I'd got the menu loading, but ran into 2 problems:
1. the action events don't work (ie: if you click on a button it does nothing) among other things such as transition events
2. it blocks the main menu from opening when pressing esc
This is using TA's ui menu script code btw. Here's the main function that is accessed through CG_Draw2D(), pretty short and simple:
I've fiddled around for a while without success. I've tried the other key capture options to set it on a lower priority one than the main menu such as KEYCATCH_CGAME but then the game crashes. Loading it through the UI module with a system call had about the same result only that the scoreboard was blocked instead of the main menu - I'd like both to be accessible while the menu is showing. Is there something else that needs to be initialised? Anyone with a solution?
I'm trying to add an introduction menu to display when a client initially connects to a server. It does a key capture, bringing up the cursor allowing you to click on a button to join the game. I'd got the menu loading, but ran into 2 problems:
1. the action events don't work (ie: if you click on a button it does nothing) among other things such as transition events
2. it blocks the main menu from opening when pressing esc
This is using TA's ui menu script code btw. Here's the main function that is accessed through CG_Draw2D(), pretty short and simple:
Code: Select all
static qboolean CG_DrawIntro( void ) {
playerState_t *ps = &cg.predictedPlayerState;
if ( ps->persistant[PERS_TEAM] != TEAM_SPECTATOR ) return qfalse;
if ( ps->persistant[PERS_SPECTATOR] != SPECTATOR_INTRO ) return qfalse;
if ( menuIntro ) {
menuIntro->window.flags &= ~WINDOW_FORCED;
menuIntro->window.flags |= WINDOW_MOUSEOVER;
menuIntro->window.flags |= WINDOW_HASFOCUS;
}
menuIntro = Menus_FindByName( "joingame_menu" );
if ( menuIntro ) {
Menu_Paint( menuIntro, qtrue );
trap_Key_SetCatcher( KEYCATCH_UI );
}
//trap_ShowIntroMenu();
return qtrue;
}