当前位置: 首页>>代码示例>>C++>>正文


C++ Sys_QueEvent函数代码示例

本文整理汇总了C++中Sys_QueEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ Sys_QueEvent函数的具体用法?C++ Sys_QueEvent怎么用?C++ Sys_QueEvent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Sys_QueEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Sys_GetEvent

/*
================
Sys_GetEvent

================
*/
sysEvent_t Sys_GetEvent( void ) {
	sysEvent_t	ev;
	char		*s;
	msg_t		netmsg;
	netadr_t	adr;

	// return if we have data
	if ( eventHead > eventTail ) {
		eventTail++;
		return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
	}

	// pump the message loop
	// in vga this calls KBD_Update, under X, it calls GetEvent
	Sys_SendKeyEvents ();

	// check for console commands
	s = Sys_ConsoleInput();
	if ( s ) {
		char	*b;
		int		len;

		len = strlen( s ) + 1;
		b = (char *)malloc( len );
		strcpy( b, s );
		Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
	}

	// check for other input devices
	IN_Frame();

	// check for network packets
	MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
#if 0
	if ( Sys_GetPacket ( &adr, &netmsg ) ) {
		netadr_t		*buf;
		int				len;

		// copy out to a seperate buffer for qeueing
		len = sizeof( netadr_t ) + netmsg.cursize;
		buf = malloc( len );
		*buf = adr;
		memcpy( buf+1, netmsg.data, netmsg.cursize );
		Sys_QueEvent( 0, SE_PACKET, 0, 0, len, buf );
	}
#endif

	// return if we have data
	if ( eventHead > eventTail ) {
		eventTail++;
		return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
	}

	// create an empty event to return

	memset( &ev, 0, sizeof( ev ) );
	ev.evTime = Sys_Milliseconds();

	return ev;
}
开发者ID:Hasimir,项目名称:jedi-academy-1,代码行数:66,代码来源:unix_main.cpp

示例2: Sys_QueMouseEvents

void Sys_QueMouseEvents( int dwElements ) {
	int i, value;

	for( i = 0; i < dwElements; i++ ) {
		if ( polled_didod[i].dwOfs >= DIMOFS_BUTTON0 && polled_didod[i].dwOfs <= DIMOFS_BUTTON7 ) {
			value = (polled_didod[i].dwData & 0x80) == 0x80;
			Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_KEY, K_MOUSE1 + ( polled_didod[i].dwOfs - DIMOFS_BUTTON0 ), value, 0, NULL );
		} else {
			switch (polled_didod[i].dwOfs) {
			case DIMOFS_X:
				value = polled_didod[i].dwData;
				Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_MOUSE, value, 0, 0, NULL );
				break;
			case DIMOFS_Y:
				value = polled_didod[i].dwData;
				Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_MOUSE, 0, value, 0, NULL );
				break;
			case DIMOFS_Z:
				value = ( (int) polled_didod[i].dwData ) / WHEEL_DELTA;
				int key = value < 0 ? K_MWHEELDOWN : K_MWHEELUP;
				value = abs( value );
				while( value-- > 0 ) {
					Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_KEY, key, true, 0, NULL );
					Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_KEY, key, false, 0, NULL );
				}
				break;
			}
		}
	}
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:30,代码来源:win_input.cpp

示例3: Sys_QueMouseEvents

void Sys_QueMouseEvents( int dwElements ) {
	int i, value;

	for( i = 0; i < dwElements; i++ ) {
		int diaction = polled_didod[i].dwOfs;

		if ( diaction >= DIMOFS_BUTTON0 && diaction <= DIMOFS_BUTTON7 ) {
			value = (polled_didod[i].dwData & 0x80) == 0x80;
			Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_KEY, K_MOUSE1 + ( diaction - DIMOFS_BUTTON0 ), value, 0, NULL );
		} else if (diaction == DIMOFS_X) {
			value = polled_didod[i].dwData;
			Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_MOUSE, value, 0, 0, NULL );
		} else if (diaction == DIMOFS_Y) {
			value = polled_didod[i].dwData;
			Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_MOUSE, 0, value, 0, NULL );
		} else if (diaction == DIMOFS_Z) {
			value = ( (int) polled_didod[i].dwData ) / WHEEL_DELTA;
			int key = value < 0 ? K_MWHEELDOWN : K_MWHEELUP;
			value = abs( value );
			while( value-- > 0 ) {
				Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_KEY, key, true, 0, NULL );
				Sys_QueEvent( polled_didod[i].dwTimeStamp, SE_KEY, key, false, 0, NULL );
			}
		}
	}
}
开发者ID:iodoom-gitorious,项目名称:windowshasyous-dhewg-1-iodoom3,代码行数:26,代码来源:win_input.cpp

示例4: IN_MouseEvent

/*
===========
IN_MouseEvent
===========
*/
void IN_MouseEvent(int mstate)
{
	int             i;

	if(!s_wmv.mouseInitialized && !directInput)
	{
		return;
	}

// perform button actions
	for(i = 0; i < 5; i++)
	{
		if((mstate & (1 << i)) && !(s_wmv.oldButtonState & (1 << i)))
		{
			Sys_QueEvent(g_wv.sysMsgTime, SE_KEY, K_MOUSE1 + i, qtrue, 0, NULL);
		}

		if(!(mstate & (1 << i)) && (s_wmv.oldButtonState & (1 << i)))
		{
			Sys_QueEvent(g_wv.sysMsgTime, SE_KEY, K_MOUSE1 + i, qfalse, 0, NULL);
		}
	}

	s_wmv.oldButtonState = mstate;
}
开发者ID:ethr,项目名称:ETXrealPro,代码行数:30,代码来源:win_input.c

示例5: Sys_QueEvent

void QGLView::MouseScrolled(float delta_x, float delta_y) {
	if (delta_y < 0) {
		Sys_QueEvent(0, SE_KEY, K_MWHEELUP, qtrue, 0, NULL);
		Sys_QueEvent(0, SE_KEY, K_MWHEELUP, qfalse, 0, NULL);
	} else {
		Sys_QueEvent(0, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL);
		Sys_QueEvent(0, SE_KEY, K_MWHEELDOWN, qfalse, 0, NULL);
	}
}
开发者ID:kallisti5,项目名称:quake3,代码行数:9,代码来源:beos_glwindow.cpp

示例6: GLimp_EndFrame

void GLimp_EndFrame( void ) {
	char 		buffer[500];
	char		*p;
	int 		len;
	const char *msg = NULL;
	int interval;
	int size[2];
	int pos[2];
	int rc;

	if ( strcmp( r_drawBuffer->string, "GL_FRONT" ) != 0 )
	{
		SwapBuffers();
	}

	while ( (len = read(ppsfd, buffer, sizeof( buffer ) -1 ) ) >= 0 ) {
		if ( len == 0 ) {
			return;
		}
		buffer[len] = '\0';
		p = buffer;
		pps_decoder_parse( &decoder, p, len );
		pps_decoder_push( &decoder, NULL );
		pps_decoder_get_string(&decoder, "msg", &msg);
		if (pps_decoder_status(&decoder, true) == PPS_DECODER_OK )
		{
			if ( strcmp(msg, "SWIPE_DOWN") == 0 )
			{
				Sys_QueEvent( Sys_Milliseconds(), SE_KEY, K_ESCAPE, qtrue, 0, NULL );
				Sys_QueEvent( Sys_Milliseconds(), SE_KEY, K_ESCAPE, qfalse, 0, NULL );
			}
			/*
			if ( strcmp(msg, "activate") == 0 ) {
				Com_Printf("pps:orientation\n");
			}
			else if ( strcmp(msg, "deactivate") == 0 ) {
				Com_Printf("pps:orientation\n");
			}
			else if ( strcmp(msg, "deflate") == 0 ) {
				Com_Printf("pps:deflate\n");
			}
			else if ( strcmp(msg, "orientation") == 0 ) {
				Com_Printf("pps:orientation\n");
			}
			else if ( strcmp(msg, "exit") == 0 ) {
				Com_Printf("pps:exit\n");
			}
			else if ( strcmp(msg, "invoke") == 0 ) {
				Com_Printf("pps:invoke\n");
			}
			*/
		}
	}
}
开发者ID:LoudHoward,项目名称:Quake3,代码行数:54,代码来源:qnx_glimp.c

示例7: DoKeyDown

void DoKeyDown(EventRecord *event)
{ 
	int		myCharCode;
	int		myKeyCode;
	
	myCharCode	= BitAnd(event->message,charCodeMask);
	myKeyCode = ( event->message & keyCodeMask ) >> 8;

	Sys_QueEvent( Sys_MsecForMacEvent(), SE_KEY, vkeyToQuakeKey[ myKeyCode ], 1, 0, NULL );
	Sys_QueEvent( Sys_MsecForMacEvent(), SE_CHAR, myCharCode, 0, 0, NULL );
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:11,代码来源:mac_event.c

示例8: SetMouseEventMask

void QGLView::MouseDown(BPoint point) {
	SetMouseEventMask(B_POINTER_EVENTS|B_KEYBOARD_EVENTS);
   	int32 buttons;
   	if (Window()->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons) == B_NO_ERROR) {
		if (buttons & B_PRIMARY_MOUSE_BUTTON)
   		  	Sys_QueEvent(0, SE_KEY, K_MOUSE1, qtrue, 0, NULL);
		if (buttons & B_SECONDARY_MOUSE_BUTTON)
			Sys_QueEvent(0, SE_KEY, K_MOUSE2, qtrue, 0, NULL);
		if (buttons & B_TERTIARY_MOUSE_BUTTON)
			Sys_QueEvent(0, SE_KEY, K_MOUSE3, qtrue, 0, NULL);
		old_buttons = buttons;
   	}
}
开发者ID:kallisti5,项目名称:quake3,代码行数:13,代码来源:beos_glwindow.cpp

示例9: Sys_GetEvent

sysEvent_t Sys_GetEvent( void ) {
    sysEvent_t	ev;
    char		*s;
    msg_t		netmsg;
    netadr_t	adr;

    // return if we have data
    if ( eventHead > eventTail ) {
        eventTail++;
        return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
    }

    // check for console commands
    s = Sys_ConsoleInput();
    if ( s ) {
        char	*b;
        int		len;

        len = strlen( s ) + 1;
        b = (char *)Z_Malloc( len,TAG_EVENT,qfalse );
        strcpy( b, s );
        Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
    }

    // check for network packets
    MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
    if ( Sys_GetPacket ( &adr, &netmsg ) ) {
        netadr_t		*buf;
        int				len;

        // copy out to a seperate buffer for qeueing
        len = sizeof( netadr_t ) + netmsg.cursize;
        buf = (netadr_t *)Z_Malloc( len,TAG_EVENT,qfalse );
        *buf = adr;
        memcpy( buf+1, netmsg.data, netmsg.cursize );
        Sys_QueEvent( 0, SE_PACKET, 0, 0, len, buf );
    }

    // return if we have data
    if ( eventHead > eventTail ) {
        eventTail++;
        return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
    }

    // create an empty event to return

    memset( &ev, 0, sizeof( ev ) );
    ev.evTime = Sys_Milliseconds();

    return ev;
}
开发者ID:Mauii,项目名称:Rend2,代码行数:51,代码来源:sys_unix.cpp

示例10: IN_CommonJoyPress

// extern void G_DemoKeypress();
// extern void CG_SkipCredits(void);
void IN_CommonJoyPress(int controller, fakeAscii_t button, bool pressed)
{
	// Check for special cases for map hack
	// This should be #ifdef'd out in FINAL_BUILD, but I really don't care.
	// If someone wants to copy the retail version to their modded xbox and
	// edit the config file to turn on maphack, let them.
	if (Cvar_VariableIntegerValue("cl_maphack"))
	{
		if (_UIRunning && button == A_JOY11 && pressed)
		{
			// Left trigger -> F1
			Sys_QueEvent( 0, SE_KEY, A_F1, pressed, 0, NULL );
			return;
		}
		else if (_UIRunning && button == A_JOY12 && pressed)
		{
			// Right trigger -> F2
			Sys_QueEvent( 0, SE_KEY, A_F2, pressed, 0, NULL );
			return;
		}
		else if (_UIRunning && button == A_JOY4 && pressed)
		{
			// Start button -> F3
			IN_SetMainController(controller);
			Sys_QueEvent( 0, SE_KEY, A_F3, pressed, 0, NULL );
			return;
		}
	}


	if(IN_GetMainController() == controller || _UIRunning)
	{
		// Always map start button to ESCAPE
		if (!_UIRunning && button == A_JOY4 && cls.state != CA_CINEMATIC)
			Sys_QueEvent( 0, SE_KEY, A_ESCAPE, pressed, 0, NULL );

#ifdef DEBUG_CONTROLLER
		if (controller != 3)
#endif
			Sys_QueEvent( 0, SE_KEY, _UIRunning ? UIJoy2Key(button) : button, pressed, 0, NULL );
	}

#ifdef DEBUG_CONTROLLER
	if (controller == 3 && pressed)
	{
		HandleDebugJoystickPress(button);
		return;
	}
#endif
}
开发者ID:3ddy,项目名称:Jedi-Outcast,代码行数:52,代码来源:win_input_console.cpp

示例11: IN_MouseMove

void IN_MouseMove(void)
{
	if (!mouse_avail || !dpy || !win)
		return;

#if 0
	if (!dgamouse) {
		Window root, child;
		int root_x, root_y;
		int win_x, win_y;
		unsigned int mask_return;
		int mwx = glConfig.vidWidth/2;
		int mwy = glConfig.vidHeight/2;

		XQueryPointer(dpy, win, &root, &child, 
			&root_x, &root_y, &win_x, &win_y, &mask_return);

		mx = win_x - mwx;
		my = win_y - mwy;

		XWarpPointer(dpy,None,win,0,0,0,0, mwx, mwy);
	}
#endif

	if (mx || my)
		Sys_QueEvent( 0, SE_MOUSE, mx, my, 0, NULL );
	mx = my = 0;
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:28,代码来源:linux_glimp.c

示例12: Sys_GenerateEvents

/*
================
Sys_GenerateEvents
================
*/
void Sys_GenerateEvents() {
	static int entered = false;
	char *s;

	if ( entered ) {
		return;
	}
	entered = true;

	// pump the message loop
	Sys_PumpEvents();

	// grab or release the mouse cursor if necessary
	IN_Frame();

	// check for console commands
	s = Sys_ConsoleInput();
	if ( s ) {
		char	*b;
		int		len;

		len = strlen( s ) + 1;
		b = (char *)Mem_Alloc( len, TAG_EVENTS );
		strcpy( b, s );
		Sys_QueEvent( SE_CONSOLE, 0, 0, len, b, 0 );
	}

	entered = false;
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:34,代码来源:win_main.cpp

示例13: Sys_GenerateEvents

/*
================
Sys_GenerateEvents
================
*/
void Sys_GenerateEvents(void)
{
	static int entered = false;
	char *s;

	if (entered) {
		return;
	}

	entered = true;

	// pump the message loop
	Sys_PumpEvents();

	// make sure mouse and joystick are only called once a frame
	IN_Frame();

	// check for console commands
	s = Sys_ConsoleInput();

	if (s) {
		char	*b;
		int		len;

		len = strlen(s) + 1;
		b = (char *)Mem_Alloc(len);
		strcpy(b, s);
		Sys_QueEvent(0, SE_CONSOLE, 0, 0, len, b);
	}

	entered = false;
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:37,代码来源:win_main.cpp

示例14: Sys_QueEvent

/*
========================
idJoystickWin32::PushButton
========================
*/
void idJoystickWin32::PushButton( int inputDeviceNum, int key, bool value )
{
	// So we don't keep sending the same SE_KEY message over and over again
	if( buttonStates[inputDeviceNum][key] != value )
	{
		buttonStates[inputDeviceNum][key] = value;
		Sys_QueEvent( SE_KEY, key, value, 0, NULL, inputDeviceNum );
	}
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:14,代码来源:win_input.cpp

示例15: Sys_PumpEvents

/*
=================
Sys_PumpEvents
=================
*/
void Sys_PumpEvents( void ) {
	char		*s;
	msg_t		netmsg;
	netadr_t	adr;

   // pump the message loop
	Sys_SendKeyEvents();
   
   // check for console commands
   s = Sys_ConsoleInput();
   if ( s ) {
       char	*b;
       int		len;

       len = strlen( s ) + 1;
       b = malloc( len );
	   if ( !b ) {
		   Com_Error( ERR_FATAL, "malloc failed in Sys_PumpEvents" );
	   }
       strcpy( b, s );
       Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
   }

   // check for other input devices
   Sys_Input();

   // check for network packets
   MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
   if ( Sys_GetPacket ( &adr, &netmsg ) ) {
       netadr_t		*buf;
       int				len;

       // copy out to a seperate buffer for qeueing
       len = sizeof( netadr_t ) + netmsg.cursize;
       buf = malloc( len );
	   if ( !buf ) {
		   Com_Error( ERR_FATAL, "malloc failed in Sys_PumpEvents" );
	   }
       *buf = adr;
       memcpy( buf+1, netmsg.data, netmsg.cursize );
       Sys_QueEvent( 0, SE_PACKET, 0, 0, len, buf );
   }
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:48,代码来源:mac_main.c


注:本文中的Sys_QueEvent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。