フルスクリーンとウィンドウモードを切り替えられるプログラムと、
3D描画を合わせてみたところ、フルスクリーンとウィンドウ時で描画結果が変わってしまいました。
自分では原因の見当がつきませんでした。
良ければご指導お願いします。
#include "DxLib.h"
#define SCREEN_SIZE_X 640
#define SCREEN_SIZE_Y 480
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int SubScreen;
int WindowFullSize;
int WindowPosX;
int WindowPosY;
int DesktopSizeX;
int DesktopSizeY;
int ff = 0;
ChangeWindowMode(TRUE);
GetDefaultState(&DesktopSizeX, &DesktopSizeY, NULL);
SetWindowSizeChangeEnableFlag(FALSE, FALSE);
SetGraphMode(DesktopSizeX, DesktopSizeY, 16);
SetWindowSize(SCREEN_SIZE_X, SCREEN_SIZE_Y);
SetWindowStyleMode(5);
if (DxLib_Init() < 0) return -1;
SubScreen = MakeScreen(SCREEN_SIZE_X, SCREEN_SIZE_Y);
WindowFullSize = FALSE;
SetUseZBuffer3D(TRUE);
SetWriteZBuffer3D(TRUE);
while (ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0)
{
ff = (CheckHitKey(KEY_INPUT_F4) ? ff + 1 : 0);
if (ff == 1)
{
if (WindowFullSize)
{
WindowFullSize = FALSE;
SetWindowStyleMode(5);
SetWindowSize(SCREEN_SIZE_X, SCREEN_SIZE_Y);
SetWindowPosition(WindowPosX, WindowPosY);
}
else
{
WindowFullSize = TRUE;
GetWindowPosition(&WindowPosX, &WindowPosY);
SetWindowStyleMode(2);
SetWindowSize(DesktopSizeX, DesktopSizeY);
SetWindowPosition(0, 0);
}
}
if (WindowFullSize)
SetDrawScreen(SubScreen);
else
SetDrawScreen(DX_SCREEN_BACK);
ClearDrawScreen();
SetCameraScreenCenter(SCREEN_SIZE_X / 2, SCREEN_SIZE_Y / 2);
DrawBox(0, 0, SCREEN_SIZE_X, SCREEN_SIZE_Y, GetColor(255, 255, 0), FALSE);
SetCameraPositionAndTarget_UpVecY(VGet(-200, 200, -200), VGet(0, 0, 0));
DrawSphere3D(VGet(0, 0, 0), 50, 8, GetColor(255, 0, 0), GetColor(255, 255, 255), FALSE);
DrawLine(SCREEN_SIZE_X / 2, 0, SCREEN_SIZE_X / 2, 153, GetColor(255, 255, 0), FALSE);
if (WindowFullSize)
{
int DrawSizeX;
int DrawSizeY;
SetDrawScreen(DX_SCREEN_BACK);
ClearDrawScreen();
if ((float)SCREEN_SIZE_X / SCREEN_SIZE_Y < (float)DesktopSizeX / DesktopSizeY)
{
DrawSizeX = DesktopSizeY * SCREEN_SIZE_X / SCREEN_SIZE_Y;
DrawSizeY = DesktopSizeY;
}
else
{
DrawSizeX = DesktopSizeX;
DrawSizeY = DesktopSizeX * SCREEN_SIZE_Y / SCREEN_SIZE_X;
}
DrawExtendGraph(
(DesktopSizeX - DrawSizeX) / 2,
(DesktopSizeY - DrawSizeY) / 2,
DesktopSizeX - (DesktopSizeX - DrawSizeX) / 2,
DesktopSizeY - (DesktopSizeY - DrawSizeY) / 2,
SubScreen,
FALSE
);
}
ScreenFlip();
}
DxLib_End();
return 0;
}