Skip to content

Instantly share code, notes, and snippets.

@tkymx
Created March 19, 2015 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkymx/dfa3a3e26964e55b5ee5 to your computer and use it in GitHub Desktop.
Save tkymx/dfa3a3e26964e55b5ee5 to your computer and use it in GitHub Desktop.
Dxlib のテンプレート(自分用)
#include "DxLib.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
int Key;
SetGraphMode(640, 480, 16);
ChangeWindowMode(true);
if (DxLib_Init() == -1)
{
return -1;
}
SetDrawScreen(DX_SCREEN_BACK);
int PlayerX = 0;
int PlayerY = 0;
while (ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0)
{
ClearDrawScreen();
Key = GetJoypadInputState(DX_INPUT_KEY_PAD1);
if (Key & PAD_INPUT_UP) PlayerY -= 10;
if (Key & PAD_INPUT_DOWN) PlayerY += 10;
if (Key & PAD_INPUT_RIGHT) PlayerX += 10;
if (Key & PAD_INPUT_LEFT) PlayerX -= 10;
DrawBox(PlayerX - 10, PlayerY - 10, PlayerX + 10, PlayerY + 10, RGB(255,0,0) , TRUE);
ScreenFlip();
}
DxLib_End();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment