您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetKeyState函数代码示例

51自学网 2021-06-01 21:09:50
  C++
这篇教程C++ GetKeyState函数代码示例写得很实用,希望能帮到您。

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

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

示例1: Q_Q

void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event){    Q_Q(QDockWidget);    int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q);    QRect geo = q->geometry();    QRect titleRect = q->frameGeometry();#ifdef Q_WS_MAC    if ((features & QDockWidget::DockWidgetVerticalTitleBar)) {        titleRect.setTop(geo.top());        titleRect.setBottom(geo.bottom());        titleRect.setRight(geo.left() - 1);    } else#endif    {        titleRect.setLeft(geo.left());        titleRect.setRight(geo.right());        titleRect.setBottom(geo.top() - 1);        titleRect.adjust(0, fw, 0, 0);    }    switch (event->type()) {        case QEvent::NonClientAreaMouseButtonPress:            if (!titleRect.contains(event->globalPos()))                break;            if (state != 0)                break;            if (qobject_cast<QMainWindow*>(parent) == 0)                break;            if (isAnimating())                break;            initDrag(event->pos(), true);            if (state == 0)                break;#ifdef Q_WS_WIN            // On Windows, NCA mouse events don't contain modifier info            state->ctrlDrag = GetKeyState(VK_CONTROL) & 0x8000;#else            state->ctrlDrag = event->modifiers() & Qt::ControlModifier;#endif            startDrag();            break;        case QEvent::NonClientAreaMouseMove:            if (state == 0 || !state->dragging)                break;#ifndef Q_OS_MAC            if (state->nca) {                endDrag();            }#endif            break;        case QEvent::NonClientAreaMouseButtonRelease:#ifdef Q_OS_MAC                        if (state)                                endDrag();#endif                        break;        case QEvent::NonClientAreaMouseButtonDblClick:            _q_toggleTopLevel();            break;        default:            break;    }}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:66,


示例2: switch

//.........这里部分代码省略.........			FmtForShow();		}		break;	case VK_HOME:		m_nCaretPos = 0;		FmtForShow();		break;	case VK_END:		m_nCaretPos = m_nTextLen;		FmtForShow();		break;	case VK_UP:		if (MULTI_LINE && m_nCaretLineIndex)		{			int nCharPerLine = (m_Width * 2) / m_nFontSize;			int nLineHead = 0, nLineEnd = 0;			for (nRet = 0; nRet < m_nCaretLineIndex; nRet++)			{				nLineHead = nLineEnd;				nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine);			}			m_nCaretPos = nLineHead + TSplitString(&m_pText[nLineHead],				(m_nCaretPos - nLineEnd), false);			if (m_nCaretPos >= nLineEnd && nLineEnd)			{				m_nCaretPos = nLineEnd;				if(m_pText[nLineEnd - 1] == KTC_ENTER)					m_nCaretPos--;			}			FmtForShow();		}		else if (m_pParentWnd)			nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_UP);		break;	case VK_DOWN:		if (MULTI_LINE)		{			int nCharPerLine = (m_Width * 2) / m_nFontSize;			int nLineHead = 0, nLineEnd = 0;			for (nRet = 0; nRet <= m_nCaretLineIndex; nRet++)			{				nLineHead = nLineEnd;				nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine);			}			m_nCaretPos = nLineEnd + TSplitString(&m_pText[nLineEnd],				(m_nCaretPos - nLineHead), false);			nLineHead = nLineEnd;			nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine);			if (m_nCaretPos >= nLineEnd && nLineEnd)			{				m_nCaretPos = nLineEnd;				if(m_pText[nLineEnd - 1] == KTC_ENTER)					m_nCaretPos--;			}			FmtForShow();		}		else if (m_pParentWnd)			nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_DOWN);		break;	case VK_TAB:	case VK_PRIOR:	case VK_NEXT:	case VK_ESCAPE:		if (m_pParentWnd)			nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, nKeyCode);		break;	case VK_RETURN:		if (m_pParentWnd)		{			if ((m_Flag & WNDEDIT_ES_MULTI_LINE) == 0)				nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_RETURN);			else if ((GetKeyState(VK_CONTROL) & 0x8000) == 0 && (GetKeyState(VK_SHIFT) & 0x8000) == 0)				nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_RETURN);			else if (InsertChar(0x0a, 0))			{				UpdateData();				nRet = 1;			}		}		break;	case 'V':	//粘帖		if ((GetKeyState(VK_CONTROL) & 0x8000) && Paste())			nRet = 1;		break;	case 'C':	//复制		if ((GetKeyState(VK_CONTROL) & 0x8000) && Copy())			nRet = 1;		break;	default:		if ((nKeyCode < '0' || nKeyCode > '9') &&			(nKeyCode < 'A' || nKeyCode > 'Z') &&			(nKeyCode < VK_NUMPAD0 || nKeyCode > VK_DIVIDE))		{			nRet = 0;		}	}	return nRet;}
开发者ID:viticm,项目名称:pap2,代码行数:101,


示例3: ConsoleFunc

//.........这里部分代码省略.........      lpmmi->ptMaxSize=lpmmi->ptMaxTrackSize;    } /* if */    break;  case WM_SYSKEYDOWN:  case WM_KEYDOWN:    if ((con=Hwnd2Console(hwnd))!=NULL) {      TCHAR str[20];      int i;      str[0]=__T('/0');      switch (LOWORD(wParam)) {      case VK_F1:      case VK_F2:      case VK_F3:      case VK_F4:      case VK_F5:      case VK_F6:      case VK_F7:      case VK_F8:      case VK_F9:      case VK_F10:      case VK_F11:      case VK_F12:        if (LOWORD(wParam)<=VK_F5)          _stprintf(str,__T("/033[%d~/n"),LOWORD(wParam)-VK_F1+11);        else if (LOWORD(wParam)==VK_F10)          _stprintf(str,__T("/033[%d~/n"),LOWORD(wParam)-VK_F6+17);        else          _stprintf(str,__T("/033[%d~/n"),LOWORD(wParam)-VK_F11+23);        break;      case VK_ADD:      case VK_SUBTRACT:        /* check Ctrl key */        if ((GetKeyState(VK_CONTROL) & 0x8000)!=0) {          POINT pt;          int newheight=con->cheight;          int oldheight=newheight;          int incr= (LOWORD(wParam)==VK_SUBTRACT) ? -1 : 1;          do {            newheight+=incr;            /* make a new font, re-create a caret and redraw everything */            SetConsoleFont(con,newheight);          } while (newheight>5 && (oldheight==con->cheight || con->hfont==NULL));          if (con->hfont==NULL) /* reset to original on failure */            SetConsoleFont(con,oldheight);          GetClientRect(hwnd,&rect);          DestroyCaret();          CreateCaret(hwnd,NULL,con->cwidth,2);          RefreshCaretPos(con);          /* redraw the window */          InvalidateRect(hwnd,NULL,TRUE);          /* resize the window */          SetRect(&rect,0,0,con->cwidth*con->columns,con->cheight*con->winlines);          AdjustWindowRect(&rect,GetWindowLong(hwnd,GWL_STYLE),FALSE);          pt.x=pt.y=0;          ClientToScreen(hwnd,&pt);          OffsetRect(&rect,pt.x,pt.y);          ClampToScreen(&rect);          SetWindowPos(hwnd,NULL,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,                       SWP_NOZORDER);        } /* if */        break;      case VK_UP:        _tcscpy(str,__T("/033[A"));        break;      case VK_DOWN:
开发者ID:CmaThomas,项目名称:Vault-Tec-Multiplayer-Mod,代码行数:67,


示例4: switch

LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam){	PAINTSTRUCT ps;	switch (message)	{	case WM_LBUTTONDOWN:		if (m_pDelegate && m_pTouch && MK_LBUTTON == wParam)		{            POINT pt = {(short)LOWORD(lParam), (short)HIWORD(lParam)};            if (PtInRect(&m_rcViewPort, pt))            {                m_bCaptured = true;                SetCapture(m_hWnd);                m_pTouch->SetTouchInfo((float)(pt.x - m_rcViewPort.left) / m_fScreenScaleFactor,                    (float)(pt.y - m_rcViewPort.top) / m_fScreenScaleFactor);                m_pSet->addObject(m_pTouch);                m_pDelegate->touchesBegan(m_pSet, NULL);            }		}		break;	case WM_MOUSEMOVE:		if (MK_LBUTTON == wParam && m_bCaptured)		{            m_pTouch->SetTouchInfo((float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor,                (float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor);            m_pDelegate->touchesMoved(m_pSet, NULL);		}		break;	case WM_LBUTTONUP:		if (m_bCaptured)		{			m_pTouch->SetTouchInfo((float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor,                (float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor);			m_pDelegate->touchesEnded(m_pSet, NULL);			m_pSet->removeObject(m_pTouch);            ReleaseCapture();			m_bCaptured = false;		}		break;	case WM_SIZE:		switch (wParam)		{		case SIZE_RESTORED:			CCApplication::sharedApplication().applicationWillEnterForeground();			break;		case SIZE_MINIMIZED:			CCApplication::sharedApplication().applicationDidEnterBackground();			break;		}		break;	case WM_KEYDOWN:		if (wParam == VK_F1 || wParam == VK_F2)		{			if (GetKeyState(VK_LSHIFT) < 0 ||  GetKeyState(VK_RSHIFT) < 0 || GetKeyState(VK_SHIFT) < 0)				CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(wParam == VK_F1 ? kTypeBackClicked : kTypeMenuClicked);		}		if ( m_lpfnAccelerometerKeyHook!=NULL )		{			(*m_lpfnAccelerometerKeyHook)( message,wParam,lParam );		}		break;	case WM_KEYUP:		if ( m_lpfnAccelerometerKeyHook!=NULL )		{			(*m_lpfnAccelerometerKeyHook)( message,wParam,lParam );		}		break;    case WM_CHAR:        {            if (wParam < 0x20)            {                if (VK_BACK == wParam)                {                    CCIMEDispatcher::sharedDispatcher()->dispatchDeleteBackward();                }                else if (VK_RETURN == wParam)                {                    CCIMEDispatcher::sharedDispatcher()->dispatchInsertText("/n", 1);                }                else if (VK_TAB == wParam)                {                    // tab input                }                else if (VK_ESCAPE == wParam)                {                    // ESC input					CCDirector::sharedDirector()->end();                }            }            else if (wParam < 128)            {                // ascii char                CCIMEDispatcher::sharedDispatcher()->dispatchInsertText((const char *)&wParam, 1);            }            else            {                char szUtf8[8] = {0};//.........这里部分代码省略.........
开发者ID:alexzzp,项目名称:cocos2dx-wince,代码行数:101,


示例5: switch

bool Chkdraft::DlgKeyListener(HWND hWnd, UINT &msg, WPARAM wParam, LPARAM lParam){    switch ( msg )    {        case WM_KEYDOWN:            {                switch ( wParam )                {                    case VK_TAB:                        if ( GetParent(GetParent(hWnd)) == trigEditorWindow.triggersWindow.trigModifyWindow.conditionsWindow.getHandle() ||                             GetParent(hWnd) == trigEditorWindow.triggersWindow.trigModifyWindow.conditionsWindow.getHandle() )                        {                            msg = WM_NULL; // Dirty fix to prevent tabs from being focused                            trigEditorWindow.triggersWindow.trigModifyWindow.conditionsWindow.ProcessKeyDown(wParam, lParam);                            return true;                        }                        else if ( GetParent(GetParent(hWnd)) == trigEditorWindow.triggersWindow.trigModifyWindow.actionsWindow.getHandle() ||                            GetParent(hWnd) == trigEditorWindow.triggersWindow.trigModifyWindow.actionsWindow.getHandle() )                        {                            msg = WM_NULL; // Dirty fix to prevent tabs from being focused                            trigEditorWindow.triggersWindow.trigModifyWindow.actionsWindow.ProcessKeyDown(wParam, lParam);                            return true;                        }                        break;                    case VK_RETURN:                        if ( GetParent(GetParent(hWnd)) == trigEditorWindow.triggersWindow.trigModifyWindow.conditionsWindow.getHandle() ||                             GetParent(hWnd) == trigEditorWindow.triggersWindow.trigModifyWindow.conditionsWindow.getHandle() )                        {                            trigEditorWindow.triggersWindow.trigModifyWindow.conditionsWindow.ProcessKeyDown(wParam, lParam);                            return true;                        }                        else if ( GetParent(GetParent(hWnd)) == trigEditorWindow.triggersWindow.trigModifyWindow.actionsWindow.getHandle() ||                            GetParent(hWnd) == trigEditorWindow.triggersWindow.trigModifyWindow.actionsWindow.getHandle() )                        {                            trigEditorWindow.triggersWindow.trigModifyWindow.actionsWindow.ProcessKeyDown(wParam, lParam);                            return true;                        }                        if ( GetParent(hWnd) == unitWindow.getHandle() )                        {                            unitWindow.DestroyThis();                            return true;                        }                        else if ( GetParent(hWnd) == locationWindow.getHandle() )                        {                            locationWindow.DestroyThis();                            return true;                        }                        else if ( GetParent(hWnd) == enterPasswordWindow.getHandle())                        {                            enterPasswordWindow.ButtonLogin();                            return true;                        }                        break;                    case VK_DELETE:                        if ( GetParent(hWnd) == unitWindow.getHandle() )                        {                            SendMessage(unitWindow.getHandle(), WM_COMMAND, MAKEWPARAM(IDC_BUTTON_DELETE, 0), 0);                            return true;                        }                        break;                    case 'Z': case 'Y': case 'X': case 'C': case 'V':                        if ( GetKeyState(VK_CONTROL) & 0x8000 )                        {                            KeyListener(hWnd, msg, wParam, lParam);                            return true;                        }                        break;                }            }            break;        case WM_KEYUP:            if ( wParam == VK_SPACE && CM != nullptr && maps.clipboard.isPasting() )            {                UnlockCursor();                return true;            }            break;    }    return false;}
开发者ID:RElesgoe,项目名称:Chkdraft,代码行数:80,


示例6: switch

BOOL CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam){    switch (message)    {        case WM_INITDIALOG :        {			_fileListView.init(_hInst, _hSelf, _hImaLst);			_fileListView.initList();			_fileListView.display();            return TRUE;        }		case WM_NOTIFY:		{			switch (((LPNMHDR)lParam)->code)			{				case NM_DBLCLK:				{					LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;					int i = lpnmitem->iItem;					if (i == -1)					{						::SendMessage(_hParent, WM_COMMAND, IDM_FILE_NEW, 0);					}					return TRUE;				}				case NM_CLICK:				{					if ((0x80 & GetKeyState(VK_CONTROL)) || (0x80 & GetKeyState(VK_SHIFT)))						return TRUE;					LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;					int nbItem = ListView_GetItemCount(_fileListView.getHSelf());					int i = lpnmitem->iItem;					if (i == -1 || i >= nbItem)						return TRUE;					LVITEM item;					item.mask = LVIF_PARAM;					item.iItem = i;						ListView_GetItem(((LPNMHDR)lParam)->hwndFrom, &item);					TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;					activateDoc(tlfs);					return TRUE;				}				case NM_RCLICK :				{					// Switch to the right document					LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;					int nbItem = ListView_GetItemCount(_fileListView.getHSelf());					if (nbSelectedFiles() == 1)					{						int i = lpnmitem->iItem;						if (i == -1 || i >= nbItem) 							return TRUE;						LVITEM item;						item.mask = LVIF_PARAM;						item.iItem = i;							ListView_GetItem(((LPNMHDR)lParam)->hwndFrom, &item);						TaskLstFnStatus *tlfs = (TaskLstFnStatus *)item.lParam;						activateDoc(tlfs);					}					// Redirect NM_RCLICK message to Notepad_plus handle					NMHDR	nmhdr;					nmhdr.code = NM_RCLICK;					nmhdr.hwndFrom = _hSelf;					nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom);					::SendMessage(_hParent, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr);					return TRUE;				}				case LVN_GETINFOTIP:				{					LPNMLVGETINFOTIP pGetInfoTip = (LPNMLVGETINFOTIP)lParam;					int i = pGetInfoTip->iItem;					if (i == -1)						return TRUE;					generic_string fn = getFullFilePath((size_t)i);					lstrcpyn(pGetInfoTip->pszText, fn.c_str(), pGetInfoTip->cchTextMax);					return TRUE;				}				case LVN_COLUMNCLICK:				{					LPNMLISTVIEW pnmLV = (LPNMLISTVIEW)lParam;					setHeaderOrder(pnmLV);					ListView_SortItemsEx(pnmLV->hdr.hwndFrom, ListViewCompareProc,(LPARAM)pnmLV);					return TRUE;				}				case LVN_KEYDOWN:				{					switch (((LPNMLVKEYDOWN)lParam)->wVKey)					{//.........这里部分代码省略.........
开发者ID:BrunoReX,项目名称:notepad-plus,代码行数:101,


示例7: DescribeKey

void DescribeKey(WPARAM wParam, char *keyw){	char vkc = 0; /* virtual key code */	vkc = /* maintain alphabet case */		((GetKeyState(VK_SHIFT) < 0)&&(		!(GetKeyState(VK_CAPITAL) < 0)))		? toupper((char)(wParam))		: tolower((char)(wParam));	/* numeric pad keys 0 to 10 */	if((wParam >= VK_NUMPAD0)&&	   (wParam <= VK_NUMPAD9))	{		sprintf(keyw,"[NumPad:%u]",(wParam-0x60));	}	/* keys from 0 to 9 , A to Z and space */	else if(((wParam >= 0x30) 	       &&(wParam <= 0x5A)) 	       ||(wParam == 0x20))	{		keyw[0] = vkc;		keyw[1] = 0;	}	else switch(wParam)	{	case VK_CANCEL:		strcpy(keyw,"[CTRL-BRK]");		break;	case VK_BACK:		strcpy(keyw,"[BACK]");		break;	case VK_TAB:		strcpy(keyw,"[TAB]");		break;	case VK_CLEAR:		strcpy(keyw,"[CLEAR]");		break;	case VK_RETURN:		strcpy(keyw,"[ENTER]/r/n");		break;	case VK_SHIFT:		strcpy(keyw,"[SHIFT]");		break;	case VK_CONTROL:		strcpy(keyw,"[CTRL]");		break;	case VK_MENU:		strcpy(keyw,"[ALT]");		break;	case VK_PAUSE:		strcpy(keyw,"[PAUSE]");		break;	case VK_CAPITAL:		strcpy(keyw,"[CapsLock]");		break;	case VK_ESCAPE:		strcpy(keyw,"[ESC]");		break;	case VK_PRIOR:		strcpy(keyw,"[PageUp]");		break;	case VK_NEXT:		strcpy(keyw,"[PageDown]");		break;	case VK_END:		strcpy(keyw,"[END]");		break;	case VK_HOME:		strcpy(keyw,"[HOME]");		break;	case VK_LEFT:		strcpy(keyw,"[LEFT]");		break;	case VK_UP:		strcpy(keyw,"[UP]");		break;	case VK_RIGHT:		strcpy(keyw,"[RIGHT]");		break;	case VK_DOWN:		strcpy(keyw,"[DOWN]");		break;	case VK_SELECT:		strcpy(keyw,"[SELECT]");		break;	case VK_EXECUTE:		strcpy(keyw,"[EXECUTE]");		break;	case VK_SNAPSHOT:		strcpy(keyw,"[PrintScreen]");		break;	case VK_INSERT:		strcpy(keyw,"[INSERT]");		break;	case VK_DELETE:		strcpy(keyw,"[DELETE]");		break;//.........这里部分代码省略.........
开发者ID:hansongjing,项目名称:Old-Projects,代码行数:101,


示例8: ContinueExecution

void ContinueExecution(){	static BOOL pageflipping    = 0; //?	const double fUsecPerSec        = 1.e6;#if 1	const UINT nExecutionPeriodUsec = 1000;		// 1.0ms//	const UINT nExecutionPeriodUsec = 100;		// 0.1ms	const double fExecutionPeriodClks = g_fCurrentCLK6502 * ((double)nExecutionPeriodUsec / fUsecPerSec);#else	const double fExecutionPeriodClks = 1800.0;	const UINT nExecutionPeriodUsec = (UINT) (fUsecPerSec * (fExecutionPeriodClks / g_fCurrentCLK6502));#endif	//	bool bScrollLock_FullSpeed = g_uScrollLockToggle									? g_bScrollLock_FullSpeed									: (GetKeyState(VK_SCROLL) < 0);	g_bFullSpeed = ( (g_dwSpeed == SPEED_MAX) || 					 bScrollLock_FullSpeed ||					 (DiskIsSpinning() && enhancedisk && !Spkr_IsActive() && !MB_IsActive()) );	if(g_bFullSpeed)	{		// Don't call Spkr_Mute() - will get speaker clicks		MB_Mute();		SysClk_StopTimer();		g_nCpuCyclesFeedback = 0;	// For the case when this is a big -ve number	}	else	{		// Don't call Spkr_Demute()		MB_Demute();		SysClk_StartTimerUsec(nExecutionPeriodUsec);	}	//	int nCyclesToExecute = (int) fExecutionPeriodClks + g_nCpuCyclesFeedback;	if(nCyclesToExecute < 0)		nCyclesToExecute = 0;	DWORD dwExecutedCycles = CpuExecute(nCyclesToExecute);	g_dwCyclesThisFrame += dwExecutedCycles;	//	cyclenum = dwExecutedCycles;	DiskUpdatePosition(dwExecutedCycles);	JoyUpdatePosition();	VideoUpdateVbl(g_dwCyclesThisFrame);	SpkrUpdate(cyclenum);	sg_SSC.CommUpdate(cyclenum);	PrintUpdate(cyclenum);	//	const DWORD CLKS_PER_MS = (DWORD)g_fCurrentCLK6502 / 1000;	emulmsec_frac += dwExecutedCycles;	if(emulmsec_frac > CLKS_PER_MS)	{		emulmsec += emulmsec_frac / CLKS_PER_MS;		emulmsec_frac %= CLKS_PER_MS;	}	//	// DETERMINE WHETHER THE SCREEN WAS UPDATED, THE DISK WAS SPINNING,	// OR THE KEYBOARD I/O PORTS WERE BEING EXCESSIVELY QUERIED THIS CLOCKTICK	VideoCheckPage(0);	BOOL screenupdated = VideoHasRefreshed();	BOOL systemidle    = 0;	//(KeybGetNumQueries() > (clockgran << 2));	//  && (!ranfinegrain);	// TO DO	if(screenupdated)		pageflipping = 3;	//	if(g_dwCyclesThisFrame >= dwClksPerFrame)	{		g_dwCyclesThisFrame -= dwClksPerFrame;		if(g_nAppMode != MODE_LOGO)		{			VideoUpdateFlash();			static BOOL  anyupdates     = 0;			static DWORD lastcycles     = 0;			static BOOL  lastupdates[2] = {0,0};			anyupdates |= screenupdated;			////.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:applewin-svn,代码行数:101,


示例9: PreTranslateMessage

BOOL CSiteGroupsTree::PreTranslateMessage(MSG *msg){    if (msg->message == WM_KEYDOWN) {		// When an item is being edited make sure the edit control		// receives certain important key strokes		if (GetEditControl() && (msg->wParam == VK_RETURN || msg->wParam == VK_DELETE || msg->wParam == VK_ESCAPE || GetKeyState(VK_CONTROL))) {			::TranslateMessage(msg);			::DispatchMessage(msg);			return TRUE; // Do NOT process further		}    }    return CTreeCtrl::PreTranslateMessage(msg);}
开发者ID:death,项目名称:webwatch,代码行数:14,


示例10: _window_proc

static LRESULT CALLBACK _window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) {      TRACKMOUSEEVENT tme = {0};  switch ( msg ) {    case APP_WINDOW_CREATE: {      RECT rect;      GetClientRect(hwnd, &rect);      window.w = rect.right-rect.left;      window.h = rect.bottom-rect.top;      window.created = 1;      pushL_windowevent("create");            return 0;                            }    case WM_ACTIVATEAPP:      if ( wparam ) {        window.activated = 1;        SetForegroundWindow(hwnd);        LockSetForegroundWindow( LSFW_LOCK );        InvalidateRect(hwnd, 0, 0);        if (window.created) pushL_windowevent("activate");      }      else {        window.activated = 0;        if (window.created) pushL_windowevent("deactivate");      }                return 0;    case APP_TICK:  	  window.timerposted = 0;      pushL_tick();            return 0;    case WM_DESTROY:            PostQuitMessage(0);      return 0;    case WM_SHOWWINDOW:      if (wparam) {        if (window.created) pushL_windowevent("show");      }       else {        if (window.created) pushL_windowevent("hide");      }      return 0;    case WM_MOVE:      if ( !IsIconic( hwnd ) ) {        window.x = (int)(short)LOWORD( lparam );        window.y = (int)(short)HIWORD( lparam );        if (window.created) pushL_windowevent("move");              }      return 0;        case WM_SIZE:      if ( SIZE_MAXIMIZED == wparam || SIZE_RESTORED == wparam ) {        window.w = LOWORD( lparam );        window.h = HIWORD( lparam );        if (window.created) {          pushL_windowevent("resize");                        pushL_draw();                  SwapBuffers(window.hdc);          }      }      return 0;    case WM_ERASEBKGND:      return 1;    case WM_PAINT:      if ( GetUpdateRect(hwnd, 0, FALSE) ) {        ValidateRect(hwnd, 0 );        pushL_draw();                SwapBuffers(window.hdc);        }      return 0;    case WM_APPCOMMAND:      switch ( GET_APPCOMMAND_LPARAM( lparam ) ) {        case APPCOMMAND_COPY:           pushL_command("copy");          break;        case APPCOMMAND_CUT:             pushL_command("cut");          break;        case APPCOMMAND_PASTE:           pushL_command("paste");          break;        default:          return DefWindowProc(hwnd, msg, wparam, lparam);      }      return 1;        case WM_MBUTTONDBLCLK:      pushL_mousedblclick(GET_X_LPARAM( lparam ), GET_Y_LPARAM( lparam ), "middle",         GetKeyState( VK_MENU ) & 0x8000,         GetKeyState( VK_CONTROL ) & 0x8000,         GetKeyState( VK_SHIFT ) & 0x8000);      return 0;//.........这里部分代码省略.........
开发者ID:matthewburk,项目名称:cel-reactor,代码行数:101,


示例11: Position

void CCamera::CheckForMovement(){		// Once we have the frame interval, we find the current speed	float speed = (float)(kSpeed * g_FrameInterval);	// Store the last position and view of the camera	CVector3 vOldPosition = Position();	CVector3 vOldView = View();	// Use a flag to see if we movement backwards or not	bool bMovedBack = false;/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *	// Here is where we subtract the gravity acceleration from our velocity vector.	// We then add that velocity vector to our camera to effect our camera (or player)	// This is also how we handle the jump velocity when we hit space bar.	// Notice that we multiply the gravity by the frame interval (dt).  This makes	// it so faster video cards don't do a 2 frame jump, while TNT2 cards do 20 frames :)	// This is necessary to make every computer use the same movement and jump speed.	g_vVelocity.y -= (float)(kGravity * g_FrameInterval);	m_vPosition = m_vPosition + g_vVelocity;/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *	// Check if we hit the Up arrow or the 'w' key	if(GetKeyState(VK_UP) & 0x80 || GetKeyState('W') & 0x80) {						// Move our camera forward by a positive SPEED		MoveCamera(speed);					}	// Check if we hit the Down arrow or the 's' key	if(GetKeyState(VK_DOWN) & 0x80 || GetKeyState('S') & 0x80) {					// Move our camera backward by a negative SPEED		MoveCamera(-speed);			bMovedBack = true;	}	// Check if we hit the Left arrow or the 'a' key	if(GetKeyState(VK_LEFT) & 0x80 || GetKeyState('A') & 0x80) {					// Strafe the camera left		StrafeCamera(-speed);	}	// Check if we hit the Right arrow or the 'd' key	if(GetKeyState(VK_RIGHT) & 0x80 || GetKeyState('D') & 0x80) {					// Strafe the camera right		StrafeCamera(speed);	}		// Now that we moved, let's get the current position and test our movement	// vector against the level data to see if there is a collision.	CVector3 vCurrentPosition = Position();	// Check for collision with AABB's and grab the new position	CVector3 vNewPosition = g_Level.TraceBox(vOldPosition, vCurrentPosition,		                                     CVector3(-20, -50, -20), CVector3(20, 50, 20));	// Check if we collided and we moved backwards	if(g_Level.Collided() && bMovedBack)	{		// If or x or y didn't move, then we are backed into a wall so restore the view vector		if(vNewPosition.x == vOldPosition.x || vNewPosition.z == vOldPosition.z)			m_vView = vOldView;			}	// Set the new position that was returned from our trace function	m_vPosition = vNewPosition;/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *	// After we check for collision, we only want to add the velocity vector to	// our view vector when we are falling.  If we aren't on the ground then	// we don't want to push the the camera view down to the ground.  It's okay	// if the position goes down because the collision detection fixes that so	// we don't go through the ground, however, it's not natural to push the view	// down too.  Well, assuming is strong enough to push our face down to the ground :)	if(!g_Level.IsOnGround())		m_vView = m_vView + g_vVelocity;	else	{		// If we ARE on the ground, we want to get rid of the jump acceleration		// that we add when the user hits the space bar.  Below we check to see		// if our velocity is below 0 then we are done with our jump and can just		// float back to the ground by the gravity.  We do also add our gravity		// acceleration to the velocity every frame, so this resets this to zero		// for that as well.		if(g_vVelocity.y < 0)			g_vVelocity.y = 0;	}/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *//.........这里部分代码省略.........
开发者ID:88er,项目名称:tutorials,代码行数:101,


示例12: PreTranslateMessage

BOOL CTreeFileCtrl::PreTranslateMessage(MSG* pMsg) {  // When an item is being edited make sure the edit control  // receives certain important key strokes  if (GetEditControl())  {    ::TranslateMessage(pMsg);    ::DispatchMessage(pMsg);    return TRUE; // DO NOT process further  }  //Context menu via the keyboard	if ((((pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) && // If we hit a key and    	(pMsg->wParam == VK_F10) && (GetKeyState(VK_SHIFT) & ~1)) != 0) ||   // it's Shift+F10 OR		  (pMsg->message == WM_CONTEXTMENU))						                   	   // Natural keyboard key	{		CRect rect;		GetItemRect(GetSelectedItem(), rect, TRUE);		ClientToScreen(rect);		OnContextMenu(NULL, rect.CenterPoint());		return TRUE;	}  //Hitting the Escape key, Cancelling drag & drop	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE && IsDragging())  {    EndDragging(TRUE);    return TRUE;  }  //Hitting the Alt-Enter key combination, show the properties sheet 	else if (pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_RETURN)  {    OnFileProperties();    return TRUE;  }  //Hitting the Enter key, open the item	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)  {    OnFileOpen();    return TRUE;  }  //Hitting the delete key, delete the item  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE)  {    OnFileDelete();    return TRUE;  }  //hitting the backspace key, go to the parent folder  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_BACK)  {    UpOneLevel();    return TRUE;  }  //hitting the F2 key, being in-place editing of an item  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F2)  {    OnFileRename();    return TRUE;  }  //hitting the F5 key, force a refresh of the whole tree  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F5)  {    OnViewRefresh();    return TRUE;  }  //Let the parent class do its thing	return CTreeCtrl::PreTranslateMessage(pMsg);}
开发者ID:5432935,项目名称:genesis3d,代码行数:68,


示例13: KillTimer

void CTreeFileCtrl::EndDragging(BOOL bCancel){  if (IsDragging())  {    KillTimer(m_nTimerID);    CImageList::DragLeave(this);    CImageList::EndDrag();    ReleaseCapture();    delete m_pilDrag;    m_pilDrag = NULL;    //Remove drop target highlighting    SelectDropTarget(NULL);    m_hItemDrop = GetDropTarget(m_hItemDrop);    if (m_hItemDrop == NULL)      return;    if (!bCancel)    {      //Also need to make the change on disk      CString sFromPath = ItemToPath(m_hItemDrag);      CString sToPath = ItemToPath(m_hItemDrop);      int nFromLength = sFromPath.GetLength();      int nToLength = sToPath.GetLength();      SHFILEOPSTRUCT shfo;      ZeroMemory(&shfo, sizeof(SHFILEOPSTRUCT));      shfo.hwnd = GetSafeHwnd();      if ((GetKeyState(VK_CONTROL) & 0x8000))        shfo.wFunc = FO_COPY;      else        shfo.wFunc = FO_MOVE;      shfo.fFlags = FOF_SILENT | FOF_NOCONFIRMMKDIR;      //Undo is not allowed if the SHIFT key is held down      if (!(GetKeyState(VK_SHIFT) & 0x8000))        shfo.fFlags |= FOF_ALLOWUNDO;      TCHAR* pszFrom = new TCHAR[nFromLength + 2];      _tcscpy(pszFrom, sFromPath);      pszFrom[nFromLength+1] = _T('/0');      shfo.pFrom = pszFrom;      TCHAR* pszTo = new TCHAR[nToLength + 2];      _tcscpy(pszTo, sToPath);      pszTo[nToLength+1] = _T('/0');      shfo.pTo = pszTo;      //Let the shell perform the actual deletion      BOOL bSuccess = ((SHFileOperation(&shfo) == 0) && (shfo.fAnyOperationsAborted == FALSE));      //Free up the memory we had allocated      delete [] pszFrom;      delete [] pszTo;      if (bSuccess)      {        //Only copy the item in the tree if there is not an item with the same        //text under m_hItemDrop        CString sText = GetItemText(m_hItemDrag);        if (!HasChildWithText(m_hItemDrop, sText))        {          //Do the actual copy          BOOL bHadChildren = (GetChildItem(m_hItemDrop) != NULL);          CopyBranch(m_hItemDrag, m_hItemDrop);          //Update the children indicator for the folder we just dropped into          if (!bHadChildren)          {            TV_ITEM tvItem;            tvItem.hItem = m_hItemDrop;            tvItem.mask = TVIF_CHILDREN;              tvItem.cChildren = 1;            SetItem(&tvItem);          }        }        BOOL bExpanded = (GetChildItem(m_hItemDrop) != NULL);         if (shfo.wFunc == FO_MOVE)        {          //Get the parent of the item we moved prior to deleting it          HTREEITEM hParent = GetParentItem(m_hItemDrag);          //Delete the item we just moved          DeleteItem(m_hItemDrag);          //Update the children indicator for the item we just dragged from          BOOL bHasChildren = (GetChildItem(hParent) != NULL);          if (hParent && !bHasChildren)          {            TV_ITEM tvItem;            tvItem.hItem = hParent;            tvItem.mask = TVIF_CHILDREN;              tvItem.cChildren = 0;            SetItem(&tvItem);          }//.........这里部分代码省略.........
开发者ID:5432935,项目名称:genesis3d,代码行数:101,


示例14: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam){    HDC hDC, hGenDC;    HBRUSH hBrush;    BOOL bNeedsMovement;    const long SROLLUP = 120;    const long SROLLDOWN = 65416;    COLORREF crRandom;    switch(nMsg)    {    case WM_CTLCOLORSTATIC:        hGenDC = (HDC) wParam;        SetTextColor(hGenDC, RGB(0, 0xFF, 0xFF));        SetBkColor(hGenDC, crWndColor);        hBrush = CreateSolidBrush(crWndColor);        return (INT_PTR)hBrush;    case WM_CLOSE:        ReleaseDC(hLblHelp, hGenDC);        DeleteObject(hBrush);        KillTimer(hWnd, nIDTmr);        DestroyWindow(hWnd);        PostQuitMessage(0);        return TRUE;    case WM_SETCURSOR:        if(wParam == (WPARAM)hLblHelp)            SetCursor(LoadCursor(NULL, IDC_HAND));        else            SetCursor(LoadCursor(NULL, IDC_ARROW));        return TRUE;    case WM_COMMAND:    {        if((HWND)lParam == hLblHelp)            DialogBox(NULL, MAKEINTRESOURCE(IDD_DLG), hWnd, DlgProc);        return TRUE;    }    case WM_KEYDOWN:    {        bNeedsMovement = FALSE;        if(wParam == VK_X && (GetKeyState(VK_CONTROL ) & 8000))        {            ReleaseDC(hLblHelp, hGenDC);            DeleteObject(hBrush);            //KillTimer(hWnd, nIDTmr);            DestroyWindow(hWnd);            PostQuitMessage(0);            return TRUE;        }        if(wParam == VK_UP && (GetKeyState(VK_CONTROL ) & 8000))        {            POSY = POSY > -1 ? POSY - 1 : POSY;            bNeedsMovement = TRUE;        }        if(wParam == VK_DOWN && (GetKeyState(VK_CONTROL ) & 8000))        {            POSY = POSY < 1 ? POSY + 1 : POSY;            bNeedsMovement = TRUE;        }        if(wParam == VK_LEFT && (GetKeyState(VK_CONTROL ) & 8000))        {            POSX = POSX > -1 ? POSX - 1 : POSX;            bNeedsMovement = TRUE;        }        if(wParam == VK_RIGHT && (GetKeyState(VK_CONTROL ) & 8000))        {            POSX = POSX < 1 ? POSX + 1 : POSX;            bNeedsMovement = TRUE;        }        if(GetKeyState(VK_LCONTROL ) & 8000 && (wParam > 48 && wParam < 58))        {            crDigitColor = PRESETS[(long)wParam - 49];            crColonColor = PRESETS[(long)wParam - 49];            fnParseTime(hWnd);        }        if(GetKeyState(VK_RCONTROL ) & 8000 && (wParam > 48 && wParam < 58))        {            crColonColor = PRESETS[(long)wParam - 49];            fnParseTime(hWnd);        }        if(GetKeyState(VK_LCONTROL ) & 8000 && wParam == VK_0)        {            crRandom = RGB(fnRandom(255), fnRandom(255), fnRandom(255));            crDigitColor = crRandom;            crColonColor = crRandom;            fnParseTime(hWnd);        }        if(GetKeyState(VK_RCONTROL ) & 8000 && wParam == VK_0)        {            crColonColor = RGB(fnRandom(255), fnRandom(255), fnRandom(255));            fnParseTime(hWnd);        }        if(GetKeyState(VK_CONTROL ) & 8000 && wParam == VK_H)        {            HELP = !HELP;            if(HELP)                ShowWindow(hLblHelp, SW_SHOWNORMAL);//.........这里部分代码省略.........
开发者ID:kineticpsychology,项目名称:windows.win32.apps,代码行数:101,


示例15: key_callback

bool CConsoleInput::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods){	if (key == GLFW_KEY_TAB && action == GLFW_RELEASE)	{		gSys->pInput->removeListener(this);		gSys->Log("=== Console inactive ===");		text = "";	}	if (key == GLFW_KEY_ENTER && action == GLFW_RELEASE)	{		const char* str = text.c_str();		gSys->pConsoleSystem->handleCommand(str);		gSys->Log(str);		gSys->Log("=== Console inactive ===");		gSys->pInput->removeListener(this);		text = "";	}		if (glfwGetKey(window, GLFW_KEY_CAPS_LOCK) == GLFW_RELEASE) // CAPS functionality	{		caps = (GetKeyState(VK_CAPITAL) & 0x0001) != 0; // caps = !caps fails because this gets called when keys are repeated, wierd indeed...	}		char character = -1;	if ((action == GLFW_RELEASE || action == GLFW_REPEAT) && key >= GLFW_KEY_A && key <= GLFW_KEY_Z) // Letters, capital too	{		if ((glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) != caps) // Shift key capitalizes		{			character = key;		}		else		{			character = key + 32;		}	}	else if ((action == GLFW_RELEASE || action == GLFW_REPEAT) && key >= GLFW_KEY_0 && key <= GLFW_KEY_9) // Numbers	{		character = key;	}	else if ((action == GLFW_RELEASE || action == GLFW_REPEAT) && key == GLFW_KEY_SPACE)	{		character = ' ';	}	else if ((action == GLFW_RELEASE || action == GLFW_REPEAT) && key == GLFW_KEY_SLASH) // '-' + shift => '_'	{		if (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS)		{			character = '_';		}	}	else if ((action == GLFW_RELEASE || action == GLFW_REPEAT) && key == GLFW_KEY_BACKSPACE) // Deleting text	{		text = text.substr(0, text.length() - 1);	}	if (character == -1) // Check if accepted key was pressed		return true;	text += character;		return true;}
开发者ID:MergHQ,项目名称:shine,代码行数:63,


示例16: test_key

static bool test_key(unsigned k){	return (GetKeyState(k) & 0x8000) ? true : false;}
开发者ID:thenfour,项目名称:WMircP,代码行数:4,


示例17: caps

CConsoleInput::CConsoleInput()	: caps((GetKeyState(VK_CAPITAL) & 0x0001) != 0) // Uses Windows API{}
开发者ID:MergHQ,项目名称:shine,代码行数:4,


示例18: WindowProc

LONG WINAPI WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {	poWindow *win = (poWindow*)GetWindowLongPtr(hwnd, GWL_USERDATA);	switch(uMsg) {		case WM_DESTROY:			PostQuitMessage(0);			break;		case WM_SIZE:			window_width = LOWORD(lParam);			window_height = HIWORD(lParam);			if(win) win->resized(0,0,window_width,window_height);			break;		case WM_RBUTTONDOWN:			::SetCapture(hwnd);			isDragging = true;			if(win) win->mouseDown(LOSHORT(lParam), HISHORT(lParam), 0);			break;		case WM_RBUTTONUP:			::ReleaseCapture();			isDragging = false;				if(win) win->mouseUp(LOSHORT(lParam), HISHORT(lParam), 0);			break;		case WM_LBUTTONDOWN:			::SetCapture(hwnd);			isDragging = true;			if(win) win->mouseDown(LOSHORT(lParam), HISHORT(lParam), 0);			break;		case WM_LBUTTONUP:			::ReleaseCapture();			isDragging = false;			if(win) win->mouseUp(LOSHORT(lParam), HISHORT(lParam), 0);			break;		case WM_MBUTTONDOWN:			::SetCapture(hwnd);			isDragging = true;			if(win) win->mouseDown(LOSHORT(lParam), HISHORT(lParam), 0);			break;		case WM_MBUTTONUP:			::ReleaseCapture();			isDragging = false;				if(win) win->mouseUp(LOSHORT(lParam), HISHORT(lParam), 0);			break;		case WM_MOUSEMOVE:			if( isDragging )				if(win) win->mouseDrag(LOSHORT(lParam), HISHORT(lParam), 0);			else				if(win) win->mouseMove(LOSHORT(lParam), HISHORT(lParam), 0);			break;		case WM_MOUSEWHEEL:			break;		case WM_SYSKEYDOWN: 			{				// alt-f4 ... pass to close the window				bool alt_down = (GetKeyState(VK_LMENU) & 0x80) || (GetKeyState(VK_RMENU) & 0x80) || (GetKeyState(VK_MENU) & 0x80);				if(VK_F4 == wParam && alt_down) {					PostMessage(hwnd, WM_CLOSE, 0, 0);					break;				}			}		case WM_KEYDOWN:			if(VK_F1 == wParam)				doFullscreen(hwnd, !is_fullscreen);			else				if(win) win->keyDown(mapVirtualKey(wParam), wParam, getKeyModifiers());			break;		case WM_SYSKEYUP:		case WM_KEYUP:				if(win) win->keyUp(mapVirtualKey(wParam), wParam, getKeyModifiers());			break;		case WM_KILLFOCUS:			// if we lose capture during a drag, post a mouse up event as a notifier			if( isDragging ) {				if(win) win->mouseDrag(LOSHORT(lParam), HISHORT(lParam), 0);			}			isDragging = false;			break;		case WM_ACTIVATE:			// make sure our fullscreen window plays nice with the task switcher			if(is_fullscreen) {				// if we're loosing focus, minimize to system tray				bool is_deactivated = WA_INACTIVE == LOWORD(wParam);				if(is_deactivated)					ShowWindow(hwnd,SW_SHOWMINIMIZED);				else					// sw_showmaximized flashes the title bar					// sw_show flashes the system tray, go figure					ShowWindow(hwnd,SW_SHOWMAXIMIZED);			}			break;//.........这里部分代码省略.........
开发者ID:Potion,项目名称:pocode,代码行数:101,


示例19: GetMsgProc

static LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParamIn, LPARAM lParamIn){  dbg("InputHandler: GetMsgProc");  HWND win = ihGlobal.getHWND();  if(!win) {    //dbg("!win");    return CallNextHookEx(NULL, nCode, wParamIn, lParamIn); // Hook window not set  }  MSG* msg = (MSG*) lParamIn;  WPARAM wParam = msg->wParam;  LPARAM lParam = msg->lParam;  UINT wmsg = msg->message;  // Keyboard hooks  switch(wmsg) {    case WM_KEYUP:      if(GetKeyState(VK_APPLICATION) < 0) {        ihGlobal.keyDown((int)wParam);        msg->message = WM_NULL;        break;      }      if(wParam == VK_SNAPSHOT)        ihGlobal.keyDown((int)wParam);      break;    case WM_KEYDOWN:      if(GetKeyState(VK_APPLICATION) < 0) {        ihGlobal.keyUp((int)wParam);        msg->message = WM_NULL;        break;      }      if(wParam == VK_SNAPSHOT)        ihGlobal.keyUp((int)wParam);      break;  }  bool hookAllWindows = false;  if(msg->hwnd != win && !hookAllWindows) {    char msgTxt[256];    switch(wmsg) {      case MOUSE_ALL_WM_EVENTS:        strcpy(msgTxt, getMouseEventName(wmsg));        break;      default:        sprintf(msgTxt, "0x%08X", wmsg);        break;    }    char name[256];    GetWindowText(msg->hwnd, name, 256);    dbg_input("win %d != %d (%s, %s)", msg->hwnd, win, name, msgTxt);    /*if(wmsg == WM_INPUT)      msg->message = WM_NULL;*/		return CallNextHookEx(NULL, nCode, wParamIn, lParamIn); // Not our window  }  if(wmsg == WM_MOUSELEAVE)    msg->message = WM_NULL;  switch(wmsg) {    // Mouse hooks#define DBG_MSG(x) case x: dbg("PrimaryWindow: %s", #x); break    DBG_MSG(WM_ACTIVATE);    DBG_MSG(WM_MOUSEACTIVATE);    case WM_MOUSELEAVE:    case WM_NCMOUSELEAVE:      // Discard mouse leave messages - TODO: recall TrackMouseEvent      msg->message = WM_NULL;      break;    case MOUSE_ALL_WM_EVENTS: // Note: special macro    {      if(!SoftTHActive)        break;      if(msg->wParam & MOUSE_EVENTS_ALREADY_MAPPED && wmsg != WM_MOUSEWHEEL) {        // This message came from secondary SoftTH window and is already in correct coordinates        msg->wParam -= MOUSE_EVENTS_ALREADY_MAPPED;        dbg_input("PrimaryWindow: %s: %dx%d MOUSE_EVENTS_ALREADY_MAPPED (wparam: 0x%08X)", getMouseEventName(wmsg), msg->pt.x, msg->pt.y, msg->wParam);        // Send click to overlay        if(wmsg == WM_LBUTTONDOWN || wmsg == WM_LBUTTONUP)        {          OVERLAY_CLICK_BLOCK p;          p.overlayVersion = OVERLAY_VERSION;          p.x = msg->pt.x;          p.y = msg->pt.y;          p.up = wmsg==WM_LBUTTONUP;          p.event = wmsg;          p.lparam = msg->lParam;          p.wparam = msg->wParam;          p.appWindow = win;          overlayDoClick(&p);        }//.........这里部分代码省略.........
开发者ID:KimimaroTsukimiya,项目名称:SoftTH,代码行数:101,


示例20: gtab_key

/* handle key-down events - scroll windows and/or move selection */intgtab_key(HWND hwnd, lpTable ptab, int vkey){    long startrow, ncells, startcell;    BOOL bControl = FALSE;    BOOL bShift = FALSE;    if (GetKeyState(VK_CONTROL) & 0x8000) {        bControl = TRUE;    }    if (GetKeyState(VK_SHIFT) & 0x8000) {        /* ignore shift key here if TM_MANY -multiple selection flag- is         * not selected         */        if (ptab->hdr.selectmode & TM_MANY) {            bShift = TRUE;        }    }    switch(vkey) {    case VK_UP:        if (bControl) {            /* control-uparrow scrolls window without selection.             * the selection is de-selected (to avoid surprises             * moving back to it).             */            gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);            gtab_dovscroll(hwnd, ptab, -1);        } else {            /* uparrow moves selection up one line */            gtab_changesel(hwnd, ptab, -1, 0, FALSE, bShift);        }        return(0);    case VK_DOWN:        if (bControl) {            /* control downarrow scrolls window without             * a selection.             */            gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);            gtab_dovscroll(hwnd, ptab, 1);        } else {            /* the normal gtab_changesel behaviour is             * that if the selected line is not visible now,             * we scroll it to the top of the window. This is fine             * in most cases but causes unacceptable jumps when             * repeatedly scrolling down with the down key.             *             * Thus we now have an argument to changesel to say             * that in this case, if you need to move the line onto             * the window, move it to the bottom and not the top             */            gtab_changesel(hwnd, ptab, 1, 0, TRUE, bShift);        }        return(0);    case VK_LEFT:        /* if cell-selection mode, move left one cell.         * otherwise the whole row is selected - scroll         * the line left a little         */        if (ptab->hdr.selectmode & TM_ROW) {            if (bControl) {                /* ctrl-left moves to start of line */                gtab_dohscroll(hwnd, ptab, -(ptab->scroll_dx));            } else {                gtab_dohscroll(hwnd, ptab, -(ptab->avewidth));            }        } else {            gtab_changesel(hwnd, ptab, 0, -1, FALSE, bShift);        }        return(0);    case VK_RIGHT:        /* if cell-selection mode, move right one cell.         * otherwise the whole row is selected - scroll         * the line right a little         */        if (ptab->hdr.selectmode & TM_ROW) {            if (bControl) {                /* control-right moves to right end of line */                gtab_dohscroll(hwnd, ptab, ptab->rowwidth -                                ptab->winwidth);            } else {                gtab_dohscroll(hwnd, ptab, ptab->avewidth);            }        } else {            gtab_changesel(hwnd, ptab, 0, 1, TRUE, bShift);        }        return(0);    case VK_HOME:        if (bControl) {            /* control-home == top of file */            gtab_dovscroll(hwnd, ptab, -(ptab->toprow));        }        /* top of window *///.........这里部分代码省略.........
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:101,


示例21: SysLinkWindowProc

/*********************************************************************** *           SysLinkWindowProc */static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,                                        WPARAM wParam, LPARAM lParam){    SYSLINK_INFO *infoPtr;    TRACE("hwnd=%p msg=%04x wparam=%lx lParam=%lx/n", hwnd, message, wParam, lParam);    infoPtr = (SYSLINK_INFO *)GetWindowLongPtrW(hwnd, 0);    if (!infoPtr && message != WM_CREATE)        goto HandleDefaultMessage;    switch(message) {    case WM_PRINTCLIENT:    case WM_PAINT:        return SYSLINK_Paint (infoPtr, (HDC)wParam);    case WM_SETCURSOR:    {        LHITTESTINFO ht;        DWORD mp = GetMessagePos();                ht.pt.x = (short)LOWORD(mp);        ht.pt.y = (short)HIWORD(mp);                ScreenToClient(infoPtr->Self, &ht.pt);        if(SYSLINK_HitTest (infoPtr, &ht))        {            SetCursor(LoadCursorW(0, (LPCWSTR)IDC_HAND));            return TRUE;        }        /* let the default window proc handle this message */        goto HandleDefaultMessage;    }    case WM_SIZE:    {        RECT rcClient;        if (GetClientRect(infoPtr->Self, &rcClient))        {            HDC hdc = GetDC(infoPtr->Self);            if(hdc != NULL)            {                SYSLINK_Render(infoPtr, hdc, &rcClient);                ReleaseDC(infoPtr->Self, hdc);            }        }        return 0;    }    case WM_GETFONT:        return (LRESULT)infoPtr->Font;    case WM_SETFONT:        return (LRESULT)SYSLINK_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam);    case WM_SETTEXT:        SYSLINK_SetText(infoPtr, (LPWSTR)lParam);        goto HandleDefaultMessage;    case WM_LBUTTONDOWN:    {        POINT pt;        pt.x = (short)LOWORD(lParam);        pt.y = (short)HIWORD(lParam);        return SYSLINK_LButtonDown(infoPtr, wParam, &pt);    }    case WM_LBUTTONUP:    {        POINT pt;        pt.x = (short)LOWORD(lParam);        pt.y = (short)HIWORD(lParam);        return SYSLINK_LButtonUp(infoPtr, wParam, &pt);    }        case WM_KEYDOWN:    {        switch(wParam)        {        case VK_RETURN:            SYSLINK_OnEnter(infoPtr);            return 0;        case VK_TAB:        {            BOOL shift = GetKeyState(VK_SHIFT) & 0x8000;            SYSKEY_SelectNextPrevLink(infoPtr, shift);            return 0;        }        }        goto HandleDefaultMessage;    }        case WM_GETDLGCODE:    {        LRESULT Ret = DLGC_HASSETSEL;        int vk = (lParam != 0 ? (int)((LPMSG)lParam)->wParam : 0);        switch(vk)//.........这里部分代码省略.........
开发者ID:WASSUM,项目名称:longene_travel,代码行数:101,


示例22: gtab_press

/* * called on mouse-down events. decide what to start tracking. */voidgtab_press(HWND hwnd, lpTable ptab, int x, int y){    long cell, ncells;    long row;    if (ptab->trackmode != TRACK_NONE) {        return;    }    /* has he grabbed a cell-edge to resize ? */    cell = gtab_xtocol(hwnd, ptab, x);    if (cell == -1) {        return;    }    if (gtab_isborder(hwnd, ptab, x, cell)) {        gtab_trackcol(hwnd, ptab, cell, x);        return;    }    if ( (cell > 0) && gtab_isborder(hwnd, ptab, x, cell-1)) {        gtab_trackcol(hwnd, ptab, cell, x);        return;    }    /* find which line he selected */    row = gtab_linetorow(hwnd, ptab, gtab_ytoline(hwnd, ptab, y));    /* is he selecting a disabled fixed area ? */    if ( (row < ptab->hdr.fixedrows) || (cell < ptab->hdr.fixedcols)) {        if (ptab->hdr.fixedselectable == FALSE) {            return;        }    }    // ignore if beyond data    if ((row >= ptab->hdr.nrows) ||            (cell >= ptab->hdr.ncols)) {        return;    }    /* ok, start cell selection */    ptab->trackmode = TRACK_CELL;    SetCapture(hwnd);    /* record and paint new selection */    if (ptab->hdr.selectmode & TM_ROW) {        cell = 0;        ncells = ptab->hdr.ncols;    } else {        ncells = 1;    }    /*     * if the shift key is down, then extend the selection to this     * new anchor point, rather than create a new selection     */    if (GetKeyState(VK_SHIFT) & 0x8000) {        gtab_extendsel(hwnd, ptab, row, cell, FALSE);    } else {        gtab_select(hwnd, ptab, row, cell, 1, ncells, FALSE);    }    return;}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:68,


示例23: IsCapsLock

bool IsCapsLock( void ) {	return ( GetKeyState( VK_CAPITAL ) & 1 ) != 0;}
开发者ID:TReKiE,项目名称:freecompose,代码行数:3,


示例24: DIB_HandleMessage

/* The main Win32 event handler */LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){	extern int posted;	switch (msg) {		case WM_SYSKEYDOWN:		case WM_KEYDOWN: {			SDL_keysym keysym;#ifdef _WIN32_WCE			// Drop GAPI artefacts			if (wParam == 0x84 || wParam == 0x5B)				return 0;			// Rotate key if necessary			if (this->hidden->orientation != SDL_ORIENTATION_UP)				wParam = rotateKey(wParam, this->hidden->orientation);	#endif 			/* Ignore repeated keys */			if ( lParam&REPEATED_KEYMASK ) {				return(0);			}			switch (wParam) {				case VK_CONTROL:					if ( lParam&EXTENDED_KEYMASK )						wParam = VK_RCONTROL;					else						wParam = VK_LCONTROL;					break;				case VK_SHIFT:					/* EXTENDED trick doesn't work here */					{					Uint8 *state = SDL_GetKeyState(NULL);					if (state[SDLK_LSHIFT] == SDL_RELEASED && (GetKeyState(VK_LSHIFT) & 0x8000)) {						wParam = VK_LSHIFT;					} else if (state[SDLK_RSHIFT] == SDL_RELEASED && (GetKeyState(VK_RSHIFT) & 0x8000)) {						wParam = VK_RSHIFT;					} else {						/* Win9x */						int sc = HIWORD(lParam) & 0xFF;						if (sc == 0x2A)							wParam = VK_LSHIFT;						else						if (sc == 0x36)							wParam = VK_RSHIFT;						else							wParam = VK_LSHIFT;					}					}					break;				case VK_MENU:					if ( lParam&EXTENDED_KEYMASK )						wParam = VK_RMENU;					else						wParam = VK_LMENU;					break;			}#ifdef NO_GETKEYBOARDSTATE			/* this is the workaround for the missing ToAscii() and ToUnicode() in CE (not necessary at KEYUP!) */			if ( SDL_TranslateUNICODE ) {				MSG m;				m.hwnd = hwnd;				m.message = msg;				m.wParam = wParam;				m.lParam = lParam;				m.time = 0;				if ( TranslateMessage(&m) && PeekMessage(&m, hwnd, 0, WM_USER, PM_NOREMOVE) && (m.message == WM_CHAR) ) {					GetMessage(&m, hwnd, 0, WM_USER);			    		wParam = m.wParam;				}			}#endif /* NO_GETKEYBOARDSTATE */			posted = SDL_PrivateKeyboard(SDL_PRESSED,				TranslateKey(wParam,HIWORD(lParam),&keysym,1));		}		return(0);		case WM_SYSKEYUP:		case WM_KEYUP: {			SDL_keysym keysym;#ifdef _WIN32_WCE			// Drop GAPI artifacts			if (wParam == 0x84 || wParam == 0x5B)				return 0;			// Rotate key if necessary			if (this->hidden->orientation != SDL_ORIENTATION_UP)				wParam = rotateKey(wParam, this->hidden->orientation);	#endif			switch (wParam) {				case VK_CONTROL:					if ( lParam&EXTENDED_KEYMASK )						wParam = VK_RCONTROL;					else						wParam = VK_LCONTROL;//.........这里部分代码省略.........
开发者ID:0-14N,项目名称:NDroid,代码行数:101,


示例25: RKADrawBoxes

void RKADrawBoxes(){	for (unsigned short CardBoard = POSOFFSET; CardBoard < POSOFFSET + SSTLEN; CardBoard += SPRITESIZE)	{		if (!(CheatRead<unsigned short>(0xFF0000 | CardBoard)))			continue;		short Xpos = CheatRead<short>(0xFF0000 | CardBoard + XPo); // too many many lines which were this way already when we discovered		short Ypos = CheatRead<short>(0xFF0000 | CardBoard + YPo); // that Ram_68k is little endian to begin with		unsigned short Height2 = CheatRead<short>(0xFF0000 | CardBoard + Ho);		unsigned short Width2 = CheatRead<short>(0xFF0000 | CardBoard + Wo);		if (CheatRead<unsigned short>(0xFF0000 | CardBoard) == 0x09)		{			Height2 = 0x20;			Width2 = 0x10;		}		else if ((CheatRead<unsigned short>(0xFF0000 | CardBoard) == 0x33) || (CheatRead<unsigned short>(0xFF0000 | CardBoard) == 0x64) 			  || (CheatRead<unsigned short>(0xFF0000 | CardBoard) == 0x66) || (CheatRead<unsigned short>(0xFF0000 | CardBoard) == 0x68))		{			Height2 = 0x10;			Width2 = 0x8;		}//		Xpos += 8;	//		Ypos -= CheatRead<short>(0xFF0000 | CardBoard + YVo);//		Xpos -= CheatRead<short>(0xFF0000 | CardBoard + XVo);		if (!GetKeyState(VK_SCROLL))		{			Xpos -= CamX;			Ypos -= CamY;		}//		Height2 /= 2;//		Ypos -= Height2;//		Height2 = min(Height2,0xFE);//		Width2 = min(Width2,0xFE);		DrawBoxCWH(Xpos - Width2,Ypos - Height2,Width2 * 2, Height2, -1, -1, -1,-1,1);/*		for (unsigned char JXQ = 0; JXQ <= Width2; JXQ++)		{			int x1 = Xpos - JXQ, x2 = Xpos + JXQ;			int y1 = Ypos - Height2, y2 = Ypos + Height2;			while (x1 < 8) x1 += 320;			while (x1 > 327) x1 -= 320;			while (x2 < 8) x2 += 320;			while (x2 > 327) x2 -= 320;			while (y1 < 0) y1 += 224;			while (y1 > 223) y1 -= 224;			while (y2 < 0) y2 += 224;			while (y2 > 223) y2 -= 224;			MD_Screen32[max(8,min(327,x1)) + (336 * max(0,min(223,y1)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x1)) + (336 * max(0,min(223,y1)))] = 0xFFFF;			MD_Screen32[max(8,min(327,x1)) + (336 * max(0,min(223,y2)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x1)) + (336 * max(0,min(223,y2)))] = 0xFFFF;			MD_Screen32[max(8,min(327,x2)) + (336 * max(0,min(223,y1)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x2)) + (336 * max(0,min(223,y1)))] = 0xFFFF;			MD_Screen32[max(8,min(327,x2)) + (336 * max(0,min(223,y2)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x2)) + (336 * max(0,min(223,y2)))] = 0xFFFF;		}		for (unsigned char JXQ = 0; JXQ <= Height2; JXQ++)		{			int x1 = Xpos - Width2, x2 = Xpos + Width2;			int y1 = Ypos - JXQ, y2 = Ypos + JXQ;			while (x1 < 8) x1 += 320;			while (x1 > 327) x1 -= 320;			while (x2 < 8) x2 += 320;			while (x2 > 327) x2 -= 320;			while (y1 < 0) y1 += 224;			while (y1 > 223) y1 -= 224;			while (y2 < 0) y2 += 224;			while (y2 > 223) y2 -= 224;			MD_Screen32[max(8,min(327,x1)) + (336 * max(0,min(223,y1)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x1)) + (336 * max(0,min(223,y1)))] = 0xFFFF;			MD_Screen32[max(8,min(327,x1)) + (336 * max(0,min(223,y2)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x1)) + (336 * max(0,min(223,y2)))] = 0xFFFF;			MD_Screen32[max(8,min(327,x2)) + (336 * max(0,min(223,y1)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x2)) + (336 * max(0,min(223,y1)))] = 0xFFFF;			MD_Screen32[max(8,min(327,x2)) + (336 * max(0,min(223,y2)))] = 0xFFFFFF;			MD_Screen[max(8,min(327,x2)) + (336 * max(0,min(223,y2)))] = 0xFFFF;		}*///		Ypos += Height2;		DrawBoxMWH(Xpos,Ypos,2,2,0x00FF00,0x07E0,0);		DrawBoxMWH(Xpos,Ypos,1,1,0x00FF00,0x07E0,0);		DrawLine(Xpos-1,Ypos,Xpos+1,Ypos,0,0,0);		DrawLine(Xpos,Ypos-1,Xpos,Ypos+1,0,0,0);/*		for (char jxq = 0; jxq <=2; jxq++)		{			for (char Jxq = 0; Jxq <=2; Jxq++)			{				MD_Screen32[max(8,min(327,(Xpos - jxq))) + 336 * max(0,min(223,(Ypos - Jxq)))] =0x00FF00;				MD_Screen32[max(8,min(327,(Xpos + jxq))) + 336 * max(0,min(223,(Ypos - Jxq)))] =0x00FF00;				MD_Screen32[max(8,min(327,(Xpos - jxq))) + 336 * max(0,min(223,(Ypos + Jxq)))] =0x00FF00;				MD_Screen32[max(8,min(327,(Xpos + jxq))) + 336 * max(0,min(223,(Ypos + Jxq)))] =0x00FF00;				MD_Screen[max(8,min(327,(Xpos - jxq))) + 336 * max(0,min(223,(Ypos - Jxq)))] =0x07E0;				MD_Screen[max(8,min(327,(Xpos + jxq))) + 336 * max(0,min(223,(Ypos - Jxq)))] =0x07E0;				MD_Screen[max(8,min(327,(Xpos - jxq))) + 336 * max(0,min(223,(Ypos + Jxq)))] =0x07E0;				MD_Screen[max(8,min(327,(Xpos + jxq))) + 336 * max(0,min(223,(Ypos + Jxq)))] =0x07E0;			}		}		MD_Screen32[max(8,min(327,(Xpos))) + 336 * max(0,min(223,(Ypos)))] = 0;		MD_Screen32[max(8,min(327,(Xpos - 1))) + 336 * max(0,min(223,(Ypos)))] = 0;		MD_Screen32[max(8,min(327,(Xpos + 1))) + 336 * max(0,min(223,(Ypos)))] = 0;		MD_Screen32[max(8,min(327,(Xpos))) + 336 * max(0,min(223,(Ypos - 1)))] = 0;//.........这里部分代码省略.........
开发者ID:realmonster,项目名称:Gens-Atlas,代码行数:101,


示例26: winListEditProc

static int winListEditProc(Ihandle* ih, HWND cbedit, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result){  int ret = 0;  if (msg==WM_KEYDOWN) /* process K_ANY before text callbacks */  {    ret = iupwinBaseProc(ih, msg, wp, lp, result);    if (ret)     {      iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", "1");      *result = 0;      return 1;    }    else      iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", NULL);  }  switch (msg)  {  case WM_CHAR:    {      if (iupAttribGet(ih, "_IUPWIN_IGNORE_CHAR"))      {        iupAttribSetStr(ih, "_IUPWIN_IGNORE_CHAR", NULL);        *result = 0;        return 1;      }      if ((char)wp == '/b')      {                      if (!winListCallEditCb(ih, cbedit, NULL, 0, -1))          ret = 1;      }      else if ((char)wp == '/n' || (char)wp == '/r')      {        ret = 1;      }      else if (!(GetKeyState(VK_CONTROL) & 0x8000 ||                 GetKeyState(VK_MENU) & 0x8000 ||                 GetKeyState(VK_LWIN) & 0x8000 ||                  GetKeyState(VK_RWIN) & 0x8000))      {        char insert_value[2];        insert_value[0] = (char)wp;        insert_value[1] = 0;        if (!winListCallEditCb(ih, cbedit, insert_value, wp, 1))          ret = 1;      }      PostMessage(cbedit, WM_CARET, 0, 0L);      if (wp==VK_TAB)  /* the keys have the same definitions as the chars */        ret = 1;  /* abort default processing to avoid beep */      break;    }  case WM_KEYDOWN:    {      if (wp == VK_DELETE) /* Del does not generates a WM_CHAR */      {        if (!winListCallEditCb(ih, cbedit, NULL, 0, 1))          ret = 1;      }      else if (wp == 'A' && GetKeyState(VK_CONTROL) & 0x8000)   /* Ctrl+A = Select All */      {        SendMessage(cbedit, EM_SETSEL, (WPARAM)0, (LPARAM)-1);      }      PostMessage(cbedit, WM_CARET, 0, 0L);      break;    }  case WM_CLEAR:    {      if (!winListCallEditCb(ih, cbedit, NULL, 0, 1))        ret = 1;      PostMessage(cbedit, WM_CARET, 0, 0L);      break;    }  case WM_CUT:    {      if (!winListCallEditCb(ih, cbedit, NULL, 0, 1))        ret = 1;      PostMessage(cbedit, WM_CARET, 0, 0L);      break;    }  case WM_PASTE:    {      if (IupGetCallback(ih, "EDIT_CB") || ih->data->mask) /* test before to avoid alocate clipboard text memory */      {        char* insert_value = iupwinGetClipboardText(ih);        if (insert_value)        {          if (!winListCallEditCb(ih, cbedit, insert_value, 0, 1))            ret = 1;          free(insert_value);        }      }//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:iup-iup,代码行数:101,


示例27: Position

void CCamera::CheckForMovement(){    // Once we have the frame interval, we find the current speed    float speed = (float)(kSpeed * g_FrameInterval);    // Before we move our camera we want to store the old position.  We then use    // this data to test collision detection.    CVector3 vOldPosition = Position();/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *    // Store the old view vector to restore it if we collided backwards    CVector3 vOldView = View();    // Use a flag to see if we movement backwards or not    bool bMovedBack = false;/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *    // Check if we hit the Up arrow or the 'w' key    if(GetKeyState(VK_UP) & 0x80 || GetKeyState('W') & 0x80)    {        // Move our camera forward by a positive SPEED        MoveCamera(speed);    }    // Check if we hit the Down arrow or the 's' key    if(GetKeyState(VK_DOWN) & 0x80 || GetKeyState('S') & 0x80)    {        // Move our camera backward by a negative SPEED        MoveCamera(-speed);        bMovedBack = true;    }    // Check if we hit the Left arrow or the 'a' key    if(GetKeyState(VK_LEFT) & 0x80 || GetKeyState('A') & 0x80)    {        // Strafe the camera left        StrafeCamera(-speed);    }    // Check if we hit the Right arrow or the 'd' key    if(GetKeyState(VK_RIGHT) & 0x80 || GetKeyState('D') & 0x80)    {        // Strafe the camera right        StrafeCamera(speed);    }    // Now that we moved, let's get the current position and test our movement    // vector against the level data to see if there is a collision.    CVector3 vCurrentPosition = Position();    // We will not use sphere collision from now on, but AABB collision (box)//	CVector3 vNewPosition = g_Level.TraceSphere(vOldPosition, vCurrentPosition, 25.0f);/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *    // We are now using AABB collision now, so we no longer use sphere checks.    // Below we pass into the TraceBox() function some generic Min and Max values    // for our bounding box.  We then get the new position if we collided    CVector3 vNewPosition = g_Level.TraceBox(vOldPosition, vCurrentPosition,                            CVector3(-20, -50, -20), CVector3(20, 50, 20));    // We add some code below to make it so when we back into a wall, our view vector    // doesn't keep going backwards, since we aren't moving backwards.  If we don't    // do this check, it will turn our camera around and look like a glitch.  Not desired!    // Check if we collided and we moved backwards    if(g_Level.Collided() && bMovedBack)    {        // If or x or y didn't move, then we are backed into a wall so restore the view vector        if(vNewPosition.x == vOldPosition.x || vNewPosition.z == vOldPosition.z)            m_vView = vOldView;    }/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *    // Set the new position that was returned from our trace function    m_vPosition = vNewPosition;}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:88,


示例28: initialize_modifiers

// Initialize the modifier mask to the current modifiers.static void initialize_modifiers() {	current_modifiers = 0x0000;	// NOTE We are checking the high order bit, so it will be < 0 for a singed short.	if (GetKeyState(VK_LSHIFT)	 < 0)	{ set_modifier_mask(MASK_SHIFT_L);		}	if (GetKeyState(VK_RSHIFT)   < 0)	{ set_modifier_mask(MASK_SHIFT_R);		}	if (GetKeyState(VK_LCONTROL) < 0)	{ set_modifier_mask(MASK_CTRL_L);		}	if (GetKeyState(VK_RCONTROL) < 0)	{ set_modifier_mask(MASK_CTRL_R);		}	if (GetKeyState(VK_LMENU)    < 0)	{ set_modifier_mask(MASK_ALT_L);		}	if (GetKeyState(VK_RMENU)    < 0)	{ set_modifier_mask(MASK_ALT_R);		}	if (GetKeyState(VK_LWIN)     < 0)	{ set_modifier_mask(MASK_META_L);		}	if (GetKeyState(VK_RWIN)     < 0)	{ set_modifier_mask(MASK_META_R);		}	if (GetKeyState(VK_LBUTTON)	 < 0)	{ set_modifier_mask(MASK_BUTTON1);		}	if (GetKeyState(VK_RBUTTON)  < 0)	{ set_modifier_mask(MASK_BUTTON2);		}	if (GetKeyState(VK_MBUTTON)  < 0)	{ set_modifier_mask(MASK_BUTTON3);		}	if (GetKeyState(VK_XBUTTON1) < 0)	{ set_modifier_mask(MASK_BUTTON4);		}	if (GetKeyState(VK_XBUTTON2) < 0)	{ set_modifier_mask(MASK_BUTTON5);		}	if (GetKeyState(VK_NUMLOCK)  < 0)	{ set_modifier_mask(MASK_NUM_LOCK);		}	if (GetKeyState(VK_CAPITAL)  < 0)	{ set_modifier_mask(MASK_CAPS_LOCK);	}	if (GetKeyState(VK_SCROLL)   < 0)	{ set_modifier_mask(MASK_SCROLL_LOCK);	}}
开发者ID:InspectorWidget,项目名称:libuiohook,代码行数:24,


示例29: isPressed

bool isPressed(int key){    return (GetKeyState(getSystemKey(key)) & 0x8000) != 0;}
开发者ID:zemanmar,项目名称:LumixEngine,代码行数:4,



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


C++ GetKeyboardLayout函数代码示例
C++ GetKeyName函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。