main.cpp
#include "DxLib.h"
#include "Player.h" //Playerモジュールの関数を使えるようにする
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int){
ChangeWindowMode(TRUE), DxLib_Init(),SetGraphMode(1500, 950, 32);
SetDrawScreen(DX_SCREEN_BACK);
PICTURE_LOAD();
BACK_LOAD();
NOTE_1_LOAD();
SOUND_LOAD();
MAIN_MUSIC_LOAD();
HIT_DRAW_LOAD();
MAIN_MUSIC();
while (ScreenFlip() == 0 && ProcessMessage() == 0){
SPEED();
PICTURE_DRAW();//描画
BACK_DRAW();
NOTE_1_DRAW();
HIT_JUDGE();
SOUND_1();
}
DxLib_End();
return 0;
}
#include "DxLib.h"
#include "Player.h"
// このファイル内でしか使えないグローバル変数
static int a;
static int picture;
static int back;
static int note_1;
static int sound_1;
static int s_flag = 0;
static int music;
static int hita,hitb,hitc;
void PICTURE_LOAD()
{
picture = LoadGraph("Data/Picture_1.png");
}
void PICTURE_DRAW()
{
DrawGraph(0, 0, picture, FALSE);
}
void BACK_LOAD()
{
back = LoadGraph("Data/Back.png");
}
void BACK_DRAW()
{
DrawGraph(0, 0,back,TRUE);
}
void NOTE_1_LOAD()
{
note_1 = LoadGraph("Data/Note_1.png");
a = 0 ;
}
void NOTE_1_DRAW()
{
DrawGraph(133, a, note_1, TRUE);
}
void SPEED()
{
a = a + 5;
}
void SOUND_LOAD()
{
sound_1 = LoadSoundMem("data/s1.ogg");
}
void SOUND_1()
{
if (CheckHitKey(KEY_INPUT_A)==1) {
if (s_flag == 0)
PlaySoundMem(sound_1, DX_PLAYTYPE_BACK);
s_flag = 1;
}
else {
s_flag = 0;
}
}
void MAIN_MUSIC_LOAD()
{
music = LoadSoundMem("data/music.mp3");
}
void MAIN_MUSIC()
{
PlaySoundMem(music, DX_PLAYTYPE_BACK);
}
void HIT_DRAW_LOAD()
{
hita = LoadGraph("Data/hitA.png");
hitb = LoadGraph("Data/hitB.png");
hitc = LoadGraph("Data/hitC.png");
}
void HIT_DRAW()
{
DrawGraph(155, 650, hita, TRUE);
}
void HIT_JUDGE()
{
if (a > 745 && a < 765){ if (CheckHitKey(KEY_INPUT_A) == 1){ HIT_DRAW(); } }
}
#ifndef DEF_PLAYER_H //二重include防止
#define DEF_PLAYER_H
void PICTURE_LOAD();
void PICTURE_DRAW();
void BACK_LOAD();
void BACK_DRAW();
void NOTE_1_LOAD();
void NOTE_1_DRAW();
void SPEED();
void SOUND_LOAD();
void SOUND_1();
void MAIN_MUSIC_LOAD();
void MAIN_MUSIC();
void HIT_DRAW_LOAD();
void HIT_DRAW();
void HIT_JUDGE();
void DELETE_GRAPH();
#endif