-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
result2.cpp
162 lines (133 loc) · 6.27 KB
/
result2.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//=============================================================================
//
// ���U���g��ʏ��� [result2.cpp]
// Author : natsuk4ze
//
//=============================================================================
#include "main.h"
#include "result2.h"
#include "input.h"
//*****************************************************************************
// �v���g�^�C�v�錾
//*****************************************************************************
HRESULT MakeVertexResult2(void);
//*****************************************************************************
// �O���[�o���ϐ�
//*****************************************************************************
LPDIRECT3DTEXTURE9 g_pD3DTextureResult2 = NULL; // �e�N�X�`���ւ̃|�C���^
LPDIRECT3DTEXTURE9 g_pD3DTextureResult2Logo = NULL; // �e�N�X�`���ւ̃|�C���^
VERTEX_2D g_vertexWkResult2[NUM_VERTEX]; // ���_���i�[���[�N
VERTEX_2D g_vertexWkResult2Logo[NUM_VERTEX]; // ���_���i�[���[�N
//=============================================================================
// ����������
//=============================================================================
HRESULT InitResult2(void)
{
LPDIRECT3DDEVICE9 pDevice = GetDevice();
// �e�N�X�`���̓ǂݍ���
D3DXCreateTextureFromFile(pDevice, // �f�o�C�X�ւ̃|�C���^
TEXTURE_RESULT2, // �t�@�C���̖��O
&g_pD3DTextureResult2); // �ǂݍ��ރ������[
D3DXCreateTextureFromFile(pDevice, // �f�o�C�X�ւ̃|�C���^
TEXTURE_RESULT2_LOGO, // �t�@�C���̖��O
&g_pD3DTextureResult2Logo); // �ǂݍ��ރ������[
// ���_���̍쐬
MakeVertexResult2();
return S_OK;
}
//=============================================================================
// �I������
//=============================================================================
void UninitResult2(void)
{
if (g_pD3DTextureResult2 != NULL)
{// �e�N�X�`���̊J��
g_pD3DTextureResult2->Release();
g_pD3DTextureResult2 = NULL;
}
if (g_pD3DTextureResult2Logo != NULL)
{// �e�N�X�`���̊J��
g_pD3DTextureResult2Logo->Release();
g_pD3DTextureResult2Logo = NULL;
}
}
//=============================================================================
// �X�V����
//=============================================================================
void UpdateResult2(void)
{
if (GetKeyboardTrigger(DIK_RETURN))
{// Enter��������A�X�e�[�W���ւ���
SetStage(STAGE_TITLE);
}
else if (IsButtonTriggered(0, BUTTON_B))
{
SetStage(STAGE_TITLE);
}
}
//=============================================================================
// �`�揈��
//=============================================================================
void DrawResult2(void)
{
LPDIRECT3DDEVICE9 pDevice = GetDevice();
// ���_�t�H�[�}�b�g�̐ݒ�
pDevice->SetFVF(FVF_VERTEX_2D);
// �e�N�X�`���̐ݒ�
pDevice->SetTexture(0, g_pD3DTextureResult2);
// �|���S���̕`��
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, NUM_POLYGON, g_vertexWkResult2, sizeof(VERTEX_2D));
// ���_�t�H�[�}�b�g�̐ݒ�
pDevice->SetFVF(FVF_VERTEX_2D);
// �e�N�X�`���̐ݒ�
pDevice->SetTexture(0, g_pD3DTextureResult2Logo);
// �|���S���̕`��
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, NUM_POLYGON, g_vertexWkResult2Logo, sizeof(VERTEX_2D));
}
//=============================================================================
// ���_�̍쐬
//=============================================================================
HRESULT MakeVertexResult2(void)
{
// ���_���W�̐ݒ�
g_vertexWkResult2[0].vtx = D3DXVECTOR3(RESULT2_POS_X, RESULT2_POS_Y, 0.0f);
g_vertexWkResult2[1].vtx = D3DXVECTOR3(RESULT2_POS_X + RESULT2_SIZE_X, RESULT2_POS_Y, 0.0f);
g_vertexWkResult2[2].vtx = D3DXVECTOR3(RESULT2_POS_X, RESULT2_POS_Y + RESULT2_SIZE_Y, 0.0f);
g_vertexWkResult2[3].vtx = D3DXVECTOR3(RESULT2_POS_X + RESULT2_SIZE_X, RESULT2_POS_Y + RESULT2_SIZE_Y, 0.0f);
// �e�N�X�`���̃p�[�X�y�N�e�B�u�R���N�g�p
g_vertexWkResult2[0].rhw =
g_vertexWkResult2[1].rhw =
g_vertexWkResult2[2].rhw =
g_vertexWkResult2[3].rhw = 1.0f;
// ���ˌ��̐ݒ�
g_vertexWkResult2[0].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
g_vertexWkResult2[1].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
g_vertexWkResult2[2].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
g_vertexWkResult2[3].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
// �e�N�X�`�����W�̐ݒ�
g_vertexWkResult2[0].tex = D3DXVECTOR2(0.0f, 0.0f);
g_vertexWkResult2[1].tex = D3DXVECTOR2(1.0f, 0.0f);
g_vertexWkResult2[2].tex = D3DXVECTOR2(0.0f, 1.0f);
g_vertexWkResult2[3].tex = D3DXVECTOR2(1.0f, 1.0f);
// ���_���W�̐ݒ�
g_vertexWkResult2Logo[0].vtx = D3DXVECTOR3(RESULT2LOGO_POS_X, RESULT2LOGO_POS_Y, 0.0f);
g_vertexWkResult2Logo[1].vtx = D3DXVECTOR3(RESULT2LOGO_POS_X + RESULT2LOGO_SIZE_X, RESULT2LOGO_POS_Y, 0.0f);
g_vertexWkResult2Logo[2].vtx = D3DXVECTOR3(RESULT2LOGO_POS_X, RESULT2LOGO_POS_Y + RESULT2LOGO_SIZE_Y, 0.0f);
g_vertexWkResult2Logo[3].vtx = D3DXVECTOR3(RESULT2LOGO_POS_X + RESULT2LOGO_SIZE_X, RESULT2LOGO_POS_Y + RESULT2LOGO_SIZE_Y, 0.0f);
// �e�N�X�`���̃p�[�X�y�N�e�B�u�R���N�g�p
g_vertexWkResult2Logo[0].rhw =
g_vertexWkResult2Logo[1].rhw =
g_vertexWkResult2Logo[2].rhw =
g_vertexWkResult2Logo[3].rhw = 1.0f;
// ���ˌ��̐ݒ�
g_vertexWkResult2Logo[0].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
g_vertexWkResult2Logo[1].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
g_vertexWkResult2Logo[2].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
g_vertexWkResult2Logo[3].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
// �e�N�X�`�����W�̐ݒ�
g_vertexWkResult2Logo[0].tex = D3DXVECTOR2(0.0f, 0.0f);
g_vertexWkResult2Logo[1].tex = D3DXVECTOR2(1.0f, 0.0f);
g_vertexWkResult2Logo[2].tex = D3DXVECTOR2(0.0f, 1.0f);
g_vertexWkResult2Logo[3].tex = D3DXVECTOR2(1.0f, 1.0f);
return S_OK;
}