CDxBaseView Class Reference

#include <DxBaseClass.h>

Inheritance diagram for CDxBaseView:
Inheritance graph
[legend]
Collaboration diagram for CDxBaseView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CDxBaseView ()
virtual ~CDxBaseView ()
virtual void OnInitialUpdate (void)
virtual void SetState (void)
virtual void ExecRender (void)
virtual void ClearObject (void)
virtual void InitObject (void)
virtual void SetParameter (D3DPRESENT_PARAMETERS *d3dParam, int xsize, int ysize)
POINT GetWindowDisplaySize (POINT pt)
BOOL InitDevice (int xsize=0, int ysize=0, CWnd *cwnd=NULL)
virtual int GetMouseButton ()

Public Attributes

LPDIRECT3D9 lpD3D
LPDIRECT3DDEVICE9 lpD3DDevice
LPDIRECT3DSURFACE9 lpBackBuffer
LPDIRECT3DSURFACE9 lpSurface
LPDIRECT3DTEXTURE9 lpTexture
D3DPRESENT_PARAMETERS d3dParam
LPDIRECTINPUT8 lpDInput
LPDIRECTINPUTDEVICE8 lpDMouse
LPDIRECTINPUTDEVICE8 lpDKeyBoard
POINT bufferSize

Protected Member Functions

virtual void OnActivateView (BOOL bActivate, CView *pActivateView, CView *pDeactiveView)

Detailed Description

Definition at line 124 of file DxBaseClass.h.


Constructor & Destructor Documentation

CDxBaseView (  ) 

Definition at line 15 of file DxBaseClass.cpp.

00016 {
00017     lpD3D        = NULL;
00018     lpD3DDevice  = NULL;    // DirectX9 3Dデバイス
00019     lpBackBuffer = NULL;    // バックバッファ
00020     lpSurface    = NULL;    // サーフェース
00021     lpTexture    = NULL;    // テクスチャ
00022 
00023     lpDInput     = NULL;
00024     lpDMouse     = NULL;    // マウスデバイス
00025     lpDKeyBoard  = NULL;    // キーボードバイス
00026 
00027     bufferSize.x = bufferSize.y = 0;
00028 }

~CDxBaseView (  )  [virtual]

Definition at line 32 of file DxBaseClass.cpp.

References DXRELEASE, CDxBaseView::lpBackBuffer, CDxBaseView::lpD3DDevice, CDxBaseView::lpSurface, CDxBaseView::lpTexture, CExView::pApp, and CAppCallBack::ViewDestructor().

00033 {
00034     //DEBUG_INFO("DESTRUCTOR: CDxBaseView\n");
00035     if (pApp!=NULL) pApp->ViewDestructor(this);     // 上位アプリケーションに通知
00036 
00037 //  DXRELEASE(lpDMouse);        // リリース禁止
00038 //  DXRELEASE(lpDKeyBoard);     // リリース禁止
00039     DXRELEASE(lpTexture);
00040     DXRELEASE(lpSurface); 
00041     DXRELEASE(lpBackBuffer);
00042     DXRELEASE(lpD3DDevice);
00043 }

Here is the call graph for this function:


Member Function Documentation

void ClearObject ( void   )  [virtual]

Reimplemented in CDxSRenderView.

Definition at line 71 of file DxBaseClass.cpp.

References DXRELEASE, CExView::hasViewData, CDxBaseView::lpBackBuffer, CDxBaseView::lpSurface, and CDxBaseView::lpTexture.

Referenced by jbxwl::ResetDx9Device().

00072 {
00073     hasViewData = FALSE;
00074     DXRELEASE(lpTexture);
00075     DXRELEASE(lpBackBuffer);
00076     DXRELEASE(lpSurface);
00077 }

Here is the caller graph for this function:

virtual void ExecRender ( void   )  [inline, virtual]

Reimplemented from CExView.

Reimplemented in CDxVTXBaseView, CDx2DView, CDxDirectView, CDxMGRView, CDxSRenderView, and CDxVScrollView.

Definition at line 150 of file DxBaseClass.h.

00150 {}               // 描画

int GetMouseButton (  )  [virtual]

マウスボタンチェック マウスの押されたボタンをチェック.

戻り値 0 : ボタンは押されていない. 1 : 左ボタン 2 : 右ボタン 3 : 中ボタン

実装に DirectInput を使用.(~~;

Reimplemented from CExView.

Definition at line 147 of file DxBaseClass.cpp.

References CExView::activeWin, and CDxBaseView::lpDMouse.

00148 {
00149     int  ret = 0;
00150     DIMOUSESTATE dims;
00151 
00152     if (lpDMouse!=NULL && activeWin) {
00153         lpDMouse->Acquire();
00154         HRESULT hr = lpDMouse->GetDeviceState(sizeof(DIMOUSESTATE), &dims);
00155         if (SUCCEEDED(hr)) {
00156             if      (dims.rgbButtons[0]==0x80) ret = 1;             
00157             else if (dims.rgbButtons[1]==0x80) ret = 2;             
00158             else if (dims.rgbButtons[2]==0x80) ret = 3;                             
00159         }
00160 //      lpDMouse->Unacquire();
00161     }
00162     return  ret;
00163 }

POINT GetWindowDisplaySize ( POINT  pt  )  [virtual]

Reimplemented from CExView.

Definition at line 113 of file DxBaseClass.cpp.

References CDxBaseView::lpD3D.

00114 {
00115     D3DDISPLAYMODE disp;
00116 
00117     lpD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &disp);    // ルートウィンドウのサイズ
00118     int scrSize = Min(disp.Width, disp.Height)*2/3;
00119 
00120     int sz = Max(pt.x, pt.y);
00121     if (sz<=0) return pt; 
00122     
00123     double rs = 1.0;
00124     if (sz>scrSize) {
00125         rs   = scrSize/sz;
00126         pt.x = (int)(pt.x*rs);
00127         pt.y = (int)(pt.y*rs);
00128     }
00129 
00130     //wRateSize.Format("  (%3d%%)", (int)(rs*100+0.5));
00131     return pt;
00132 }

BOOL InitDevice ( int  xsize = 0,
int  ysize = 0,
CWnd *  cwnd = NULL 
)

機能: DirectX9のデバイスを作る. 引数: int cxs, cys ウィンドウの初期サイズ,省略した場合は画像データ(cmnHead)に合わせられる. 戻値: 成功:TRUE, 失敗:FALSE 説明:

Definition at line 53 of file DxBaseClass.cpp.

References CDxBaseView::d3dParam, jbxwl::Dx9CreateGraphic(), jbxwl::GpD3D, jbxwl::GpDKeyBoard, jbxwl::GpDMouse, CDxBaseView::lpD3D, CDxBaseView::lpD3DDevice, CDxBaseView::lpDKeyBoard, CDxBaseView::lpDMouse, and CDxBaseView::SetParameter().

Referenced by CDxVScrollView::OnInitialUpdate(), CDxSRenderView::OnInitialUpdate(), CDxMGRView::OnInitialUpdate(), CDxDirectView::OnInitialUpdate(), and CDx2DView::OnInitialUpdate().

00054 {
00055     lpD3D = GpD3D;
00056     if (cwnd ==NULL) cwnd = this;
00057     SetParameter(&d3dParam, xsize, ysize);
00058 
00059     lpD3DDevice = Dx9CreateGraphic(lpD3D, &d3dParam, cwnd->m_hWnd);
00060     if (lpD3DDevice==NULL) return FALSE;
00061     
00062     // インプットデバイス
00063     lpDMouse    = GpDMouse;
00064     lpDKeyBoard = GpDKeyBoard;
00065     
00066     return TRUE; 
00067 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void InitObject ( void   )  [inline, virtual]

Reimplemented in CDxVTXBaseView, CDx2DView, CDxDirectView, CDxMGRView, CDxSRenderView, and CDxVScrollView.

Definition at line 152 of file DxBaseClass.h.

References CDxBaseView::SetState().

Referenced by jbxwl::ResetDx9Device().

00152 { SetState();}   // デバイスリセット時のリソース再獲得関数

Here is the call graph for this function:

Here is the caller graph for this function:

void OnActivateView ( BOOL  bActivate,
CView *  pActivateView,
CView *  pDeactiveView 
) [protected, virtual]

Reimplemented from CExView.

Definition at line 166 of file DxBaseClass.cpp.

References CDxBaseView::lpDMouse.

00167 {
00168     if (lpDMouse!=NULL) {   
00169         lpDMouse->Unacquire();
00170         if (bActivate && pActivateView==this) {
00171             lpDMouse->Acquire();
00172         }
00173     }
00174 
00175     CExView::OnActivateView(bActivate, pActivateView, pDeactiveView);
00176 }

virtual void OnInitialUpdate ( void   )  [inline, virtual]

Reimplemented from CExView.

Reimplemented in CDxVTXBaseView, CDx2DView, CDxDirectView, CDxMGRView, CDxSRenderView, CDxVScrollView, and CDx3DDirectView.

Definition at line 148 of file DxBaseClass.h.

00148 {}          // 初期化

void SetParameter ( D3DPRESENT_PARAMETERS *  d3dParam,
int  xsize,
int  ysize 
) [virtual]

Definition at line 83 of file DxBaseClass.cpp.

Referenced by CDxBaseView::InitDevice().

00084 {
00085     RECT rect;
00086         
00087     if (xsize>0 && ysize>0) {
00088         rect.right  = xsize;
00089         rect.bottom = ysize;
00090     }
00091     else {
00092         this->GetClientRect(&rect);
00093     }
00094     rect.right  = (int)(rect.right*1.5);
00095     rect.bottom = (int)(rect.bottom*1.5);
00096 
00097     ZeroMemory(d3dParam, sizeof(D3DPRESENT_PARAMETERS));
00098     d3dParam->BackBufferWidth        = rect.right; 
00099     d3dParam->BackBufferHeight       = rect.bottom;  
00100     d3dParam->BackBufferCount        = 1; 
00101     d3dParam->Windowed               = TRUE;
00102     d3dParam->SwapEffect             = D3DSWAPEFFECT_DISCARD;
00103 //  d3dParam->SwapEffect             = D3DSWAPEFFECT_FLIP;
00104     d3dParam->BackBufferFormat       = D3DFMT_UNKNOWN;
00105     d3dParam->EnableAutoDepthStencil = TRUE;
00106     d3dParam->AutoDepthStencilFormat = D3DFMT_D16;
00107 }

Here is the caller graph for this function:

virtual void SetState ( void   )  [inline, virtual]

Reimplemented in CDxVTXBaseView, and CDxSRenderView.

Definition at line 149 of file DxBaseClass.h.

Referenced by CDxBaseView::InitObject().

00149 {}                 // 環境設定

Here is the caller graph for this function:


Member Data Documentation

POINT bufferSize
D3DPRESENT_PARAMETERS d3dParam
LPDIRECT3DSURFACE9 lpBackBuffer
LPDIRECT3D9 lpD3D

Definition at line 127 of file DxBaseClass.h.

Referenced by CDxBaseView::GetWindowDisplaySize(), and CDxBaseView::InitDevice().

LPDIRECT3DDEVICE9 lpD3DDevice
LPDIRECTINPUT8 lpDInput

Definition at line 134 of file DxBaseClass.h.

LPDIRECTINPUTDEVICE8 lpDKeyBoard

Definition at line 136 of file DxBaseClass.h.

Referenced by CDxBaseView::InitDevice().

LPDIRECTINPUTDEVICE8 lpDMouse
LPDIRECT3DSURFACE9 lpSurface
LPDIRECT3DTEXTURE9 lpTexture

Definition at line 131 of file DxBaseClass.h.

Referenced by CDxBaseView::ClearObject(), and CDxBaseView::~CDxBaseView().


The documentation for this class was generated from the following files:

Generated on 15 Nov 2023 for JunkBox_Win_Lib by  doxygen 1.6.1