diff --git a/harbour/directx/buvcdx.bat b/harbour/directx/buvcdx.bat new file mode 100644 index 0000000000..079bfef97c --- /dev/null +++ b/harbour/directx/buvcdx.bat @@ -0,0 +1,2 @@ +..\..\bin\harbour %1 /n +cl -Fd..\..\bin\harbour -w -Zi -TP -GZ -GA -DDEBUG -DHARBOUR_USE_GTAPI -DHARBOUR_USE_WIN_GTAPI -I..\..\include %1.c /link /subsystem:WINDOWS /NODEFAULTLIB:libcd.lib ..\..\obj\symbols.obj ..\..\libs\vc\harbour.lib ..\..\libs\vc\terminal.lib libc.lib user32.lib ..\..\Contrib\DirectX\directx\release\directx.lib ..\..\libs\win32\directx\lib\vc\ddraw.lib gdi32.lib \ No newline at end of file diff --git a/harbour/directx/directx.lib b/harbour/directx/directx.lib new file mode 100644 index 0000000000..47bf2ec1d7 Binary files /dev/null and b/harbour/directx/directx.lib differ diff --git a/harbour/directx/lib/vc/ddraw.lib b/harbour/directx/lib/vc/ddraw.lib new file mode 100644 index 0000000000..f6866a01be Binary files /dev/null and b/harbour/directx/lib/vc/ddraw.lib differ diff --git a/harbour/directx/media/anima2.bmp b/harbour/directx/media/anima2.bmp new file mode 100644 index 0000000000..1e801fe23e Binary files /dev/null and b/harbour/directx/media/anima2.bmp differ diff --git a/harbour/directx/media/black.bmp b/harbour/directx/media/black.bmp new file mode 100644 index 0000000000..ce6963e4e3 Binary files /dev/null and b/harbour/directx/media/black.bmp differ diff --git a/harbour/directx/media/brick1.bmp b/harbour/directx/media/brick1.bmp new file mode 100644 index 0000000000..ce1b4d68bb Binary files /dev/null and b/harbour/directx/media/brick1.bmp differ diff --git a/harbour/directx/media/brick2.bmp b/harbour/directx/media/brick2.bmp new file mode 100644 index 0000000000..c3f7b55418 Binary files /dev/null and b/harbour/directx/media/brick2.bmp differ diff --git a/harbour/directx/media/brick3.bmp b/harbour/directx/media/brick3.bmp new file mode 100644 index 0000000000..52bfe3f4e6 Binary files /dev/null and b/harbour/directx/media/brick3.bmp differ diff --git a/harbour/directx/media/shot.bmp b/harbour/directx/media/shot.bmp new file mode 100644 index 0000000000..3796ca47d7 Binary files /dev/null and b/harbour/directx/media/shot.bmp differ diff --git a/harbour/directx/readme.1st b/harbour/directx/readme.1st new file mode 100644 index 0000000000..1cda0fc59b --- /dev/null +++ b/harbour/directx/readme.1st @@ -0,0 +1,80 @@ +/* + * Copyright(C) 1999 by Jesus Salas + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR + * + * You can contact me at: jsalas@gruposp.com jsalas@sp-editores.es + * + */ + + + Harbour - GAL Lib - DirectX 6.1 ( DDraw implementation for Windows ) +------------------------------------------------------------------------------------------- + + Well, this is the first implementation of Graphics Animation Library + for Windows/DirectX 6.1 and Harbour + + + 1)._ What do you need for make/run the samples. + + - A Windows 95/98 ( Nt don't support DirectX 6 ) + - MSVC 6.0 ( BC coming soon ) + - DirectX 6.1 Run-Time ( you can download it from + http://www.microsoft.com/directx ) + + - Set your resolution to 640x480 before running the sample. + + 2)._ Files in this distribution. ( HDx01.zip ) + + /DirectX/DirectX.lib -> Lib for Harbour + + /DirectX/lib/Ddraw.lib -> Lib from MS for VC ( DirectX SDK ) + + /DirectX/BuVcDx.Bat -> Bat file for Build the sample for MSVC 6.0 + + /DirectX/Samples/TestDX.Prg -> a BreakOut like sample Game + + /DirectX/Media -> Media files for the sample ( .bmp files ) + + 3)._ Building the sample + + copy TestDx.prg to /harbour/tests/working/ + copy BuVcDx.bat ro /harbour/tests/working/ + + 1) harbour testdx + 2) BuVcDx testdx + 3) copy .exe to a directory with media files + + Run the EXE! + + Keys for the sample: + + Space -> Shot. + Cursor Left -> Bunny go to left. + Cursor Right -> Bunny go to right. + Shift hold down -> Bunny Turbo mode on. + + 4)._ Considerations. + + You need to have the media files into the same directory of final .exe file + + The source file for DirectX for harbour is not released for now, but in a short time + it will be released. ;) ( i'm cleaning the code ) + + + Please if you test/use it... send to me feedback for continue supporting it! + + Enjoy it! + + Regards + Jesús Salas + Spain + jsalas@gruposp.com + + + + + + diff --git a/harbour/directx/samples/testdx.prg b/harbour/directx/samples/testdx.prg new file mode 100644 index 0000000000..cff245432d --- /dev/null +++ b/harbour/directx/samples/testdx.prg @@ -0,0 +1,174 @@ + Static spBunny + Static spShots + Static nShotsActive + Static spaBreaks + Static spTorretShot + Static spTorretShot2 + Static spTorretShot3 + Static spTorretShot4 + Static spTorretShot5 + Static spTorretSequencer + Static spBunnyLife + Static spOuch + Static sppq + Static spzan + + Function Main() + + m_hWnd = dd_CreateWindow() + + // Background........... + + sfBack = dd_CreateOffScreenBitmap(NIL,NIL) + dd_LoadBmpIntoSurface( sfBack, "black.bmp", 0 , 0, 640, 480 ) + spBack = dd_CreateSprite( sfBack, "background", 640, 480, 1, 101, .t., 240 ) + dd_SPSetXY( spBack, 0,0) + + + // Bricks...... + + sfBreak1 = dd_CreateOffScreenBitmap(NIL,NIL) + dd_LoadBmpIntoSurface( sfBreak1, "brick1.bmp", 0 , 0, 640, 480 ) + + sfBreak2 = dd_CreateOffScreenBitmap(NIL,NIL) + dd_LoadBmpIntoSurface( sfBreak2, "brick2.bmp", 0 , 0, 640, 480 ) + + sfBreak3 = dd_CreateOffScreenBitmap(NIL,NIL) + dd_LoadBmpIntoSurface( sfBreak3, "brick3.bmp", 0 , 0, 640, 480 ) + + spaBreaks = Array(80) + nCont = 1 + for t=1 to 80 + if nCont = 3 + spaBreaks[t] = dd_CreateSprite( sfBreak3, "Break", 30, 15, 6, 100, .f., 240 ) + nCont = 1 + else + if nCont = 2 + spaBreaks[t] = dd_CreateSprite( sfBreak2, "Break", 30, 15, 6, 100, .f., 240 ) + nCont = 3 + else + if nCont = 1 + spaBreaks[t] = dd_CreateSprite( sfBreak1, "Break", 30, 15, 6, 100, .f., 240 ) + nCont = 2 + end if + end if + end if + + dd_SPSetSolid( spaBreaks[t], .t. ) + dd_SPSetVisible( spaBreaks[t], .t. ) + dd_SPOnCollision( spaBreaks[t], "BRICK_ONCOLLISION" ) + next + + for t=1 to 20 + dd_SPSetXY( spaBreaks[t], t*30 + 5,10 ) + next + for t=21 to 40 + dd_SPSetXY( spaBreaks[t], ( t - 20 ) * 30 + 12,25 ) + next + for t=41 to 60 + dd_SPSetXY( spaBreaks[t], ( t - 40 ) * 30+ 5 ,40 ) + next + for t=61 to 80 + dd_SPSetXY( spaBreaks[t], ( t - 60 ) * 30 + 12,55 ) + next + + // Shots...... + + sfShot = dd_CreateOffScreenBitmap(NIL,NIL) + dd_LoadBmpIntoSurface( sfShot, "shot.bmp", 0 , 0, 640, 480 ) + spShots = Array( 10 ) + nShotsActive = 1 + + for t=1 to 10 + spShots[t] = dd_CreateSprite( sfShot, "Shot", 10, 20, 3, 100, .f., 240 ) + dd_SPSetSolid( spShots[ t ], .t. ) + dd_SPSetMasked( spShots[ t ], .t. ) + dd_SPOnOutScreen( spShots[ t ], "SHOT_OUTOFBOUND" ) + next + + + // Bunny.......... + + sfBunny = dd_CreateOffScreenBitmap(NIL,NIL) + dd_LoadBmpIntoSurface( sfBunny, "anima2.bmp", 0 , 0, 640, 480 ) + spBunny = dd_CreateSprite( sfBunny, "bunny",70,52 , 6, 101, .t., 240 ) + + dd_SPSetMasked( spBunny, .t. ) + dd_SPSetXY( spBunny, 0, 420 ) + dd_SPOnFirstFrame( spBunny, "BUNNY_ONFIRSTFRAME" ) + dd_SPSetVisible( spBunny , .t. ) + + spBunnyLife = 4 + + dd_StartWindow( m_hWnd ) + + + return + + +//-------------------------------------------------------------// + + function Brick_OnCollision( nMe, nCollided ) + lOk = .f. + for t=1 to 10 + if nCollided = spShots[t] + lOk = .t. + end if + next + if lOk + dd_SPSetVisible( nCollided, .f. ) + dd_SPSetVisible( nMe, .f. ) + end if + return + +//-------------------------------------------------------------// + + function Shot_OutOfBound( nShot ) + dd_SPSetVisible( nShot, .f. ) + return + +//-------------------------------------------------------------// + + function Bunny_OnFirstFrame( ) + + if dd_isKeyPressed( 16 ) + plusVelo = 2 + else + plusVelo = 1 + end if + + dd_SPClearDirection( spBunny ) + + if dd_isKeyPressed( 39 ) + dd_SPSetDirection( spBunny, 6, 8 * plusVelo , 0 ) + end if + + if dd_isKeyPressed( 37 ) + dd_SPSetDirection( spBunny, 4, -8 * plusVelo , 0 ) + end if + + return + +//-------------------------------------------------------------// + + function ddOnRender() + + if dd_isKeyPressed( 32 ) + if spBunnyLife > 0 + dd_SPClearDirection( spShots[ nShotsActive ] ) + dd_SPSetDirection( spShots[nShotsActive] , 6 , 0 , (-15) ) + + x = dd_SPGetX( spBunny ) + y = dd_SPGetY( spBunny ) + + dd_SPSetXY( spShots[nShotsActive], x, y - 20 ) + dd_SPSetVisible( spShots[nShotsActive], .t. ) + nShotsActive += 1 + if nShotsActive > 10 + nShotsActive = 1 + end if + end if + end if + return + +//-------------------------------------------------------------// \ No newline at end of file