-Visual Studio 2003
-Win32 Console Project
-C++ Source File
-HAPI is the API
-DirectX 9.0 SDK
Create function to clear screen, create function to clear pixel on screen to arbitrary colour (star-filled background)
apparently, in the function body of clearScreen, the HAPI_GetScreenPtr(); comes up with the build error 'identifier not found, even with argument dependent look-up'Code:#include <HAPI_lib.h> #include <stdlib.h> typedef unsigned long int DWORD; void clearScreen ( BYTE, BYTE, BYTE, int, int ); void setPixel ( BYTE *, int, int, int, BYTE, BYTE, BYTE ); void main() { int screenWidth=400; int screenHeight=300; if (!HAPI_Initialise(&screenWidth,&screenHeight)) return; while(HAPI_Update()) { int NumberOfStars; int rand(); BYTE red = 255; BYTE green = 255; BYTE blue = 0; BYTE *screen; clearScreen ( red, green, blue, screenWidth, screenHeight ); for(int i = 0; i < NumberOfStars; i++) { int x = rand() % screenWidth; int y = rand() % screenHeight; setPixel( screen, x, y, screenWidth, red, green, blue ); } } return; } void clearScreen (BYTE r, BYTE g, BYTE b, int screenWidth, int screenHeight ) { BYTE *screen = HAPI_GetScreenPtr(); DWORD colour = ( r << 24 | g << 16 | b << 8 ); DWORD *Ptr = ( DWORD * ) screen; for ( int y = 0; y < screenWidth * screenHeight; y++ ) { memcpy ( Ptr, &colour, 4 ); Ptr += 4; } } void setPixel ( BYTE *destinationPtr, int x, int y, int screenWidth, BYTE r, BYTE g, BYTE b ) { int offset = ( x+y*screenWidth )*4; destinationPtr += offset; }
im stumped, anyone got any ideas?
if you need wana download the API and have a go click here and go to HAPI. remember you need DirectX installed.
The project is under Milestone 1.
<Mod edit - You'll get more help if you ask nicely. I've edited your thread title.>



LinkBack URL
About LinkBacks


