stg/game/stggame.h : ver090316
#ifndef __STG_GAME_STGGAME_H__
#define __STG_GAME_STGGAME_H__
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <boost/smart_ptr.hpp>
#include <boost/signal.hpp>
#include "siki/siki.hpp"
#include "siki/d3d/defination.hpp"
#include "siki/d3d/gamebase.hpp"
#include "siki/d3d/igamewindow.hpp"
#include "siki/d3d/scenelist.hpp"
#include "scene0.hpp"
namespace stg{
namespace game{
/****
**** class StgGame : public siki::d3d::Game
****
**** ゲームを統括するクラス
****
****
****/
class StgGame : public siki::d3d::GameBase{
/* デフォルトコンストラクタは使用しない */
StgGame();
public:
/***
*** コンストラクタ
***/
StgGame(siki::d3d::IGameWindow *gamewindow);
/***
*** デストラクタ
***/
virtual ~StgGame();
/***
*** 仮想ウィンドウプロシージャ
***/
virtual LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
/***
*** シーンの更新、描画を行う
***/
virtual void Render();
private:
/**
** インスタンスの初期化を行う
**/
bool Initialize();
private: /* フィールド */
/** **/
//Scene0 *m_scene0;
};
}} // namespace stg::game
#endif // __STG_GAME_STGGAME_H__
stg/game/stggame.cpp : ver090316
#include "../StdAfx.h"
#include <boost/smart_ptr.hpp>
#include <boost/signal.hpp>
#include "stggame.hpp"
namespace stg{
namespace game{
using namespace siki::d3d;
/***
*** コンストラクタ
***/
StgGame::StgGame(IGameWindow *gamewindow) : GameBase(gamewindow){
// シーンを作成して
boost::shared_ptr<Scene> scene0(new Scene0(this));
// リストに追加
get_scenelist()->Register(scene0);
}
/***
*** 仮想デストラクタ
***/
StgGame::~StgGame(){
}
/***
*** ゲーム用 仮想ウィンドウプロシージャ
***
***/
LRESULT StgGame::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
return siki::d3d::GameBase::WndProc(hwnd, message, wParam, lParam);
}
/***
*** 描画メソッド
*** ウィンドウループ内の空き時間にGameWindowから呼ばれる
***/
void StgGame::Render(){
boost::shared_ptr<IDirect3DDevice9> device = get_d3ddevice();
/* 黒で塗りつぶして消去 */
device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0, 0);
SafeBeginScene();
GameBase::Render();
SafeEndScene();
device->Present(NULL,NULL,NULL,NULL);
}
/**
** 初期化
**
**/
bool StgGame::Initialize(){
return true;
}
}} // namespace stg::game
最終更新:2009年03月16日 04:20