Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LoadDragon0000000000/aea6b1ad31885bc67bd637dcc51a4a19 to your computer and use it in GitHub Desktop.
Save LoadDragon0000000000/aea6b1ad31885bc67bd637dcc51a4a19 to your computer and use it in GitHub Desktop.
#include "DxLib.h"
#include <math.h>
const float DEGTORAD = 0.017453293f; // 度数表記をラジアンに変換する定数
int WINAPI WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int) {
// ---ここから設定---
ChangeWindowMode(TRUE), SetMainWindowText("きれいな画面フェード"), SetGraphMode(640, 480, 32),
SetDoubleStartValidFlag(TRUE); DxLib_Init(), SetDrawScreen(DX_SCREEN_BACK);
// ---ここまで設定---
float Fade = 0;
float red = 0;
float green = 0;
float blue = 0;
// ゲームループ
while (ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0) {
if (Fade < 180) {
Fade += 1;
}
red = sin(Fade * DEGTORAD) * 255;
green = sin(Fade * DEGTORAD) * 255;
blue = sin(Fade * DEGTORAD) * 255;
DrawBox(0, 0, 640, 480, GetColor(red, green, blue), true);
DrawFormatString(0, 0, GetColor(255, 0, 0), "%f", Fade);
}
DxLib_End(); return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment