weird syntax error

Hi,
any help would be appreciated.
I get an syntax error C2146 missing ')' before game over in if(KEY_DOWN(VK_ESCAPE))

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "MyDirectX.h"
using namespace std;

const string APPTITLE = "Transparent Sprite Demo";
const int SCREENW = 1024;
const int SCREENH = 768;

LPDIRECT3DTEXTURE9 image_colorkey = NULL;
LPDIRECT3DTEXTURE9 image_alpha = NULL;
LPDIRECT3DTEXTURE9 image_notrans = NULL;

/**
**Game initialization
**/

bool Game_Init(HWND window)
{
	//initialize Direct3D
	if(Direct3D_Init(window, SCREENW, SCREENH, false))
	{
		MessageBox(0, "Error initializing Direct3D", "ERROR", 0);
		return false;
	}

	//initialize DirectInput
	if(!DirectInput_Init(window))
	{
		MessageBox(0, "Error initializing DirectInput", "ERROR", 0);
		return false;
	}

	//load non-transparent image
	image_notrans = LoadTexture("shuttle_notrans.bmp");
	if(!image_notrans) return false;

	//load color-keyed transparent image
	image_colorkey = LoadTexture("shuttle_colorkey.bmp", D3DCOLOR_XRGB(255, 0, 255));
	if(!image_colorkey) return false;

	//load alpha transparent image
	image_alpha = LoadTexture("shuttle_alpha.tga");
	if(!image_alpha) return false;

	return true;
}
void Game_Run(HWND window)
{
	//make sure the Direct3D device is valid
	if(!d3ddev) return;

	//update input devices
	DirectInput_Update();

	//clear the scene
	d3ddev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 100), 1.0f, 0);
	
	//start rendering
	if(d3ddev->BeginScene())
	{
		//start drawing
		spriteobj->Begin(D3DXSPRITE_ALPHABLEND);

		//draw the sprite
		D3DXVECTOR3 pos1(10, 10, 0);
		spriteobj->Draw(image_notrans, NULL, NULL, &pos1, 
			D3DCOLOR_XRGB(255, 255, 255));

		D3DXVECTOR3 pos2(350, 10, 0);
		spriteobj->Draw(image_colorkey, NULL, NULL, &pos2,
			D3DCOLOR_XRGB(255, 255, 255));

		D3DXVECTOR3 pos3(700, 10, 0);
		spriteobj->Draw(image_alpha, NULL, NULL, &pos3,
			D3DCOLOR_XRGB(255, 255, 255));

		//stop drawing
		spriteobj->End();

		//stop rendering
		d3ddev->EndScene();
		d3ddev->Present(NULL, NULL, NULL, NULL);
	}

	//Escape key ends program
	if(KEY_DOWN(VK_ESCAPE))
		gameover = true;

	//controller Back button also ends
	if(controllers[0].wButtons & XINPUT_GAMEPAD_BACK)
		gameover = true;
}

/**
**Game shutdown
**/
void Game_End()
{
	//free memory and shut down
	image_notrans->Release();
	image_colorkey->Release();
	image_alpha->Release();

	DirectInput_Shutdown();
	Direct3D_Shutdown();
}
		
Is KEY_DOWN some kind of macro? maybe the macro is screwed up

thanks for your response, I greatly appreciate it

from MyDirectX.cpp
1
2
3
4
bool Key_Down(int key)
{
	return (bool)(keys[key] & 0x80);
}


from MyDirectX.h

bool Key_Down(int);

Also is DirectX related questions better suited for general forum?
Last edited on
KEY_DOWN is not the same as Key_Down
I missed that.....lol. Thanks.
now my problem is an error initializing Direct3D
if(!Direct3D_Init(window, SCREENW, SCREENH, false))

there must be a ghost in my machine becasue the ! mark disapeared or something.

I got it to work, I'm so happy :)
Topic archived. No new replies allowed.