-
Notifications
You must be signed in to change notification settings - Fork 0
/
Title.cpp
94 lines (71 loc) · 1.84 KB
/
Title.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "DxLib.h"
#include "MainGame.h"
#include "Title.h"
Title::Title()
{
frame = 0;
titleImage[0] = LoadGraph("data\\graphics\\title_1.png");
titleImage[1] = LoadGraph("data\\graphics\\title_2_1.png");
titleImage[2] = LoadGraph("data\\graphics\\title_2_2.png");
titleImage[3] = LoadGraph("data\\graphics\\title_3_1.png");
titleImage[4] = LoadGraph("data\\graphics\\title_3_2.png");
titleImage[5] = LoadGraph("data\\graphics\\title_4.png");
_selectHandle = LoadGraph("data/graphics/select_1.png");
_keyCheck = 0;
_T_changing = 0.0;
titleBGM = LoadSoundMem("data\\sound\\BGM\\Urayama.wav");
selectBGM = LoadSoundMem("data\\sound\\SE\\ok.wav");
PlaySoundMem(titleBGM, DX_PLAYTYPE_LOOP);
}
Title::~Title()
{
DeleteGraph(titleImage[0]);
DeleteGraph(titleImage[1]);
DeleteGraph(titleImage[2]);
DeleteGraph(titleImage[3]);
DeleteGraph(titleImage[4]);
DeleteGraph(titleImage[5]);
DeleteGraph(_selectHandle);
DeleteSoundMem(titleBGM);
DeleteSoundMem(selectBGM);
}
void Title::draw(){
DrawGraph(0, 0, titleImage[0], false);
// PlaySoundMem(titleBGM, DX_PLAYTYPE_LOOP);
for (int i = 1; i < 6; i++){
DrawGraph(0, 0, titleImage[i], true);
}
// DrawString(0, 0, "TITLE Push Set Key(Z)", GetColor(255, 255, 255));
switch (_keyCheck % 2){
case 0:
DrawGraph(40, 415, _selectHandle, true);
break;
case 1:
DrawGraph(40, 487, _selectHandle, true);
break;
}
}
Scene_Base* Title::update(){
frame++;
//•ÏX“_
if (CheckHitKey(KEY_INPUT_UP) == 1 && GetNowCount() - _T_changing > 400){
_keyCheck++;
_T_changing = GetNowCount();
}
if (CheckHitKey(KEY_INPUT_DOWN) == 1 && GetNowCount() - _T_changing > 400){
_keyCheck++;
_T_changing = GetNowCount();
}
if (CheckHitKey(KEY_INPUT_Z) == 1){
switch (_keyCheck % 2){
case 0:
return new MainGame();
break;
case 1:
DxLib_End();
exit(0);
break;
}
}
return this;
}