コード:
#include <DxLib.h>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
if (ChangeWindowMode(TRUE) != DX_CHANGESCREEN_OK || DxLib_Init() != 0) return -1;
SetDrawScreen(DX_SCREEN_BACK);
int font = CreateFontToHandle(NULL, -1, -1, -1);
int x = 100, y = 100, rcx = 100, rcy = 100, a = 0;
char key[256];
while (ProcessMessage() == 0 && ClearDrawScreen() == 0 && GetHitKeyStateAll(key) == 0) {
if (key[KEY_INPUT_A]) x--;
if (key[KEY_INPUT_D]) x++;
if (key[KEY_INPUT_W]) y--;
if (key[KEY_INPUT_S]) y++;
if (key[KEY_INPUT_G]) rcx--;
if (key[KEY_INPUT_J]) rcx++;
if (key[KEY_INPUT_Y]) rcy--;
if (key[KEY_INPUT_H]) rcy++;
if (key[KEY_INPUT_O]) a--;
if (key[KEY_INPUT_P]) a++;
DrawString(10, 10, "A:x-- D:x++ W:y-- S:y++", GetColor(128, 128, 128));
DrawString(10, 40, "G:rcx-- J:rcx++ Y:rcy-- H:rcy++", GetColor(128, 128, 128));
DrawString(10, 70, "O:a-- P:a++", GetColor(128, 128, 128));
DrawFormatString(10, 100, GetColor(128, 128, 128), "x = %d, y = %d, rcx = %d, rcy = %d, a = %d",
x, y, rcx, rcy, a);
DrawLine(x - 5, y - 5, x + 5, y + 5, GetColor(128, 128, 128));
DrawLine(x - 5, y + 5, x + 5, y - 5, GetColor(128, 128, 128));
DrawString(x + 10, y, "(x, y)", GetColor(128, 128, 128));
DrawLine(rcx - 5, rcy - 5, rcx + 5, rcy + 5, GetColor(128, 128, 128));
DrawLine(rcx - 5, rcy + 5, rcx + 5, rcy - 5, GetColor(128, 128, 128));
DrawString(rcx + 10, rcy, "(rcx, rcy)", GetColor(128, 128, 128));
DrawRotaFormatStringToHandle(x, y, 1.0, 1.0, rcx, rcy,
a * 3.1451926535897932384626433 / 180.0, GetColor(255, 255, 255),
font, 0, FALSE, "test string");
ScreenFlip();
}
DxLib_End();
return 0;
}