/*STGの作り方 中間ソース2*/

/*目次へ戻る*/ #include "DxLib.h" void my_init_back_img(void); void my_init_variable(void); void my_move_back(void); void my_draw_back(void); void my_draw_variable(void); void my_timer(void); int my_get_key(void); int key[256]; double back_img_y; int back_img; int gamecount; int Color_White; int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int){ ChangeWindowMode(TRUE); DxLib_Init(); SetDrawScreen(DX_SCREEN_BACK); my_init_back_img(); my_init_variable(); while (ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && my_get_key()==0){ my_move_back(); my_draw_back(); my_draw_variable(); my_timer(); } DxLib_End(); return 0; } void my_init_back_img(){ back_img = LoadGraph("../back_img.jpg"); } void my_init_variable(){ gamecount = 0; Color_White = GetColor(255, 255, 255); back_img_y = 0; } void my_move_back(){ back_img_y++; if (back_img_y > 480){ back_img_y = 0; } } void my_draw_back(){ DrawGraph(0, back_img_y, back_img, TRUE); DrawGraph(0, back_img_y - 480, back_img, TRUE); DrawLine(0, 240, 640, 240, Color_White); DrawLine(320, 0, 320, 480, Color_White); DrawFormatString(320, 240, Color_White, "(0,0)"); } void my_draw_variable(){ DrawFormatString(440, 440, Color_White, "gamecount = %d", gamecount); } void my_timer(){ gamecount++; } 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*/