Added Jesus's DirectX dir

This commit is contained in:
Patrick Mast
1999-07-28 17:27:35 +00:00
parent 369c355ccf
commit a6f586b573
11 changed files with 256 additions and 0 deletions

View File

@@ -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

BIN
harbour/directx/directx.lib Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 B

View File

@@ -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

View File

@@ -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
//-------------------------------------------------------------//