예제 #1
0
파일: notevil.c 프로젝트: hoangduit/reactos
VOID
WriteCoord(COORD c)
{
    COORD xy = {0,0};
    WCHAR buf[40];

    wsprintf(buf, L"x=%02d  y=%02d", c.X, c.Y);

    WriteStringAt(buf, xy,
                  BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE);
}
예제 #2
0
파일: notevil.c 프로젝트: hoangduit/reactos
VOID
DisplayTitle(VOID)
{
    LPWSTR szTitle = L"ReactOS Coders Console Parade";
    COORD  xy;

    xy.X = (ScreenBufferInfo.dwSize.X - wcslen(szTitle)) / 2;
    xy.Y = ScreenBufferInfo.dwSize.Y / 2;

    WriteStringAt(szTitle, xy,
                  FOREGROUND_GREEN | FOREGROUND_INTENSITY);
}
예제 #3
0
VOID
DisplayTitle(VOID)
{
	LPTSTR szTitle = _TEXT("ReactOS Coders Console Parade");
	COORD  xy;

	xy.X = (ScreenBufferInfo.dwSize.X - lstrlen(szTitle)) / 2;
	xy.Y = ScreenBufferInfo.dwSize.Y / 2;

	WriteStringAt(
		szTitle,
		xy,
		(FOREGROUND_GREEN | FOREGROUND_INTENSITY)
		);
}
예제 #4
0
void
WriteCoord(COORD c)
{
	COORD xy = {0,0};
	TCHAR buf [40];

	wsprintf(
		buf,
		_TEXT("x=%02d  y=%02d"),
		c.X,
		c.Y
		);
	WriteStringAt(
		buf,
		xy,
		(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
		);
}
예제 #5
0
파일: notevil.c 프로젝트: hoangduit/reactos
VOID
MainLoop(VOID)
{
    WCHAR NameString[RES_BUFFER_SIZE];
    DWORD NameIndex  = 0;
    INT   NameLength = 0;
    COORD xy;
    INT   n = RES_DELAY_CHANGE;
    INT   dir_y  = 1;
    INT   dir_x  = 1;
    WORD  wColor = 1;

    xy.X = ScreenBufferInfo.dwSize.X / 2;
    xy.Y = ScreenBufferInfo.dwSize.Y / 2;

    for ( ; 1; ++n )
    {
        if (n == RES_DELAY_CHANGE)
        {
            n = 0;

            GetNextString(NameString,
                          RES_BUFFER_SIZE,
                          &NameIndex);
            NameLength = wcslen(NameString);

            wColor++;
            if ((wColor & 0x000F) == 0)
                wColor = 1;
        }
        if (xy.X == 0)
        {
            if (dir_x == -1)
                dir_x = 1;
        }
        else if (xy.X >= ScreenBufferInfo.dwSize.X - NameLength - 1)
        {
            if (dir_x == 1)
                dir_x = -1;
        }
        xy.X += dir_x;

        if (xy.Y == 0)
        {
            if (dir_y == -1)
                dir_y = 1;
        }
        else if (xy.Y >= ScreenBufferInfo.dwSize.Y - 1)
        {
            if (dir_y == 1)
                dir_y = -1;
        }
        xy.Y += dir_y;

#ifdef DISPLAY_COORD
        WriteCoord(xy);
#endif /* def DISPLAY_COORD */

        DisplayTitle();
        WriteStringAt(NameString, xy, wColor);
        WaitForSingleObject(WaitableTimer, INFINITE);
        WriteStringAt(NameString, xy, 0);
    }
}