本文整理汇总了C++中Key_GetCatcher函数的典型用法代码示例。如果您正苦于以下问题:C++ Key_GetCatcher函数的具体用法?C++ Key_GetCatcher怎么用?C++ Key_GetCatcher使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Key_GetCatcher函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Message_Key
/*
================
Message_Key
In game talk message
================
*/
void Message_Key( int key ) {
char buffer[MAX_STRING_CHARS];
if (key == K_ESCAPE) {
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
Field_Clear( &chatField );
return;
}
if ( key == K_ENTER || key == K_KP_ENTER )
{
if ( chatField.buffer[0] && cls.state == CA_ACTIVE ) {
if (chat_playerNum != -1 )
Com_sprintf( buffer, sizeof( buffer ), "tell %i \"%s\"\n", chat_playerNum, chatField.buffer );
else if (chat_team)
Com_sprintf( buffer, sizeof( buffer ), "say_team \"%s\"\n", chatField.buffer );
else
Com_sprintf( buffer, sizeof( buffer ), "say \"%s\"\n", chatField.buffer );
CL_AddReliableCommand( buffer, qfalse );
}
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
Field_Clear( &chatField );
return;
}
Field_KeyDownEvent( &chatField, key );
}
示例2: CL_CharEvent
/*
===================
CL_CharEvent
Normal keyboard characters, already shifted / capslocked / etc
===================
*/
void CL_CharEvent( int key ) {
// delete is not a printable character and is
// otherwise handled by Field_KeyDownEvent
if ( key == 127 ) {
return;
}
// distribute the key down event to the apropriate handler
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
{
Field_CharEvent( &g_consoleField, key );
}
else if ( Key_GetCatcher( ) & KEYCATCH_UI )
{
VM_Call( uivm, UI_KEY_EVENT, key | K_CHAR_FLAG, qtrue );
}
else if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE )
{
Field_CharEvent( &chatField, key );
}
else if ( cls.state == CA_DISCONNECTED )
{
Field_CharEvent( &g_consoleField, key );
}
}
示例3: CL_CmdButtons
/*
==============
CL_CmdButtons
==============
*/
void CL_CmdButtons( usercmd_t *cmd ) {
int i;
//
// figure button bits
// send a button bit even if the key was pressed and released in
// less than a frame
//
for (i = 0 ; i < MAX_KBUTTONS ; i++) {
if ( in_buttons[i].active || in_buttons[i].wasPressed ) {
cmd->buttons |= 1 << i;
}
in_buttons[i].wasPressed = qfalse;
}
if (cmd->buttons & BUTTON_FORCEPOWER)
{ //check for transferring a use force to a use inventory...
if ((cmd->buttons & BUTTON_USE) || CL_NoUseableForce())
{ //it's pushed, remap it!
cmd->buttons &= ~BUTTON_FORCEPOWER;
cmd->buttons |= BUTTON_USE_HOLDABLE;
}
}
if ( Key_GetCatcher( ) ) {
cmd->buttons |= BUTTON_TALK;
}
// allow the game to know if any key at all is
// currently pressed, even if it isn't bound to anything
if ( kg.anykeydown && Key_GetCatcher( ) == 0 ) {
cmd->buttons |= BUTTON_ANY;
}
}
示例4: Rocket_RocketDebug_f
void Rocket_RocketDebug_f()
{
static bool init = false;
if ( !init )
{
Rocket::Debugger::Initialise(menuContext);
init = true;
}
Rocket::Debugger::SetVisible( !Rocket::Debugger::IsVisible() );
if ( Rocket::Debugger::IsVisible() )
{
if ( !Q_stricmp( Cmd_Argv( 1 ), "hud" ) )
{
Rocket::Debugger::SetContext( hudContext );
}
else
{
Rocket::Debugger::SetContext( menuContext );
}
Key_SetCatcher( Key_GetCatcher() | KEYCATCH_UI );
}
else
{
Key_SetCatcher( Key_GetCatcher() & ~KEYCATCH_UI );
}
}
示例5: CL_KeyUpEvent
/*
===================
CL_KeyUpEvent
Called by CL_KeyEvent to handle a keyrelease
===================
*/
void CL_KeyUpEvent( int key, unsigned time )
{
keys[key].repeats = 0;
keys[key].down = qfalse;
anykeydown--;
if (anykeydown < 0) {
anykeydown = 0;
}
// don't process key-up events for the console key
if ( key == K_CONSOLE || ( key == K_ESCAPE && keys[K_SHIFT].down ) )
return;
//
// key up events only perform actions if the game key binding is
// a button command (leading + sign). These will be processed even in
// console mode and menu mode, to keep the character from continuing
// an action started before a mode switch.
//
if( cls.state != CA_DISCONNECTED )
Key_ParseBinding( key, qfalse, time );
if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) {
VM_Call( uivm, UI_KEY_EVENT, key, qfalse );
} else if ( Key_GetCatcher( ) & KEYCATCH_CGAME && cgvm ) {
VM_Call( cgvm, CG_KEY_EVENT, key, qfalse );
}
}
示例6: CL_CmdButtons
/*
==============
CL_CmdButtons
==============
*/
static void CL_CmdButtons( usercmd_t *cmd ) {
int i;
//
// figure button bits
// send a button bit even if the key was pressed and released in
// less than a frame
//
for (i = 0 ; i < 15 ; i++) {
if ( in_buttons[i].active || in_buttons[i].wasPressed ) {
cmd->buttons |= 1 << i;
}
in_buttons[i].wasPressed = qfalse;
}
if ( Key_GetCatcher( ) ) {
cmd->buttons |= BUTTON_TALK;
}
// allow the game to know if any key at all is
// currently pressed, even if it isn't bound to anything
if ( anykeydown && Key_GetCatcher( ) == 0 ) {
cmd->buttons |= BUTTON_ANY;
}
}
示例7: PortableInMenu
int PortableInMenu(void){
if ((Key_GetCatcher( ) & KEYCATCH_UI) ||
(Key_GetCatcher( ) & KEYCATCH_CONSOLE) )
return 1;
else
return 0;
}
示例8: CL_MouseEvent
void CL_MouseEvent( int dx, int dy, int time ) {
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
ui->MouseEvent( dx, dy );
} else if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
cgame->MouseEvent( dx, dy );
} else {
cl.mouseDx[cl.mouseIndex] += dx;
cl.mouseDy[cl.mouseIndex] += dy;
}
}
示例9: CL_MouseEvent
/*
=================
CL_MouseEvent
=================
*/
void CL_MouseEvent( int dx, int dy, int time ) {
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
VM_Call( uivm, UI_MOUSE_EVENT, dx, dy );
} else if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
VM_Call (cgvm, CG_MOUSE_EVENT, dx, dy);
} else {
cl.mouseDx[cl.mouseIndex] += dx;
cl.mouseDy[cl.mouseIndex] += dy;
}
}
示例10: CG_Draw_IGME
void CG_Draw_IGME()
{
int i;
usercmd_t cmd;
int cmdNum;
IGME_vehicle_t* veh;
// check for selections
cmdNum = CL_GetCurrentCmdNumber();
CL_GetUserCmd( cmdNum, &cmd );
if( Key_IsDown(K_MOUSE1) && !Key_GetCatcher() ) {
if( (cgs.IGME.waypointmode && cgs.IGME.numWptSelections) ||
(!cgs.IGME.waypointmode && cgs.IGME.numSelections) ) {
Key_SetCatcher( KEYCATCH_CGAME );
cgs.IGME.dragmode = true;
}
} else if( (Key_IsDown(K_MOUSE3) || Key_IsDown(K_SPACE)) &&
cg.time >= cgs.IGME.selectionTime ) {
ME_CheckForSelection();
cgs.IGME.selectionTime = cg.time + 250;
} else if( Key_IsDown(K_BACKSPACE) && !Key_GetCatcher() && cg.time >= cgs.IGME.selectionTime ) {
ME_DeleteSelection();
cgs.IGME.selectionTime = cg.time + 250;
} else if( (cmd.buttons & BUTTON_GEAR) && cg.time >= cgs.IGME.selectionTime ) {
ME_ToggleWaypointMode();
cgs.IGME.selectionTime = cg.time + 250;
} else if( (cmd.buttons & BUTTON_INCREASE) && cgs.IGME.waypointmode &&
cg.time >= cgs.IGME.selectionTime ) {
ME_SpawnWaypoint();
cgs.IGME.selectionTime = cg.time + 250;
} else if( (cmd.buttons & BUTTON_DECREASE) && cgs.IGME.waypointmode &&
cg.time >= cgs.IGME.selectionTime ) {
ME_ToggleWaypointDisplay();
cgs.IGME.selectionTime = cg.time + 250;
} else if( !cgs.IGME.dragmode && Key_IsDown(K_CTRL) && Key_IsDown('c') &&
cg.time >= cgs.IGME.selectionTime ) {
ME_CopySelection();
cgs.IGME.selectionTime = cg.time + 500;
} else if( !cgs.IGME.dragmode && Key_IsDown(K_CTRL) && Key_IsDown('v') &&
cg.time >= cgs.IGME.selectionTime ) {
ME_PasteSelection();
cgs.IGME.selectionTime = cg.time + 500;
}
// draw vehicles
for( i = 0; i < IGME_MAX_VEHICLES; ++i ) {
veh = &cgs.IGME.vehicles[i];
if( !veh->active ) continue;
ME_DrawVehicle(veh);
}
}
示例11: Con_ToggleConsole_f
/*
================
Con_ToggleConsole_f
================
*/
void Con_ToggleConsole_f (void) {
// closing a full screen console restarts the demo loop
if ( cls.state == CA_DISCONNECTED && Key_GetCatcher( ) == KEYCATCH_CONSOLE ) {
CL_StartDemoLoop();
return;
}
if( con_autoclear->integer )
Field_Clear( &g_consoleField );
g_consoleField.widthInChars = g_console_field_width;
Con_ClearNotify ();
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_CONSOLE );
}
示例12: CG_MessageMode_f
/*
================
CG_MessageMode_f
================
*/
void CG_MessageMode_f( void ) {
Q_strncpyz( cg.messageCommand, "say", sizeof (cg.messageCommand) );
Q_strncpyz( cg.messagePrompt, "Say:", sizeof (cg.messagePrompt) );
MField_Clear( &cg.messageField );
cg.messageField.widthInChars = 30;
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
}
示例13: IN_Frame
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
qboolean loading;
IN_JoyMove( );
IN_ProcessEvents( );
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
loading = !!( cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE );
if( !r_fullscreen->integer && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
{
// Console is down in windowed mode
IN_DeactivateMouse( );
}
else if( !r_fullscreen->integer && loading )
{
// Loading in windowed mode
IN_DeactivateMouse( );
}
else if( !( SDL_GetAppState() & SDL_APPINPUTFOCUS ) )
{
// Window not got focus
IN_DeactivateMouse( );
}
else
IN_ActivateMouse( );
}
示例14: IN_Frame
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
qboolean loading;
IN_JoyMove( );
IN_ProcessEvents( );
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
loading = ( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE );
if( !Cvar_VariableIntegerValue("r_fullscreen") && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
{
// Console is down in windowed mode
IN_DeactivateMouse( );
}
else if( !Cvar_VariableIntegerValue("r_fullscreen") && loading )
{
// Loading in windowed mode
IN_DeactivateMouse( );
}
else if( !( SDL_GetAppState() & SDL_APPINPUTFOCUS ) )
{
// Window not got focus
IN_DeactivateMouse( );
}
else
IN_ActivateMouse( );
/* in case we had to delay actual restart of video system... */
if ( (vidRestartTime != 0) && (vidRestartTime < Sys_Milliseconds()) )
{
vidRestartTime = 0;
Cbuf_AddText( "vid_restart\n" );
}
}
示例15: ME_KeyEvent
void ME_KeyEvent(int key, bool down)
{
if( key == K_MOUSE1 && !down ) {
Key_SetCatcher( Key_GetCatcher() & ~KEYCATCH_CGAME );
cgs.IGME.dragmode = false;
}
}