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


C++ SetCursorPos函数代码示例

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


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

示例1: glfwGetWindowSize

void Camera3::CameraRotation(float CAMERASPEED)
{
	int WIDTH, HEIGHT;
	
	glfwGetWindowSize(m_window, &WIDTH, &HEIGHT);


	POINT p;
	GetCursorPos(&p);
	SetCursorPos(WIDTH/2, HEIGHT/2);

	rotationY -= (p.x - (float)WIDTH / 2) / (1 / CAMERASPEED);
	rotationX -= (p.y - (float)HEIGHT / 2) / (1 / CAMERASPEED);

	if (rotationX > 80.f)
	{
		rotationX = 80.f;
	}
	else if (rotationX < -80.f)
	{
		rotationX = -80.f;
	}

	if (rotationY >= 360.f || rotationY <= -360.f)
	{
		rotationY = 0.f;
	}

	target = Vector3(
		cos(Math::DegreeToRadian(rotationX)) * cos(Math::DegreeToRadian(rotationY)) + this->position.x,
		sin(Math::DegreeToRadian(rotationX)) + this->position.y,
		-(cos(Math::DegreeToRadian(rotationX)) * sin(Math::DegreeToRadian(rotationY))) + this->position.z
		);


}
开发者ID:prophet-leong,项目名称:SP-2,代码行数:36,代码来源:Camera3.cpp

示例2: Test_NonClientMetrics

static void Test_NonClientMetrics()
{
    NONCLIENTMETRICS NonClientMetrics;

    /* WARNING: this test requires themes and dwm to be disabled */

    SetCursorPos(0,0);

    /* Retrieve th non client metrics */
    NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICS);
    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
    FlushMessages();
    COMPARE_CACHE(empty_chain);

    /* Set the non client metric without making any change */
    SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
    FlushMessages();
    COMPARE_CACHE(NcMetricsChange_chain);

    /* Set the same metrics again with the SPIF_SENDCHANGE param */
    SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, SPIF_SENDCHANGE|SPIF_UPDATEINIFILE );
    FlushMessages();
    COMPARE_CACHE(NcMetricsChange1_chain);

    /* Slightly change the caption height */
    NonClientMetrics.iCaptionHeight += 1;
    SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
    FlushMessages();
    COMPARE_CACHE(CaptionHeight_chain);

    /* Restore the original caption height */
    NonClientMetrics.iCaptionHeight -= 1;
    SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &NonClientMetrics, 0);
    FlushMessages();
    COMPARE_CACHE(CaptionHeight_chain);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:36,代码来源:SystemParametersInfo.c

示例3: _restoreInputGrab_

void _restoreInputGrab_() {
    #ifdef G3D_WIN32

        // Restore the old clipping region
        ClipCursor(&oldCursorRect);

        SetCursorPos(oldCursorPos.x, oldCursorPos.y);

        // Restore the old cursor
        SetCursor(oldCursor);

        // Restore old visibility count
        if (oldShowCursorCount < 0) {
            for (int c = 0; c > oldShowCursorCount; --c) {
                ShowCursor(false);
            }
        }
        
    #elif defined(G3D_LINUX)
        // TODO: Linux
    #elif defined(G3D_OSX)
        // TODO: OS X
    #endif
}
开发者ID:CloudShi,项目名称:diamondcore,代码行数:24,代码来源:debugAssert.cpp

示例4: SetCursor

bool CScene::ProcessInput( HWND hWnd, CGameTimer timer )
{
	static UCHAR pKeyBuffer[256];
	DWORD dwDirection = 0;
	if (GetKeyboardState( pKeyBuffer ))
	{
		if (pKeyBuffer['W'] & 0xF0) dwDirection |= DIR_FORWARD;
		if (pKeyBuffer['S'] & 0xF0) dwDirection |= DIR_BACKWARD;
		if (pKeyBuffer['A'] & 0xF0) dwDirection |= DIR_LEFT;
		if (pKeyBuffer['D'] & 0xF0) dwDirection |= DIR_RIGHT;
		if (pKeyBuffer['1'] & 0xF0) m_pCamera->Move( XMFLOAT3( 0.0f, 10.f, 10.0f ));
	}
	float cxDelta = 0.0f, cyDelta = 0.0f;
	POINT ptCursorPos;
	/*마우스를 캡쳐했으면 마우스가 얼마만큼 이동하였는 가를 계산한다.
	마우스 왼쪽 또는 오른쪽 버튼이 눌러질 때의 메시지(WM_LBUTTONDOWN, WM_RBUTTONDOWN)를 처리할 때 마우스를 캡쳐하였다.
	그러므로 마우스가 캡쳐된 것은 마우스 버튼이 눌려진 상태를 의미한다.
	마우스를 좌우 또는 상하로 움직이면 플레이어를 x-축 또는 y-축으로 회전한다.*/
	if (GetCapture( ) == hWnd)
	{
		SetCursor( NULL );
		GetCursorPos( &ptCursorPos );
		cxDelta = (float)( ptCursorPos.x - m_ptOldCursorPos.x ) / 5.0f;
		cyDelta = (float)( ptCursorPos.y - m_ptOldCursorPos.y ) / 5.0f;
		SetCursorPos( ptCursorPos.x, ptCursorPos.y );
	}
	if (dwDirection != 0 || cxDelta != 0.0f || cyDelta != 0.0f)
	{
		if (cxDelta || cyDelta)
		{
			/*cxDelta는 y-축의 회전을 나타내고 cyDelta는 x-축의 회전을 나타낸다.
			오른쪽 마우스 버튼이 눌려진 경우 cxDelta는 z-축의 회전을 나타낸다.*/
			// 마우스 클릭시 공격 애니메이션이 행해지도록 해야함
			if (pKeyBuffer[VK_RBUTTON] & 0xF0){
				//m_pCamera->Move( XMFLOAT3( cyDelta, 0.0f, -cxDelta ) );
	///			m_pCamera->Rotate(0.0f, cxDelta, 0.0f);
//				m_pCamera->Update( XMFLOAT3( 0.0f, 0.0f, 0.0f ), timer.GetTimeElapsed( ) );
			}
//			else
//				m_pCamera->Rotate( cyDelta, cxDelta, 0.0f );

			//if (pKeyBuffer[VK_LBUTTON] & 0xF0)
			//{
			//	//m_pPlayer->m_iAnimState = static_cast<int>( AnimationState::ANIM_LATTACK1 );
			//	SoundManager::GetInstance( )->Play( ATTACK );
			//}
		}
		/*플레이어를 dwDirection 방향으로 이동한다(실제로는 속도 벡터를 변경한다).
		이동 거리는 시간에 비례하도록 한다. 플레이어의 이동 속력은 (50/초)로 가정한다.
		만약 플레이어의 이동 속력이 있다면 그 값을 사용한다.*/
		if (dwDirection)
		{
			// 현재 플레이어의 AABB 박스의 y좌표 최소가 -0.5임. 따라서 0보다 작으므로 바닥과 겹침, 그로 인해 못움직임
			// 충돌체크 자체는 제대로 되고 있으나 플레이어의 위치가 문제
		//	if (!CollisionCheck( ))
				m_pPlayer->Move( dwDirection, 50.0f * timer.GetTimeElapsed( ), false );
		}
	}
	//	if (!CollisionCheck( ))
	m_pPlayer->Update( timer.GetTimeElapsed( ), vPickPos );

	return true;
}
开发者ID:garamKwon,项目名称:ContagionCity,代码行数:63,代码来源:Scene.cpp

示例5: MouseControl2

void MouseControl2(POINT p)
{
	SetCursorPos(p.x,p.y); //마우스 위치를 이동시키기

}
开发者ID:LeeSeokJin,项目名称:SPWC,代码行数:5,代码来源:client.cpp

示例6: MakeMove

void MakeMove()
{
	int x;
	int y;

	// Reset heuristic
	if (gem_matched)
	{
		current_error_threshold = error_threshold;
		gem_matched = false;
	}

	for (y = 0; y < cell_count; y++)
	{
		for (x = 0; x < cell_count; x++)
		{
			// Try move left
			if (x - 1 >= 0)
			{
				CopyGrid();
				if (CheckMatch(x, y, x - 1, y))
				{
					MoveGem(x, y, x - 1, y);
					gem_matched = true;
					break;
				}
			}
			
			// Try move right
			if (x + 1 < cell_count)
			{
				CopyGrid();
				if (CheckMatch(x,y,x+1,y))
				{
					MoveGem(x, y, x + 1, y);
					gem_matched = true;
					break;
				}

			}
			// Try move up
			if (y - 1 >= 0)
			{
				CopyGrid();
				if (CheckMatch(x, y, x, y - 1))
				{
					MoveGem(x, y, x, y - 1);
					gem_matched = true;
					break;
				}

			}
			
			// Try move down
			if (y + 1 < cell_count)
			{
				CopyGrid();
				if (CheckMatch(x, y, x, y + 1))
				{
					MoveGem(x, y, x, y + 1);
					gem_matched = true;
					break;
				}
			}
		}

		if (gem_matched)
			break;
	}

	// If we didn't find a match, we'll need to make
	// our heuristic less picky. Increment threshold
	if (!gem_matched && current_error_threshold < 255)
	{
		// Before taking screenshot we'll want to reset the cursor
		// position to prevent hover animations of gems. This
		// could possibly help in the detection of matches
		SetCursorPos(game_origin.x, game_origin.y);

		current_error_threshold += 5;
		if (current_error_threshold >= 255)
		{
			printf("Need some help here.\n");
			current_error_threshold = 255;
		}
	}
}
开发者ID:aust,项目名称:Bejeweled-Bot,代码行数:87,代码来源:main.cpp

示例7: SendKey

KEYBOARDDLL_API int SendKey(const HWND hwnd, const RECT rect, UINT vkey,
							const HWND restore_focus, const POINT restore_cursor)
{
	INPUT			input[4];

	POINT pt = RandomizeClickLocation(rect);
	double fScreenWidth = ::GetSystemMetrics( SM_CXSCREEN )-1;
	double fScreenHeight = ::GetSystemMetrics( SM_CYSCREEN )-1;

	// Translate click point to screen/mouse coords
	ClientToScreen(hwnd, &pt);
	double fx = pt.x*(65535.0f/fScreenWidth);
	double fy = pt.y*(65535.0f/fScreenHeight);

	// Set up the input structure
	int input_count=0;

	// First click in the rect to select it, if rect is not passed in as {-1, -1, -1, -1}
	if (rect.left!=-1 || rect.top!=-1 || rect.right!=-1 || rect.bottom!=-1)
	{
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_MOUSE;
		input[input_count].mi.dx = (LONG) fx;
		input[input_count].mi.dy = (LONG) fy;
		input[input_count].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTDOWN;
		input_count++;
		
		ZeroMemory(&input[input_count],sizeof(INPUT));
		input[input_count].type = INPUT_MOUSE;
		input[input_count].mi.dx = (LONG) fx;
		input[input_count].mi.dy = (LONG) fy;
		input[input_count].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTUP;
		input_count++;
	}

	// Add vkey to the input struct
	ZeroMemory(&input[input_count],sizeof(INPUT));
	input[input_count].type = INPUT_KEYBOARD;
	input[input_count].ki.wVk = vkey;
	input_count++;

	ZeroMemory(&input[input_count],sizeof(INPUT));
	input[input_count].type = INPUT_KEYBOARD;
	input[input_count].ki.wVk = vkey;
	input[input_count].ki.dwFlags = KEYEVENTF_KEYUP;
	input_count++;

	// Set focus to target window
	SetFocus(hwnd);
	SetForegroundWindow(hwnd);
	SetActiveWindow(hwnd);

	// Send input
	SendInput(input_count, input, sizeof(INPUT));

	// Restore previous window state and cursor position
	if (restore_focus!=NULL)
	{
		SetActiveWindow(restore_focus);
		SetForegroundWindow(restore_focus);
		SetFocus(restore_focus);
	}

	// Remove that code-block, if you don't want to restore the mouse-cursor!
	if (restore_cursor.x!=-1 && restore_cursor.y!=-1)
	{
		SetCursorPos(restore_cursor.x, restore_cursor.y);
	}

	return (int) true;
}
开发者ID:BehnamEmamian,项目名称:openholdembot,代码行数:71,代码来源:keyboarddll.cpp

示例8: GMain_Startup

//==============================================================================
//==============================================================================
geBoolean GMain_Startup(DRV_DriverHook *Hook)
{
 
	int32			VidMode;

	//SetEnvironmentVariable("SST_GAMMA", "1.0");

	switch(Hook->Mode)
	{
		case 0:
		{
			ClientWindow.Width = 512;
			ClientWindow.Height = 384;
			VidMode = GR_RESOLUTION_512x384;
			break;
		}
		case 1:
		{
			ClientWindow.Width = 640;
			ClientWindow.Height = 480;
			VidMode = GR_RESOLUTION_640x480;
			break;
		}
		case 2:
		{
			ClientWindow.Width = 800;
			ClientWindow.Height = 600;
			VidMode = GR_RESOLUTION_800x600;
			break;
		}
		case 3:
		{
			ClientWindow.Width = 1024;
			ClientWindow.Height = 768;
			VidMode = GR_RESOLUTION_1024x768;
			break;
		}
		default:
		{
			SetLastDrvError(DRV_ERROR_NULL_WINDOW, "GLIDE_DrvInit:  Invalid display mode.");
			return FALSE;
		}
	}

	ClientWindow.hWnd = Hook->hWnd;

	// Go full-screen so we won't lose the mouse
	{
		RECT	DeskTop;

		// Save the old window size
		GetWindowRect(ClientWindow.hWnd, &OldWindow);

		// Get the size of the desktop
		GetWindowRect(GetDesktopWindow(), &DeskTop);

		// Resize the window to the size of the desktop
		MoveWindow(ClientWindow.hWnd, DeskTop.left-4, DeskTop.top-40, DeskTop.right+20, DeskTop.bottom+20, TRUE);

		// Center the mouse
		SetCursorPos(ClientWindow.Width / 2, ClientWindow.Height / 2);
	}

	// initialize the Glide library 
	grGlideInit();

	// Get the info about this board
	if (!GMain_GetBoardInfo(&g_BoardInfo))
		return FALSE;

	if (g_BoardInfo.NumTMU <= 0)
	{
		SetLastDrvError(DRV_ERROR_INIT_ERROR, "GLIDE_DrvInit:  Not enough texture mapping units.");
		return GE_FALSE;
	}

	// select the current graphics system 
	grSstSelect(0);

	// initialize and open the graphics system 
	if (!grSstWinOpen( (U32)ClientWindow.hWnd,
              VidMode,
              GR_REFRESH_60Hz,
              GR_COLORFORMAT_ABGR,
              GR_ORIGIN_UPPER_LEFT,
              2, 1 ))
	{
		SetLastDrvError(DRV_ERROR_INIT_ERROR, "GLIDE_DrvInit:  grSstWinOpen failed.");
		return GE_FALSE;
	}

	// We know that GLIDE will be in 5-6-5 mode...
	ClientWindow.R_shift = 5+6;
	ClientWindow.G_shift = 5;
	ClientWindow.B_shift = 0;

	ClientWindow.R_mask = 0xf800;
	ClientWindow.G_mask = 0x07e0;
//.........这里部分代码省略.........
开发者ID:5432935,项目名称:genesis3d,代码行数:101,代码来源:GMain.c

示例9: EmptyClipboard

void g2LabelEdit::CopyBuffer()
{
    // Win32 implementation
    #ifdef _WIN32
    
        // Attempt to open clipboard
        if(!OpenClipboard(GetForegroundWindow()))
            return;
        
        // Empty current clipboard
        EmptyClipboard();
        
        // Allocate a system resource (a memory buffer for the text)
        HGLOBAL TextHandle = GlobalAlloc(GMEM_MOVEABLE, (strlen(TextBuffer) + 1) * sizeof(char));
        if(TextHandle == NULL)
            return;
        
        LPTSTR StringLock = (LPTSTR)GlobalLock(TextHandle);
        if(StringLock == NULL)
            return;
        strcpy(StringLock, TextBuffer);
        GlobalUnlock(TextHandle);
        
        // Copy to the clipboard
        SetClipboardData(CF_TEXT, TextHandle);
        
        // Close clipboard
        CloseClipboard();
    
    // OSX implementation
    #elif __APPLE__
    
        // Allocate or get a reference to the application's active clipboard
        PasteboardRef ClipboardHandle;
        if(PasteboardCreate(kPasteboardClipboard, &ClipboardHandle) != noErr)
            return;
        
        // Clear current clipboard
        if(PasteboardClear(ClipboardHandle) != noErr)
            return;
        
        // Explicitly update (after cleaning is important)
        PasteboardSynchronize(ClipboardHandle);
        
        // Create a system-wide buffer to give to the clipboard
        CFDataRef DataBuffer = CFDataCreate(kCFAllocatorDefault, (const UInt8*)TextBuffer, CFIndex((strlen(TextBuffer) + 1) * sizeof(char)));
        if(DataBuffer == NULL)
            return;
        
        // Paste into clipboard
        PasteboardPutItemFlavor(ClipboardHandle, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), DataBuffer, kPasteboardFlavorNoFlags);
        
        // Release data buffer
        CFRelease(DataBuffer);
    
    // Linux clipboard implementation
    #elif __linux__
    
        // Paste into UI from linux buffer
        strcpy(__LinuxClipboard, TextBuffer);
        SetCursorPos((int)strlen(__LinuxClipboard));
    
    #endif
}
开发者ID:blast007,项目名称:glui2,代码行数:64,代码来源:g2LabelEdit.cpp

示例10: test_customdraw

static void test_customdraw(void) {
    static struct {
        LRESULT FirstReturnValue;
        int ExpectedCalls;
    } expectedResults[] = {
        /* Valid notification responses */
        {CDRF_DODEFAULT, TEST_CDDS_PREPAINT},
        {CDRF_SKIPDEFAULT, TEST_CDDS_PREPAINT},
        {CDRF_NOTIFYPOSTPAINT, TEST_CDDS_PREPAINT | TEST_CDDS_POSTPAINT},

        /* Invalid notification responses */
        {CDRF_NOTIFYITEMDRAW, TEST_CDDS_PREPAINT},
        {CDRF_NOTIFYPOSTERASE, TEST_CDDS_PREPAINT},
        {CDRF_NEWFONT, TEST_CDDS_PREPAINT}
    };

   DWORD       iterationNumber;
   WNDCLASSA wc;
   LRESULT   lResult;

   /* Create a class to use the custom draw wndproc */
   wc.style = CS_HREDRAW | CS_VREDRAW;
   wc.cbClsExtra = 0;
   wc.cbWndExtra = 0;
   wc.hInstance = GetModuleHandleA(NULL);
   wc.hIcon = NULL;
   wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
   wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
   wc.lpszMenuName = NULL;
   wc.lpszClassName = "CustomDrawClass";
   wc.lpfnWndProc = custom_draw_wnd_proc;
   RegisterClassA(&wc);

   for (iterationNumber = 0;
        iterationNumber < sizeof(expectedResults)/sizeof(expectedResults[0]);
        iterationNumber++) {

       HWND parent, hwndTip;
       RECT rect;
       TTTOOLINFOA toolInfo = { 0 };

       /* Create a main window */
       parent = CreateWindowExA(0, "CustomDrawClass", NULL,
                               WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
                               WS_MAXIMIZEBOX | WS_VISIBLE,
                               50, 50,
                               300, 300,
                               NULL, NULL, NULL, 0);
       ok(parent != NULL, "Creation of main window failed\n");

       /* Make it show */
       ShowWindow(parent, SW_SHOWNORMAL);
       flush_events(100);

       /* Create Tooltip */
       hwndTip = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASSA,
                                NULL, TTS_NOPREFIX | TTS_ALWAYSTIP,
                                CW_USEDEFAULT, CW_USEDEFAULT,
                                CW_USEDEFAULT, CW_USEDEFAULT,
                                parent, NULL, GetModuleHandleA(NULL), 0);
       ok(hwndTip != NULL, "Creation of tooltip window failed\n");

       /* Set up parms for the wndproc to handle */
       CD_Stages = 0;
       CD_Result = expectedResults[iterationNumber].FirstReturnValue;
       g_hwnd    = hwndTip;

       /* Make it topmost, as per the MSDN */
       SetWindowPos(hwndTip, HWND_TOPMOST, 0, 0, 0, 0,
             SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

       /* Create a tool */
       toolInfo.cbSize = TTTOOLINFOA_V1_SIZE;
       toolInfo.hwnd = parent;
       toolInfo.hinst = GetModuleHandleA(NULL);
       toolInfo.uFlags = TTF_SUBCLASS;
       toolInfo.uId = 0x1234ABCD;
       toolInfo.lpszText = (LPSTR)"This is a test tooltip";
       toolInfo.lParam = 0xdeadbeef;
       GetClientRect (parent, &toolInfo.rect);
       lResult = SendMessageA(hwndTip, TTM_ADDTOOLA, 0, (LPARAM)&toolInfo);
       ok(lResult, "Adding the tool to the tooltip failed\n");

       /* Make tooltip appear quickly */
       SendMessageA(hwndTip, TTM_SETDELAYTIME, TTDT_INITIAL, MAKELPARAM(1,0));

       /* Put cursor inside window, tooltip will appear immediately */
       GetWindowRect( parent, &rect );
       SetCursorPos( (rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2 );
       flush_events(200);

       if (CD_Stages)
       {
           /* Check CustomDraw results */
           ok(CD_Stages == expectedResults[iterationNumber].ExpectedCalls ||
              broken(CD_Stages == (expectedResults[iterationNumber].ExpectedCalls & ~TEST_CDDS_POSTPAINT)), /* nt4 */
              "CustomDraw run %d stages %x, expected %x\n", iterationNumber, CD_Stages,
              expectedResults[iterationNumber].ExpectedCalls);
       }

//.........这里部分代码省略.........
开发者ID:bdidemus,项目名称:wine,代码行数:101,代码来源:tooltips.c

示例11: SetCursorPos

void Win32Wrapper::MySetCursorPos(int x, int y) {
	SetCursorPos(x, y);
}
开发者ID:2bitdreamer,项目名称:SD6_Engine,代码行数:3,代码来源:Win32Wrapper.cpp

示例12: switch

BOOL CGmodeWnd::Exec()
{
	int			i;
	BOOL		bPush = FALSE;
	POINT		icPt;
	char		str[MAX_PATH];

	if(cgview_mode!=sysInf.execMode)return FALSE;
	switch(state){
	  case 0:
	  case 2:
	  case 4:
	  case 5:
		time = bgInf.look_cnt-timeGetTime();
		baseWnd.alpha = float(bgInf.look_max-time)/bgInf.look_max;
		if(time<=0){
			baseWnd.alpha = 1.0f;
			bgInf.look_cnt = 0;
			if(state==4)state = 1;
			else state ++;
		}
		if(state==3 && (selectNum==5 || selectNum==6 || selectNum==7)){
			bgInf.look_max = 2100;
			bgInf.look_cnt = timeGetTime() +bgInf.look_max;
		}else if(state==5){
			baseWnd.alpha = 1.0f -baseWnd.alpha;
		}else if(state==6){
			changeExecMode( opening_mode );	
		}
		panel[0].alpha = panel[1].alpha = button.alpha = baseWnd.alpha;
		return TRUE;
	  case 1:
		if(keyState.push_action && selectNum>=0){
			if(AVG_GetCgFlag(selectNum+1)==FALSE)break;
			PlayEffectNum(evtHandle[1],SelectSnd);
			wsprintf(str,"v00%02d0",selectNum);
			baseWnd.loadLGF(pack_eventcg,str);
			state = 2;
			bgInf.look_max = 900;
			bgInf.look_cnt = timeGetTime() +bgInf.look_max;
			panel[0].alpha = panel[1].alpha = button.alpha = baseWnd.alpha = 0;
			switch(selectNum){
			  case 5:
				scrollOffset.x = 680;
				scrollOffset.y = 0;
				break;
			  case 6:
				scrollOffset.x = 0;
				scrollOffset.y = 600;
				break;
			  case 7:
				scrollOffset.x = 0;
				scrollOffset.y = 0;
				break;
			}
			break;
		}else if(keyState.push_left || keyState.push_up){
			bPush = TRUE;
			if(selectNum==0)selectNum = 11;
			else selectNum --;
		}else if(keyState.push_right || keyState.push_down){
			bPush = TRUE;
			selectNum ++;
			if(selectNum > 11)selectNum = 0;
		}
		if(bPush){
			icPt.x = 54  +(selectNum%4)*177 +50;
			icPt.y = 104 +(selectNum/4)*136 +50;
			ClientToScreen(sysInf.hWnd,&icPt);
			SetCursorPos(icPt.x, icPt.y);
		}else{
			selectNum = -1;
		}
		for(i=0;i<12;i++){
			rect.left = 54+ 177*(i%4);	rect.right = rect.left +160;
			rect.top = 104+136*(i/4);	rect.bottom = rect.top +120;
			if(PtInRect(&rect,sysInf.msPoint)){
				selectNum = i;
				break;
			}
		}
		if(btn.CheckState(&sysInf.msPoint) || keyState.push_cancel){
			PlayEffectNum(evtHandle[1],CancelSnd);
			baseWnd.BltFast(0,0,&g_DibInf.colorBuf,NULL,FALSE);
			state = 5;
			bgInf.look_max = 900;
			bgInf.look_cnt = timeGetTime() +bgInf.look_max;
			return TRUE;
		}
		break;
	  case 3:
		switch(selectNum){
		  case 5:
			time = bgInf.look_cnt-timeGetTime();
			if(time<=0){
				scrollOffset.x = 0;
				scrollOffset.y = 680;
			}else{
				scrollOffset.x = 680 -(bgInf.look_max-time)*680/bgInf.look_max;
				scrollOffset.y = (bgInf.look_max-time)*680/bgInf.look_max;
//.........这里部分代码省略.........
开发者ID:autch,项目名称:aquaplus_gpl,代码行数:101,代码来源:systemWnd.cpp

示例13: ofSetFrameRate

//--------------------------------------------------------------
void testApp::setup() {

    ofSetFrameRate(30);

    //Initialize the training and info variables
    infoText = "";
    trainingClassLabel = 1;
    record = false;
    noOfHands = 1;
    noOfTrackedHands = 0;
    //The input to the training data will be the [x y] from the mouse, so we set the number of dimensions to 2
    trainingData.setNumDimensions( noOfHands*3 );
    //trainingData.setNumDimensions( 3 );

    //Initialize the DTW classifier
    DTW dtw;

    //Turn on null rejection, this lets the classifier output the predicted class label of 0 when the likelihood of a gesture is low
    dtw.enableNullRejection( true );

    //Set the null rejection coefficient to 3, this controls the thresholds for the automatic null rejection
    //You can increase this value if you find that your real-time gestures are not being recognized
    //If you are getting too many false positives then you should decrease this value
    dtw.setNullRejectionCoeff( 3 );


    //Turn on the automatic data triming, this will remove any sections of none movement from the start and end of the training samples
    dtw.enableTrimTrainingData(true, 0.1, 90);

    //Offset the timeseries data by the first sample, this makes your gestures (more) invariant to the location the gesture is performed
    dtw.setOffsetTimeseriesUsingFirstSample(true);


    //Add the classifier to the pipeline (after we do this, we don't need the DTW classifier anymore)
    pipeline.setClassifier( dtw );

    //pipeline.inputVectorDimensions(3*noOfHands);

    ///setup nite


    niteRc = nite::NiTE::initialize();
    if (niteRc != nite::STATUS_OK)
    {
        printf("NiTE initialization failed\n");
        return;
    }

    niteRc = handTracker.create();
    if (niteRc != nite::STATUS_OK)
    {
        printf("Couldn't create user tracker\n");
        return;
    }

    handTracker.startGestureDetection(nite::GESTURE_CLICK);

    printf("\nPoint with your hand to start tracking it...\n");

    //put cursor in the middle of the screen: SPI_GETWORKAREA
    int screenX = GetSystemMetrics(SM_CXSCREEN);
    int screenY = GetSystemMetrics(SM_CYSCREEN);
    SetCursorPos(screenX / 2, screenY / 2);
    xcursorpos = 500;
    ycursorpos = 500;

}
开发者ID:astroman5516,项目名称:Gesture_Recognizer_of0.8_Nite2_Openni2_x86,代码行数:68,代码来源:testApp.cpp

示例14: SetCursorPos

void			WinWindow::warpMouse(int x, int y)
{
  SetCursorPos(x, y);
}
开发者ID:mvanderkolff,项目名称:navi-misc,代码行数:4,代码来源:WinWindow.cpp

示例15: if


//.........这里部分代码省略.........
			return true;

		if (!isMouseWentDownOnUI)
		{
			// there is a small delay until aiming starts, to not shackle the
			// camera with any short mouseclick
			double dtRightButton = OgreClient::Singleton->GameTick->Current - tickMouseDownRight;
			double dtLeftButton = OgreClient::Singleton->GameTick->Current - tickMouseDownLeft;

			// right mousebutton (or both) pressed and dleay for mouseaim exceeded
			if (IsRightMouseDown && dtRightButton > MOUSELOOKMINDELAY)
			{				
				if (dx != 0)					    
				{
					// stop immediately if we switched directions
					if (::System::Math::Sign(dx) != ::System::Math::Sign(avatarYawDelta))
						avatarYawDelta = 0.0f;

					// set a new delta and stepsize
					// this will be processed tick based
					avatarYawDelta += MOUSELOOKSPEED * (float)OgreClient::Singleton->Config->MouseAimSpeed * (float)dx;
					avatarYawStep = MOUSELOOKSTEPFACT * avatarYawDelta * ::System::Math::Max((float)OgreClient::Singleton->GameTick->Span, 1.0f);

					isAiming = true;
				}

				if (dy != 0)
				{
					// invert mouse y if enabled in config
					if (OgreClient::Singleton->Config->InvertMouseY)
						dy = -dy;

					// stop immediately if we switched directions
					if (::System::Math::Sign(dy) != ::System::Math::Sign(cameraPitchDelta))
						cameraPitchDelta = 0.0f;

					// set a new delta and stepsize
					// this will be processed tick based
					cameraPitchDelta += MOUSELOOKSPEED * (float)OgreClient::Singleton->Config->MouseAimSpeed * (float)dy;
					cameraPitchStep = MOUSELOOKSTEPFACT * cameraPitchDelta * ::System::Math::Max((float)OgreClient::Singleton->GameTick->Span, 1.0f);

					isAiming = true;
				}
			}

			// left mousebutton pressed and delay for mouseaim exceeded
			else if (IsLeftMouseDown && dtLeftButton > MOUSELOOKMINDELAY)
			{                    
				if (dx != 0)
				{
					// stop immediately if we switched directions
					if (::System::Math::Sign(dx) != ::System::Math::Sign(cameraYawDelta))
						cameraYawDelta = 0.0f;

					// set a new delta and stepsize
					// this will be processed tick based
					cameraYawDelta += MOUSELOOKSPEED * (float)OgreClient::Singleton->Config->MouseAimSpeed * (float)dx;
					cameraYawStep = MOUSELOOKSTEPFACT * cameraYawDelta * ::System::Math::Max((float)OgreClient::Singleton->GameTick->Span, 1.0f);

					isAiming = true;
				}
	
				if (dy != 0)
				{	
					// invert mouse y if enabled in config
					if (OgreClient::Singleton->Config->InvertMouseY)
						dy = -dy;

					// stop immediately if we switched directions
					if (::System::Math::Sign(dy) != ::System::Math::Sign(cameraPitchDelta))
						cameraPitchDelta = 0.0f;

					// set a new delta and stepsize
					// this will be processed tick based
					cameraPitchDelta += MOUSELOOKSPEED * (float)OgreClient::Singleton->Config->MouseAimSpeed * (float)dy;
					cameraPitchStep = MOUSELOOKSTEPFACT * cameraPitchDelta * ::System::Math::Max((float)OgreClient::Singleton->GameTick->Span, 1.0f);

					isAiming = true;
				}
			}

			// mousewheel / zoom
			if (dz != 0 && ControllerUI::IgnoreTopControlForMouseInput)
			{			
				// set a new delta and stepsize
				// this will be processed tick based
				cameraZDelta += ZOOMSPEED * (float)dz;
				cameraZStep = MOUSELOOKSTEPFACT * cameraZDelta * ::System::Math::Max((float)OgreClient::Singleton->GameTick->Span, 1.0f);
			}

			// restore/fixed windows cursor position on mouse look										
			if (IsAnyMouseDown)							
				SetCursorPos(mouseDownWindowsPosition->x, mouseDownWindowsPosition->y);	
		}
		
		if (!isAiming && ControllerUI::IgnoreTopControlForMouseInput)
			PerformMouseOver(arg.state.X.abs, arg.state.Y.abs, false);												 

        return true;
    };
开发者ID:AlgorithmsOfMathdestruction,项目名称:meridian59-dotnet,代码行数:101,代码来源:ControllerInput.cpp


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