-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenuScene.cpp
86 lines (76 loc) · 2.29 KB
/
menuScene.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
#include "menuScene.h"
#include "stdafx.h"
WGameFramework framework;
menuScene::~menuScene()
{
}
void menuScene::init()
{
//메뉴 화면에서 그릴 리소스 위치 초기화
background.Load(TEXT("image/시작화면1.png"));
normalCloud.Load(TEXT("image/일반구름.png"));
rainCloud.Load(TEXT("image/비구름.png"));
darkCloud.Load(TEXT("image/먹구름.png"));
press.Load(TEXT("image/시작하려면누르세요.png"));
PlaySound(TEXT("sound/level1-step1.wav"), NULL, SND_ASYNC | SND_LOOP);
cloudSizeCount = 0;
cloudSize = 300;
rainCloudSize = 220;
darkCloudSize = 250;
pressText = 0;
ren = 0;
}
void menuScene::processKey(UINT iMessage, WPARAM wParam, LPARAM lParam)
{
switch (iMessage)
{
case WM_KEYDOWN:
{
switch (wParam) {
case VK_RETURN:
PlaySound(NULL, NULL, NULL);
scene* scene = framework.curScene; ////현재 씬을 tmp에 넣고 지워줌
framework.curScene = new gameScene;
framework.curScene->init();
framework.nowscene = GAME;
delete scene;
break;
}
}
break;
}
}
void menuScene::Update(const float frameTime)
{
ren++;
if (ren >= 10)
ren = 0;
if (cloudSizeCount >= 10)
cloudSizeCount = 0;
if (cloudSizeCount % 2 == 0) {
//cloudSize += 20;
//rainCloudSize -= 10;
//darkCloudSize += 40;
}
else {
//cloudSize -= 20;
//rainCloudSize += 10;
//darkCloudSize -= 40;
}
//cloudSizeCount++;
if (pressText % 2 == 0)
pressText = 0;
else if (pressText % 2 == 1)
pressText = 1;
pressText++;
//애니메이션 있으면 여기서 업데이트
}
void menuScene::Render(HDC hdc)
{
background.Draw(hdc, 0, 0, FRAME_WIDTH, FRAME_HEIGHT, 0, 0, background.GetWidth(), background.GetHeight());
normalCloud.Draw(hdc, 60, 400, cloudSize, cloudSize, 512 * ren, 0, normalCloud.GetHeight(), normalCloud.GetHeight());
press.Draw(hdc, 390, 550, 430, 45, 0, 0, press.GetWidth(), press.GetHeight());
rainCloud.Draw(hdc, 900, 300, rainCloudSize, rainCloudSize, 512 * ren, 0, rainCloud.GetHeight(), rainCloud.GetHeight());
darkCloud.Draw(hdc, 500, 0, darkCloudSize, darkCloudSize, 512 * ren, 0, darkCloud.GetHeight(), darkCloud.GetHeight());
//--- 메모리 DC에 배경 그리기
}