本文整理汇总了C++中Key_GetCatcher函数的典型用法代码示例。如果您正苦于以下问题:C++ Key_GetCatcher函数的具体用法?C++ Key_GetCatcher怎么用?C++ Key_GetCatcher使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Key_GetCatcher函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
开发者ID:BigJohnJD,项目名称:Quake-III-132,代码行数:42,代码来源:cl_keys.c
示例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 );
}
}
开发者ID:BigJohnJD,项目名称:Quake-III-132,代码行数:32,代码来源:cl_keys.c
示例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;
}
}
开发者ID:Almightygir,项目名称:OpenJK,代码行数:39,代码来源:cl_input.cpp
示例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 );
}
}
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:29,代码来源:rocket.cpp
示例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 );
}
}
开发者ID:BigJohnJD,项目名称:Quake-III-132,代码行数:35,代码来源:cl_keys.c
示例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;
}
}
开发者ID:qrealka,项目名称:ioq3,代码行数:30,代码来源:cl_input.c
示例7: PortableInMenu
int PortableInMenu(void){
if ((Key_GetCatcher( ) & KEYCATCH_UI) ||
(Key_GetCatcher( ) & KEYCATCH_CONSOLE) )
return 1;
else
return 0;
}
开发者ID:emileb,项目名称:OpenJK,代码行数:9,代码来源:in_android.cpp
示例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;
}
}
开发者ID:Razish,项目名称:QtZ,代码行数:10,代码来源:cl_input.c
示例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;
}
}
开发者ID:qrealka,项目名称:ioq3,代码行数:15,代码来源:cl_input.c
示例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);
}
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:51,代码来源:cg_missioneditor.c
示例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 );
}
开发者ID:DarthFutuza,项目名称:JediKnightGalaxies,代码行数:19,代码来源:cl_console.cpp
示例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 );
}
开发者ID:LavenderMoon,项目名称:mint-arena,代码行数:12,代码来源:cg_consolecmds.c
示例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( );
}
开发者ID:AbandonedCart,项目名称:XperiaPlayNative,代码行数:33,代码来源:sdl_input.c
示例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" );
}
}
开发者ID:0culus,项目名称:ioq3,代码行数:40,代码来源:sdl_input.c
示例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;
}
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:7,代码来源:cg_missioneditor.c
示例16: IN_Frame
void
IN_Frame(void)
{
qbool 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(!cvargeti("r_fullscreen") && (Key_GetCatcher( ) & KEYCATCH_CONSOLE)){
/* Console is down in windowed mode */
IN_DeactivateMouse( );
}else if(!cvargeti("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 < sysmillisecs())){
vidRestartTime = 0;
cbufaddstr("vid_restart");
}
}
开发者ID:icanhas,项目名称:yantar,代码行数:29,代码来源:input.c
示例17: SCR_PrecacheScreenshot
void SCR_PrecacheScreenshot()
{
// No screenshots unless connected to single player local server...
//
// char *psInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ];
// int iMaxClients = atoi(Info_ValueForKey( psInfo, "sv_maxclients" ));
// (no need to check single-player status in voyager, this code base is all singleplayer)
if ( cls.state != CA_ACTIVE )
{
return;
}
if (!Key_GetCatcher( ))
{
// in-game...
//
// SCR_UnprecacheScreenshot();
// pbScreenData = (byte *)Z_Malloc(SG_SCR_WIDTH * SG_SCR_HEIGHT * 4);
S_ClearSoundBuffer(); // clear DMA etc because the following glReadPixels() call can take ages
re.GetScreenShot( (byte *) &bScreenData, SG_SCR_WIDTH, SG_SCR_HEIGHT);
screenDataValid = qtrue;
}
}
开发者ID:DustysPatch,项目名称:OpenJK,代码行数:25,代码来源:cl_scrn.cpp
示例18: IN_Frame
void IN_Frame (void) {
qboolean loading;
IN_JoyMove( );
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
loading = (qboolean)( cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE );
if( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
{
// Console is down in windowed mode
IN_DeactivateMouse( );
}
else if( !cls.glconfig.isFullscreen && loading )
{
// Loading in windowed mode
IN_DeactivateMouse( );
}
else if( !( SDL_GetWindowFlags( SDL_window ) & SDL_WINDOW_INPUT_FOCUS ) )
{
// Window not got focus
IN_DeactivateMouse( );
}
else
IN_ActivateMouse( );
IN_ProcessEvents( );
}
开发者ID:metivett,项目名称:OpenJK,代码行数:28,代码来源:sdl_input.cpp
示例19: IN_VoiceChat
void IN_VoiceChat (void) {
if ( !( Key_GetCatcher( ) & KEYCATCH_UI ) ) {
if ( clc.state == CA_ACTIVE && !clc.demoplaying ) {
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_VOICECHAT );
}
}
}
开发者ID:xScooper,项目名称:jkaq3,代码行数:7,代码来源:cl_input.c
示例20: IN_Frame
void IN_Frame(void)
{
qboolean loading;
qboolean fullscreen = qtrue;
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 (!fullscreen && ( (Key_GetCatcher() & KEYCATCH_CONSOLE) ||
loading || !SDL_GetWindowGrab(SDLvidscreen) ))
{
if (mouseActive)
IN_DeactivateMouse();
}
else
{
if (!mouseActive)
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");
}
}
开发者ID:NewsNoobDude,项目名称:RTCW-SP-linux,代码行数:30,代码来源:sdl2_input.c
注:本文中的Key_GetCatcher函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论