-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirector.cpp
66 lines (57 loc) · 925 Bytes
/
Director.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
#include "DXUT.h"
#include "Director.h"
#include "Renderer.h"
LPD3DXSPRITE Director::_sprite;
bool Director::OnMouseDown()
{
if (ClickNum == 1)
{
ClickNum++;
return true;
}
return false;
}
bool Director::OnMouse()
{
if (ClickNum == 2)
{
return true;
}
return false;
}
bool Director::OnMouseUp()
{
if (ClickNum == 3)
{
ClickNum = -1;
return true;
}
return false;
}
void Director::Init()
{
ClickNum = 0;
_sprite = nullptr;
_currentScene = nullptr;
D3DXCreateSprite(DXUTGetD3D9Device(), &_sprite);
}
void Director::Update()
{
if (_currentScene)
_currentScene->Update();
Renderer::GetInstance()->Render();
GetCursorPos(&p);
ScreenToClient(DXUTGetHWND(), &p);
}
void Director::ChangeScene(Scene* scene)
{
if (_currentScene)
_currentScene->OnExit();
_currentScene = scene;
_currentScene->Init();
}
vector2 Director::GetMousePos()
{
vector2 v = { (float)p.x,(float)p.y };
return v;
}