0001: //-------------------------------------------------------------
0002: // File: main.h
0003: //
0004: // Desc: 重心計算
0005: 
0006: // Copyright (c) 2004 IMAGIRE Takashi. All rights reserved.
0007: //-------------------------------------------------------------
0008: #pragma once
0009: 
0010: //-------------------------------------------------------------
0011: // Defines, and constants(定義や定数)
0012: //-------------------------------------------------------------
0013: 
0014: // Struct to store the current input state(現在の入力データを保存する構造体)
0015: struct UserInput
0016: {
0017:     BOOL bRotateUp;
0018:     BOOL bRotateDown;
0019:     BOOL bRotateLeft;
0020:     BOOL bRotateRight;
0021:     BOOL bZoomIn;
0022:     BOOL bZoomOut;
0023:     BOOL bChangeShader;
0024:     BOOL bPause;
0025: };
0026: 
0027: 
0028: 
0029: 
0030: //-------------------------------------------------------------
0031: // Name: class CMyD3DApplication
0032: // Desc: Main class to run this application. Most functionality is inherited
0033: //       from the CD3DApplication base class.
0034: //       (アプリケーションのクラス)
0035: //-------------------------------------------------------------
0036: class CMyD3DApplication : public CD3DApplication
0037: {
0038:     // Shader
0039:     LPD3DXEFFECT            m_pEffect;              // Effect for the sample(エフェクト)
0040:     D3DXHANDLE              m_hTechnique;           // Technique handle for RenderScene(テクニック)
0041: 
0042:     // Rendering targets (レンダリングターゲット)
0043:     LPDIRECT3DSURFACE9      m_pMapZ;                // Depth buffer
0044: 
0045:     LPDIRECT3DTEXTURE9      m_pBackBufferTex;       // 画面に表示するもの
0046:     LPDIRECT3DSURFACE9      m_pBackBufferSurf;
0047:     BOOL                    m_bClear;
0048:     LPDIRECT3DTEXTURE9      m_pTex[5];              // レンダリングターゲット
0049:     LPDIRECT3DSURFACE9      m_pSurf[5];
0050:     LPDIRECT3DTEXTURE9      m_pDotTex;              // 画面に打つ点
0051:     LPDIRECT3DTEXTURE9      m_pTargetTex;           // 重心の表示
0052: 
0053:     float m_fDrop_x;
0054:     float m_fDrop_y;
0055:     int m_bDrop;
0056: 
0057:     // Geometry (通常の座標変換行列)
0058:     D3DXMATRIX              m_mWorld;               // World matrix
0059:     D3DXMATRIX              m_mView;                // View matrix
0060:     D3DXMATRIX              m_mProj;                // Projection matrix
0061: 
0062:     FLOAT                   m_fWorldRotX;   // World rotation state X-axis(X軸回転)
0063:     FLOAT                   m_fWorldRotY;   // World rotation state Y-axis(Y軸回転)
0064:     FLOAT                   m_fViewZoom;    // Distance to lookat (視点の距離)
0065: 
0066:     BOOL                    m_bLoadingApp;  // TRUE, if the app is loading(ロード中?)
0067:     CD3DFont*               m_pFont;        // Font for drawing text(フォント)
0068:     UserInput               m_UserInput;    // Struct for storing user input (入力データ)
0069: 
0070: protected:
0071:     virtual HRESULT OneTimeSceneInit();
0072:     virtual HRESULT InitDeviceObjects();
0073:     virtual HRESULT RestoreDeviceObjects();
0074:     virtual HRESULT InvalidateDeviceObjects();
0075:     virtual HRESULT DeleteDeviceObjects();
0076:     virtual HRESULT Render();
0077:     virtual HRESULT FrameMove();
0078:     virtual HRESULT FinalCleanup();
0079:     virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
0080: 
0081:     void SetDrop(float x , float y);
0082:     void ResetDrop();
0083:     int  IsDrop();
0084: 
0085: 
0086:     HRESULT RenderText();
0087: 
0088:     void    UpdateInput( UserInput* pUserInput );
0089: public:
0090:     LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0091:     CMyD3DApplication();
0092:     virtual ~CMyD3DApplication();
0093: };
0094: 
0095: