Exemplo n.º 1
0
void VID_SetMode(int ModeValue)
{
	
	if (Vid.BackBuffer)
	{
		VID_Shutdown();

	}

	WindowWidth = modelist[ModeValue].width;
	WindowHeight = modelist[ModeValue].height;

	Vid.BufferHeight = 240;
	Vid.BufferWidth = 320;
	Vid.BytesPerPixel = 4;
	
	if (modelist[ModeValue].type == MS_WINDOWED)
	{
		VID_SetWindowedMode(ModeValue);
	}
	else
	{
		VID_SetFullscreenMode(ModeValue);

	}
	
	// Show the window
	ShowWindow(MainWindow, SW_SHOWDEFAULT);

	// define our bit map info
	BitMapInfo.bmiHeader.biSize = sizeof(BitMapInfo.bmiHeader);
	BitMapInfo.bmiHeader.biWidth = Vid.BufferWidth;
	BitMapInfo.bmiHeader.biHeight = -Vid.BufferHeight;						// put the origin in the top left corner
	BitMapInfo.bmiHeader.biPlanes = 1;
	BitMapInfo.bmiHeader.biBitCount = 8 * Vid.BytesPerPixel;
	BitMapInfo.bmiHeader.biCompression = BI_RGB;

	Vid.BackBuffer = malloc(Vid.BufferWidth * Vid.BufferHeight * Vid.BytesPerPixel);

	CharData = COM_FindFile("gfx/menuplyr.lmp", &CharLength);

}
Exemplo n.º 2
0
void VID_SetMode(int ModeValue)
{
    if (BackBuffer)
    {
        VID_Shutdown();
    }

    WindowWidth = ModeList[ModeValue].width;
    WindowHeight = ModeList[ModeValue].height;

    BufferHeight = WindowHeight;
    BufferWidth = WindowWidth;

    if (ModeList[ModeValue].type == MS_WINDOWED)
    {
        VID_SetWindowedMode(ModeValue);
    }
    else
    {
        VID_SetFullscrenMode(ModeValue);
    }

    ShowWindow(MainWindow, SW_SHOWDEFAULT);

    HDC DeviceContext = GetDC(MainWindow);
    PatBlt(DeviceContext, 0, 0, BufferWidth, BufferHeight, BLACKNESS);
    ReleaseDC(MainWindow, DeviceContext);

    // define our bitmap info
    BitMapInfo.bmiHeader.biSize = sizeof(BitMapInfo.bmiHeader);
    BitMapInfo.bmiHeader.biWidth = BufferWidth;
    BitMapInfo.bmiHeader.biHeight = -BufferHeight;
    BitMapInfo.bmiHeader.biPlanes = 1;
    BitMapInfo.bmiHeader.biBitCount = 8 * BytesPerPixel;
    BitMapInfo.bmiHeader.biCompression = BI_RGB;

    BackBuffer = malloc(BufferWidth * BufferHeight * BytesPerPixel);
}