示例#1
0
int main(void)
{
	int x = 0, y = 0, i = 0;
	char NXT = '\0';
	Pos bestPosition;

START:
	removeCursor();
	initGame();
	drawBoarder();
	randomNextBlock();

	while (NXT != QUIT) {
		bestPosition = findIdealPosition();
		moveBestPos(bestPosition, &NXT);
		writeBlockOnBoard();
		drawInsideGame();
		eraseBlockOffBoard();
	}

	rank();

	goto START;

	return 0;
}
void VirtualKeyboardGUI::run() {
	if (_firstRun) {
		_firstRun = false;
		moveToDefaultPosition();
	}

	if (!g_gui.isActive()) {
		_system->showOverlay();
		_system->clearOverlay();
	}
	_overlayBackup.create(_screenW, _screenH, sizeof(OverlayColor));
	_system->grabOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w);

	setupCursor();

	forceRedraw();
	_displaying = true;
	mainLoop();

	removeCursor();

	_system->copyRectToOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w, 0, 0, _overlayBackup.w, _overlayBackup.h);
	if (!g_gui.isActive()) _system->hideOverlay();

	_overlayBackup.free();
	_dispSurface.free();
}
示例#3
0
void CCursorController::Clear()
{
   for(u32 i = 0; i < m_aMouseCursors.size(); i++)
   {
      removeCursor(i);
   }

   m_aMouseCursors.clear();
}
示例#4
0
文件: maze.c 项目: ktk1015/tk_test_c
int maze_main()
{
    removeCursor(); //커서깜박이지우기
    setCursor(POINT_X, POINT_Y); //보드시작좌표
    showBoard(); //미로판보여주기

    character_static(); //케릭터움직이기
    getchar();

    return 0;
}
 void updateHand( Hand * p)
 {
     if((p->population <=1) && (nonorphan.find(p->id) != nonorphan.end()))
     {
         nonorphan.erase(p->id);
         removeCursor(p);
     }
     else if((p->population > 1) && (nonorphan.find(p->id) == nonorphan.end()))
     {
         nonorphan.insert(p->id);
         newCursor(p);
     }
     else if(nonorphan.find(p->id) != nonorphan.end())
     {
         updateCursor(p);
     }
 }
示例#6
0
// dest: MUST already contain a string, even if empty.
// maxLineLength: Must include room for terminating NUL.
// Returns TRUE if the user pressed Enter, FALSE if Break.
//
byte getLineFromUser(char *dest, word maxLineLength, word initIndex)
{
    saveCursorPosition();

    word index = initIndex;  // offset of cursor in 'dest'

    // Print the existing string, if any.
    //
    word curLen = strlen(dest);
    putstr(dest, curLen);

    // Put the cursor at 'initIndex'.
    //
    restoreCursorPosition();
    advanceCursor(initIndex);

    char key;

    for (;;)
    {
        animateCursor();

        key = (char) tolower(inkey());
        if (!key)
            continue;

        if (key == '\r' || key == '\n' || key == BREAK_CHAR)  // if Enter (CoCo or PC) or Break
        {
            dest[curLen] = 0;
            break;
        }

        removeCursor();

        if (key == CLEAR_CHAR)  // if backspace
        {
            if (index > 0)
            {
                word numCharsToMove = curLen - index;
                moveBackwardOneByte(dest + index, numCharsToMove);
                --index;
                --curLen;
                putchar('\b');
                byte finalX = textPosX, finalY = textPosY;
                putstr(dest + index, numCharsToMove);
                putchar(' ');  // erase last char from screen
                moveCursor(finalX, finalY);  // place cursor at erased char
            }
            continue;
        }

        if (key == SHIFT_CLEAR_CHAR)  // if delete
        {
            if (index < curLen)
            {
                word numCharsToMove = curLen - index - 1;
                moveBackwardOneByte(dest + index + 1, numCharsToMove);
                --curLen;
                byte finalX = textPosX, finalY = textPosY;
                putstr(dest + index, numCharsToMove);
                putchar(' ');  // erase last char from screen
                moveCursor(finalX, finalY);  // place cursor at erased char
            }
            continue;
        }

        if (key == LEFT_CHAR)  // if move cursor left
        {
            if (index > 0)
            {
                --index;
                putchar('\b');
            }
            continue;
        }

        if (key == RIGHT_CHAR)  // if move cursor right
        {
            if (index < curLen)
            {
                ++index;
                advanceCursor(1);
            }
            continue;
        }

        if (key == KILL_LINE_CHAR)  // if shift-backspace
        {
            for (word i = 0; i < index; ++i)  // back up cursor to beginning
                putchar('\b');
            byte finalX = textPosX, finalY = textPosY;
            for (word i = 0; i < curLen; ++i)  // erase entire line
                putchar(' ');
            moveCursor(finalX, finalY);  // put cursor at beginning
            index = 0;
            curLen = 0;
            continue;
        }

        if (key < ' ' || key >= 127)
            continue;  // ignore invalid characters

        if (curLen < maxLineLength - 1)  // if still room
        {
            moveForwardOneByte(dest + index, curLen + 1 - index);  // include terminating NUL
            dest[index] = key;
            ++curLen;
            saveCursorPosition();
            putstr(dest + index, curLen - index);
            restoreCursorPosition();
            advanceCursor(1);
            ++index;
        }
    }

    removeCursor();

    return key != BREAK_CHAR;
}
 void removeHand( Hand * p)
 {
     if(nonorphan.find(p->id) == nonorphan.end())return;
     nonorphan.erase(p->id);
     removeCursor(p);
 }
 void removeHand(Hand * h)
 {
     if(hands.find(h->id) == hands.end())return;
     hands.erase(h->id);
     removeCursor(h);
 }