/*広告*/

/*ブロック崩しの作り方 中間ソース2*/

/*目次へ戻る*/

#include "DxLib.h" int my_get_key(void); int key[256]; int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int){ ChangeWindowMode(TRUE); DxLib_Init(); SetDrawScreen(DX_SCREEN_BACK); int ball_x = 0; int ball_y = 0; int x_speed = 5; int y_speed = 5; int Color_White = GetColor(255,255,255); while (ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && my_get_key()==0){ DrawCircle(ball_x,ball_y,5,Color_White,true); ball_x += x_speed; ball_y += y_speed; if(ball_x >= 640){ ball_x = 640 - 5; x_speed *= -1; } if(ball_x <= 0){ ball_x = 5; x_speed *= -1; } if(ball_y >= 480){ ball_y = 480 - 5; y_speed *= -1; } if(ball_y <= 0){ ball_y = 5; y_speed *= -1; } } DxLib_End(); return 0; } int my_get_key(){ char keys[256]; GetHitKeyStateAll(keys); for (int i = 0; i < 256; i++){ if (keys[i] != 0){ key[i]++; } else{ key[i] = 0; } } return 0; }

/*ページの先頭へ*/

/*目次へ戻る*/

/*HOME*/

/*Copyright 2016 K.N/petitetech.com*/

/*広告*/