Original Post
hi i have just bought the book " tricks of the game programming gurus ". i have typed out the freakout programme in the first part of the book and i keep getting 2 errors. first i am using visual C++ 6.0 standard edition compiler and i have installed the
directX 6.1 sdk as well and i have included the ddraw.lib into my project as well. but i keep getting 2 errors coming up which are.
here is the code that im using from the book:
// BLACKBOX.h - header file for demo game engine library
// watch for multiple inclusions
#ifndef BLACKBOX
#define BLACKBOX
// DEFINES ///////////////////////////////////////////////////////////
// default screen size
#define SCREEN_WIDTH 640 // size of screen
#define SCREEN_HEIGHT 480
#define SCRREN_BPP 8 // bits per pixel
#define MAX_COLORS 256 // maximum colors
// MACROS ////////////////////////////////////////////////////////////
// these read the keyboard asynchronously
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
// initializes a direct draw struct
#define DD_INIT_STRUCT(ddstruct) { memset(&ddstruct,0,sizeof(ddstruct)); ddstruct.dwSize=sizeof(ddstruct); }
// TYPES /////////////////////////////////////////////////////////////
// basic unsigned types
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef unsigned char UCHAR;
typedef unsigned char BYTE;
// EXTERNALS ////////////////////////////////////////////////////////
**extern LPDIRECTDRAW4 lpdd; // dd object
extern LPDIRECTDRAWSURFACE4 lpddsprimary; // dd primary surface
extern LPDIRECTDRAWSURFACE4 lpddsback; // dd back surface
extern LPDIRECTDRAWPALETTE lpddpal; // a pointer to palette
extern LPDIRECTDRAWCLIPPER lpddclipper; // dd clipper
extern PALETTEENTRY palette[256]; // color palette
extern PALETTEENTRY save_palette[256]; // used to save palettes
extern DDSURFACEDESC2 ddsd; // dd surface desciption struct
extern DDBLTFX ddbltfx; // used to fill
extern DDSCAPS2 ddscaps; // dd surface capabilities struct
extern HRESULT ddrval; // result back from dd calls
extern DWORD start_clock_count; // used for timimg
// these defined the general clipping rectangle
extern int min_clip_x, // clipping rectangle
max_clip_x,
min_clip_y,
max_clip_y;
// these are over written globally by DD_Init()
extern int screen_width, // width of screen
screen_height, // height of screen
screen_bpp; // bits per pixel
// PROTOTYPES ////////////////////////////////////////////////////////
// DirectDraw functions
int DD_init(int width, int height, int bpp);
int DD_Shutdown(void);
LPDIRECTDRAWCLIPPER DD_Attach_Clipper(LPDIRECTDRAWSURFACE4 lpdds,
int num_rects, LPRECT clip_list);
int DD_Flip(void);
int DD_Fill_Surface(LPDIRECTDRAWSURFACE4 lpdds, int color);
// general utility functions
DWORD Start_Clock(void);
DWORD Get_Clock(void);
DWORD Wait_Clock(DWORD count);
// graphics funtions
int Draw_Rectangle(int x1, int y1,
int x2, int y2,
int color,
LPDIRECTDRAWSURFACE4 lpdds=lpddsback);
// gdi functions
int Draw_Text_GDI(char *text, int x,int y, COLORREF color,
LPDIRECTDRAWSURFACE4 lpdds=lpddsback);
int Draw_Text_GDI(char *text, int x,int y,int color,
LPDIRECTDRAWSURFACE4 lpdds=lpddsback);
#endif
and these are the errors can any one help me to sort this problem out please:
--------------------Configuration: FREAKOUT - Win32 Debug--------------------
Compiling...
FREAKOUT.cpp
c:\program files\microsoft visual studio\myprojects\freakout\blackbox.h(39) : error C2146: syntax error : missing '';'' before identifier ''lpdd''
c:\program files\microsoft visual studio\myprojects\freakout\blackbox.h(39) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
FREAKOUT.obj - 2 error(s), 0 warning(s)
I am "BORG" resistance is futile