Exemple #1
0
void ICPWidget::lastFrame(void)
{
    if(currentFrame<=0)currentFrame=_FrameKeyList.size();
    currentFrame--;
    reLoadFrame();
    updateShow();
}
Exemple #2
0
void ICPWidget::changeState(int idx)
{
    switch(idx)
    {
    case 0:currentState = PICK_FRAME;
        break;
    case 1:currentState = PICK_PATCH;
        break;
    }
    updateShow();
}
Exemple #3
0
void Game::autoCreate()
{
	int x, y, c;
	x = rand() % row;
	y = rand() % col;
	c = rand() % colorCnt;
	int thisC = blocks[x][y].color;
	for (int i = 0; i < 4; ++i)
	{
		int tx = x + dx[i];
		int ty = y + dy[i];
		if (tx >= 0 && tx < row && ty >= 0 && ty < col)
		{
			blocks[tx][ty].color = thisC;
		}
	}
	updateShow();
}
Exemple #4
0
void Game::removeAndUpdate()
{
	int i, j, k, l;
	int lastLine = row - 1;
	int lack[col];
	for (i = 0; i < col; ++i)
	{
		lack[i] = 0;
		for (j = lastLine; j >= 0; --j)
		{
			if (vis[j][i])
			{
				k = j;
				lack[i] = 1;
				for (l = j - 1; l >= 0; --l)
				{
					if (vis[l][i])
						++lack[i];
					else
					{
						blocks[k][i].color = blocks[l][i].color;
						--k;
					}
				}
				break;          //O(n^2)...
			}
		}
	}
	for (i = 0; i < col; ++i)
	{
		for (j = 0; j < lack[i]; ++j)
		{
			int randNum = rand() % colorCnt;
			blocks[j][i].color = randNum;
		}
	}
	Sleep(200);
	updateShow();
}
Exemple #5
0
void ICPWidget::reLoadFrameWithView(void)
{
    updateShow(true);
}
Exemple #6
0
void ICPWidget::nextFrame(void)
{
    currentFrame++;
    reLoadFrame();
    updateShow();
}
Exemple #7
0
/// hook of SendMessage
LRESULT CALLBACK callWndProc(int i_nCode, WPARAM i_wParam, LPARAM i_lParam)
{
    if (!g.m_isInitialized)
        initialize(false);

    if (!g_hookData)
        return 0;

    CWPSTRUCT &cwps = *(CWPSTRUCT *)i_lParam;

    if (0 <= i_nCode) {
        switch (cwps.message) {
        case WM_ACTIVATEAPP:
        case WM_NCACTIVATE:
            if (i_wParam)
                notifySetFocus();
            break;
        case WM_SYSCOMMAND:
            switch (cwps.wParam) {
            case SC_MAXIMIZE:
            case SC_MAXIMIZE2:
                updateShow(cwps.hwnd, NotifyShow::Show_Maximized);
                break;
            case SC_MINIMIZE:
            case SC_MINIMIZE2:
                updateShow(cwps.hwnd, NotifyShow::Show_Minimized);
                break;
            case SC_RESTORE:
            case SC_RESTORE2:
                updateShow(cwps.hwnd, NotifyShow::Show_Normal);
                break;
            default:
                break;
            }
        /* through below */
        case WM_COMMAND:
            notifyCommand(cwps.hwnd, cwps.message, cwps.wParam, cwps.lParam);
            break;
        case WM_SIZE:
            switch (cwps.wParam) {
            case SIZE_MAXIMIZED:
                updateShow(cwps.hwnd, NotifyShow::Show_Maximized);
                break;
            case SIZE_MINIMIZED:
                updateShow(cwps.hwnd, NotifyShow::Show_Minimized);
                break;
            case SIZE_RESTORED:
                updateShow(cwps.hwnd, NotifyShow::Show_Normal);
                break;
            default:
                break;
            }
            break;
        case WM_MOUSEACTIVATE:
            notifySetFocus();
            break;
        case WM_ACTIVATE:
            if (LOWORD(cwps.wParam) != WA_INACTIVE) {
                notifySetFocus();
                if (HIWORD(cwps.wParam)) { // check minimized flag
                    // minimized flag on
                    notifyShow(NotifyShow::Show_Minimized, false);
                    //notifyShow(NotifyShow::Show_Normal, true);
                }
            }
            break;
        case WM_ENTERMENULOOP:
            g.m_isInMenu = true;
            notifySetFocus(true);
            break;
        case WM_EXITMENULOOP:
            g.m_isInMenu = false;
            notifySetFocus(true);
            break;
        case WM_SETFOCUS:
            g.m_isInMenu = false;
            // for kana
            if (g_hookData->m_correctKanaLockHandling) {
                if (HIMC hIMC = ImmGetContext(cwps.hwnd)) {
                    bool status = !!ImmGetOpenStatus(hIMC);
                    // this code set the VK_KANA state correctly.
                    ImmSetOpenStatus(hIMC, !status);
                    ImmSetOpenStatus(hIMC, status);
                    ImmReleaseContext(cwps.hwnd, hIMC);
                }
            }
            notifySetFocus();
            notifyLockState(5);
            break;
        case WM_IME_STARTCOMPOSITION:
            g.m_isImeCompositioning = true;
            notifyLockState(6);
            break;
        case WM_IME_ENDCOMPOSITION:
            g.m_isImeCompositioning = false;
            notifyLockState(7);
            break;
        case WM_IME_NOTIFY:
            if (cwps.wParam == IMN_SETOPENSTATUS)
                if (HIMC hIMC = ImmGetContext(cwps.hwnd)) {
                    g.m_isImeLock = !!ImmGetOpenStatus(hIMC);
                    ImmReleaseContext(cwps.hwnd, hIMC);
                    notifyLockState(8);
                }
            break;
        }
    }
    return CallNextHookEx(s_hookDataArch->m_hHookCallWndProc, i_nCode,
                          i_wParam, i_lParam);
}