[ create a new paste ] login | about

Link: http://codepad.org/fJndQ7g2    [ raw code | output | fork ]

C++, pasted on Sep 23:
// DXBase.h
#pragma once
#pragma comment(lib, "d3d9")
#include <d3d9.h>
#include <d3dx9.h>
#include "winMain.h"

class DXBase
{
	// 変数宣言
protected:
	// DirectXオブジェクト
	static LPDIRECT3D9 pD3D;
	static LPDIRECT3DDEVICE9 pDevice;
	
private:
	static D3DPRESENT_PARAMETERS d3dpp;
	
	// 関数宣言
private:
	// 初期化、終了処理 (winMain上で実行)
	friend int APIENTRY _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int);
	static bool Initialize(HWND _hWnd, bool isWindowed);
	static void UnInitialize();
	
public:
	// リセット
	static void Reset();
};

// DXGraphics.h
#pragma once
#include "DXBase.h"

class DXGraphics :public DXBase
{
public:
	DXGraphics(void);
	virtual ~DXGraphics(void);

	void Clear();
	HRESULT BeginScene();
	void EndScene();
	void Present();
};

// GameMain.h
#pragma once
#include "DXGraphics.h"

class GameMain
{
	// 変数宣言
private:
	DXGraphics graphics;
	
	// 関数宣言
public:
	GameMain();
	void MainLoop();
	void Game();
};

// GameMain.cpp

void GameMain::MainLoop()
{
	// バックバッファをクリア
	graphics.Clear();

	// 描画開始
	if (SUCCEEDED(graphics.BeginScene()))
	{
		// GAME処理
		Game();

		// 描画終了
		graphics.EndScene();
	}

	// バックバッファの内容を画面に表示
	graphics.Present();

	graphics.Clear();
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
Line 8: error: #pragma once in main file
cc1plus: warnings being treated as errors
Line 3: warning: ignoring #pragma comment 
Line 17: error: d3d9.h: No such file or directory
Line 18: error: d3dx9.h: No such file or directory
Line 20: error: winMain.h: No such file or directory
Line 8: error: #pragma once in main file
Line 19: error: DXBase.h: No such file or directory
Line 8: error: #pragma once in main file
Line 23: error: DXGraphics.h: No such file or directory
Line 13: error: 'LPDIRECT3D9' does not name a type
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: