-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCRoomCharacter.h
132 lines (104 loc) · 3.71 KB
/
CRoomCharacter.h
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
#ifndef H_ROOM_CHARACTER_CLASS___
#define H_ROOM_CHARACTER_CLASS___
// ===================================================================
// CRoomCharacter.h
// 部屋にいるキャラクラス・ヘッダー
// ===================================================================
#include <windows.h>
#include <TCHAR.h>
#include "../include/types.h"
#include "../include/define.h"
#include "util.h"
#include <math.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <dxerr9.h>
#include <map>
#include <iostream>
#include <vector>
#include "../lib/DXUT/dxstdafx.h"
#include "../lib/DXUT/DXUT.h"
#include "TextureLoader.h"
// 部屋を移動
// キャラを変えられる
// アニメーションする
// 発言が頭の上にでる
// 準備OKとき移動できなくする
// 部屋のキャラクラス
class CRoomCharacter
{
public:
CRoomCharacter(); //
virtual ~CRoomCharacter()
{
if (m_bCreated)
Destroy();
};
// 生成
// pDev : D3Dデバイス
// pTexture : テクスチャ
// nGUIResourceIndex : 基本のGUIリソース番号
// pStatic : スタティック
// pSess : オブジェクト情報
// nSpriteWidth,nSpriteHeight : テクスチャサイズ
// nCharaWidth,nCharaHeight : 表示サイズ
// nAnimationCount : アニメーション数
BOOL Create(LPDIRECT3DTEXTURE9 pTexture, int nGUIResourceIndex, CDXUTDialog* pDialog, type_session* pSess, int nSpriteWidth, int nSpriteHeight, int nAnimationCount, int nCharaWidth, int nCharaHeight);
BOOL Create(LPDIRECT3DTEXTURE9 pTexture, int nGUIResourceIndex, CDXUTDialog* pDialog, type_session* pSess, int nSpriteWidth, int nSpriteHeight, int nCharaLeft, int nCharaTop, int nCharaWidth, int nCharaHeight);
// テクスチャ更新
// pTexture : テクスチャ
// nSpriteWidth,nSpriteHeight : 表示サイズ
// nAnimationCount : アニメーション数
BOOL UpdateTexture(LPDIRECT3DTEXTURE9 pTexture, int nSpriteWidth, int nSpriteHeight, int nAnimationCount, int nCharaWidth, int nCharaHeight);
// テクスチャ更新
BOOL UpdateTexture(LPDIRECT3DTEXTURE9 pTexture, int nSpriteWidth, int nSpriteHeight, int nLeft, int nTop, int nRight, int nBottom);
// 状態更新
void UpdateState();
void Destroy();
void Frame();
// 発言
void Say(WCHAR *message);
BOOL IsCreated()
{ return m_bCreated; };
// 描画
// pDev : D3Dデバイス
// fElapsedTime : 経過時間
void Render(LPDIRECT3DDEVICE9 pDev, float fElapsedTime);
void SetVisible(bool bVisible);
BOOL GetVisible(bool bVisible)
{ return m_bVisible; };
void Hide();
void Show();
// OnLostDeviceEvent
void OnLost();
// OnResetDeviceEvent
void OnReset();
protected:
BOOL CreateControls(LPDIRECT3DTEXTURE9 pTexture, int nGUIResourceIndex, CDXUTDialog* pDialog, type_session* pSess, int nSpriteWidth, int nSpriteHeight, int nAnimationCount, int nCharaWidth, int nCharaHeight);
void CalcDrawRect(); // 描画範囲計算
type_session* p_pSession; // オブジェクト情報
CDXUTDialog* p_pDialog;
int m_nAnimationIndex; // アニメーション描画範囲インデックス
int m_nAnimationCount; // アニメーション描画範囲数
int m_nAnimationTimeCounter; // アニメーションインデックスの数値を増やす時間
int m_nAnimationTime; // アニメーションインデックスの数値を増やす時間
int m_nTextureWidth; // テクスチャ横幅
int m_nTextureHeight; // テクスチャ縦幅
LPDIRECT3DTEXTURE9 p_pTexture; // テクスチャ
CDXUTButton* m_pControlWord; // 発言表示用コントロール
CDXUTStatic* m_pControlName; // 名前表示用コントロール
int m_nControlNameWidth;
int m_nControlNameHeight;
D3DXMATRIXA16 m_matScale; // 表示サイズへのスケーリングマトリックス
int m_nWordViewTimeCounter; // 発言表示時間カウンタ
int m_nWordViewTime; // 発言表示時間
D3DXVECTOR3 m_vecDrawCharaCenter;
int m_nControlNameAdjustX;
int m_nControlNameAdjustY;
int m_nCharaWidth;
int m_nCharaHeight;
BOOL m_bCreated; // 生成済み
RECT m_recDraw; // 描画範囲
bool m_bVisible; // 表示状態
};
#endif