DIRECT3D

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
#include <windows.h>
#include <d3d9.h>
#include <time.h>
#include <iostream>
using namespace std;

// Application title
const string APPTITLE = "Create Surface Program";

//macro to read the keyboard
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code)&0x8000)?1:0)

//screen resolution
#define SCREENW 1024
#define SCREENH 768

//Direct3d objects
LPDIRECT3D9 d3d = NULL;
LPDIRECT3DDEVICE9 d3ddev = NULL;
LPDIRECT3DSURFACE9 backbuffer = NULL;
LPDIRECT3DSURFACE9 surface = NULL;

bool gameover = false;

/* Game Initialization function */
bool Game_Init(HWND hWnd)
{
	//initialize Direct3D
	d3d = Direct3DCreate9(D3D_SDK_VERSION);
	if(d3d = NULL)
	{
		MessageBox(hWnd, "Error Initializing Direct3D","Error", MB_OK);
		return false;
	}
	//set the Direct3D presentation paramaters
	D3DPRESENT_PARAMATERS d3dpp;
	ZeroMemory(&d3dpp, sizeof(d3dpp));
	d3dpp.Windowed = TRUE;
	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
	d3dpp.BackBufferCount = 1;
	d3dpp.BackBufferWidth = SCREENW;
	d3dpp.BackBufferHeight = SCREENH;
	d3dpp.hDeviceWindow = hWnd;

	//create the direct3d device
	d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev);

	if(!d3ddev)
	{
		MessageBox(hWnd, "Error Creating Direct3D device", "Error", MB_OK);

	}

	//set random number seed
	srand(time(NULL));

	//clear the back buffer
	d3ddev->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),1.0f,0);

	//create pointer to the back buffer
	d3ddev->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&backbuffer);
hey guys im working on an assignment that creates a bunch of rectangles on to a surface but i've been going through my code and everything is working smoothly except when i got to this my intellisense is giving me an unknown identifier

1
2
//set the Direct3D presentation paramaters
	D3DPRESENT_PARAMATERS d3dpp;


im using Visual studio 2010 ultimate
and i changed my characters from unicode to multibyte and i have the d3d9.lib in Additional dependencies

if anyone could give me a clue as to why its unknown... it would be greatly appreciated
This belongs in the Windows Programming forum.
sorry i made a new one in the winProgramming forum...
Topic archived. No new replies allowed.