diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6aa97e73f0..5912c45468 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,34 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-10-21 11:21 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + - contrib/directx/media + - contrib/directx/samples + - contrib/directx/lib + - contrib/directx/directx.lib + - contrib/directx/readme.1st + + contrib/directx/readme.txt + + contrib/directx/test + + contrib/directx/test/testdx.prg + + contrib/directx/test/anima2.bmp + + contrib/directx/test/brick1.bmp + + contrib/directx/test/black.bmp + + contrib/directx/test/brick2.bmp + + contrib/directx/test/shot.bmp + + contrib/directx/test/brick3.bmp + - contrib/directx/buvcdx.bat + + contrib/directx/Makefile + + contrib/directx/makefile.bc + + contrib/directx/makefile.vc + + contrib/directx/make_b32.bat + + contrib/directx/make_vc.bat + * contrib/directx/w32_ddrw.h + * contrib/directx/w32_ddrw.cpp + + Added build scripts + ! Further fixes to make it compile and run. + * Rearranged test/readme files. + ; Now it runs but the sample .bmps seem to be corrupted. + 2007-10-21 11:01 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/directx/w32_ddrw.cpp ! Fixed two -w warnings left. diff --git a/harbour/contrib/directx/Makefile b/harbour/contrib/directx/Makefile new file mode 100644 index 0000000000..25d5d464a0 --- /dev/null +++ b/harbour/contrib/directx/Makefile @@ -0,0 +1,14 @@ +# +# $Id: Makefile 7833 2007-10-18 10:23:19Z vszakats $ +# + +ROOT = ../../ + +C_SOURCES=\ + w32_ddrw.cpp \ + +PRG_SOURCES=\ + +LIBNAME=hbwin32ddrw + +include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/directx/buvcdx.bat b/harbour/contrib/directx/buvcdx.bat deleted file mode 100644 index 93aa787970..0000000000 --- a/harbour/contrib/directx/buvcdx.bat +++ /dev/null @@ -1,2 +0,0 @@ -..\..\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/contrib/directx/directx.lib b/harbour/contrib/directx/directx.lib deleted file mode 100644 index 47bf2ec1d7..0000000000 Binary files a/harbour/contrib/directx/directx.lib and /dev/null differ diff --git a/harbour/contrib/directx/lib/vc/ddraw.lib b/harbour/contrib/directx/lib/vc/ddraw.lib deleted file mode 100644 index f6866a01be..0000000000 Binary files a/harbour/contrib/directx/lib/vc/ddraw.lib and /dev/null differ diff --git a/harbour/contrib/directx/make_b32.bat b/harbour/contrib/directx/make_b32.bat new file mode 100644 index 0000000000..ec4c5ae121 --- /dev/null +++ b/harbour/contrib/directx/make_b32.bat @@ -0,0 +1,32 @@ +@echo off +rem +rem $Id$ +rem + +if "%1" == "clean" goto CLEAN +if "%1" == "CLEAN" goto CLEAN + +:BUILD + + make -fmakefile.bc %1 %2 %3 > make_b32.log + if errorlevel 1 goto BUILD_ERR + +:BUILD_OK + + copy ..\..\lib\b32\hbwin32ddrw.lib ..\..\lib\*.* > nul + if exist ..\..\lib\b32\hbwin32ddrw.bak del ..\..\lib\b32\hbwin32ddrw.bak + goto EXIT + +:BUILD_ERR + + notepad make_b32.log + goto EXIT + +:CLEAN + if exist ..\..\lib\b32\hbwin32ddrw.lib del ..\..\lib\b32\hbwin32ddrw.lib + if exist ..\..\lib\b32\hbwin32ddrw.bak del ..\..\lib\b32\hbwin32ddrw.bak + if exist ..\..\obj\b32\w32_ddrw.obj del ..\..\obj\b32\w32_ddrw.obj + + goto EXIT + +:EXIT diff --git a/harbour/contrib/directx/make_vc.bat b/harbour/contrib/directx/make_vc.bat new file mode 100644 index 0000000000..a60d34143d --- /dev/null +++ b/harbour/contrib/directx/make_vc.bat @@ -0,0 +1,21 @@ +@echo off +rem +rem $Id$ +rem + +:BUILD + + nmake /f makefile.vc %1 %2 %3 > make_vc.log + if errorlevel 1 goto BUILD_ERR + +:BUILD_OK + + copy ..\..\lib\vc\hbwin32ddrw.lib ..\..\lib\*.* >nul + goto EXIT + +:BUILD_ERR + + notepad make_vc.log + +:EXIT + diff --git a/harbour/contrib/directx/makefile.bc b/harbour/contrib/directx/makefile.bc new file mode 100644 index 0000000000..bba3dfa9c8 --- /dev/null +++ b/harbour/contrib/directx/makefile.bc @@ -0,0 +1,98 @@ +# +# $Id$ +# + +# +# Makefile for Harbour Project for Borland C/C++ 3.x, 4.x, 5.x compilers +# + +# +# NOTE: You can use these envvars to configure the make process: +# (note that these are all optional) +# +# CFLAGS - Extra C compiler options for libraries and for +# executables +# C_USR - Extra C compiler options for libraries and for +# executables (GNU make compatible envvar) +# CLIBFLAGS - Extra C compiler options for the libraries +# HARBOURFLAGS - Extra Harbour compiler options +# PRG_USR - Extra Harbour compiler options +# (GNU make compatible envvar) +# + +# +# NOTE: "echo." intentionally used instead of "echo", to avoid conflicts +# with external commands named echo. +# + +CC = bcc32 +AS = tasm32 + +BIN_DIR = ..\..\bin\b32 +OBJ_DIR = ..\..\obj\b32 +LIB_DIR = ..\..\lib\b32 + +# This is needed, otherwise the libs may overflow when +# debug info is requested with -v -y +ARFLAGS = /P32 + +!if !$d(BCC_NOOPTIM) +CFLAGS = -O2 $(CFLAGS) +!endif + +# +# Directory macros. These should never have to change. +# + +INCLUDE_DIR = ..\..\include +TOOLS_DIR = . + +# +# C compiler definition and C flags. These should never have to change. +# + +CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS) +CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) +CLIBFLAGSDEBUG = -v $(CLIBFLAGS) +HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w2 -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS) +LDFLAGS = $(LDFLAGS) + +# +# Macros to access our library names +# + +TOOLS_LIB = $(LIB_DIR)\hbwin32ddrw.lib + +HARBOUR_EXE = $(BIN_DIR)\harbour.exe + +# +# Rules +# + +# +# TOOLS.LIB rules +# + +TOOLS_LIB_OBJS = \ + $(OBJ_DIR)\w32_ddrw.obj \ + +# +# Our default target +# + +all: \ + $(TOOLS_LIB) \ + +# +# Library dependencies and build rules +# + +$(TOOLS_LIB) : $(TOOLS_LIB_OBJS) + +# +# TOOLS.LIB dependencies +# + +$(OBJ_DIR)\w32_ddrw.obj : $(TOOLS_DIR)\w32_ddrw.cpp + $(CC) $(CLIBFLAGS) -o$@ $** + tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,, diff --git a/harbour/contrib/directx/makefile.vc b/harbour/contrib/directx/makefile.vc new file mode 100644 index 0000000000..0f351259f4 --- /dev/null +++ b/harbour/contrib/directx/makefile.vc @@ -0,0 +1,136 @@ +# +# $Id$ +# + +# +# Makefile for Harbour Project for Microsoft Visual C (32 bits) +# + +# +# NOTE: You can use these envvars to configure the make process: +# (note that these are all optional) +# +# CFLAGS - Extra C compiler options for libraries and for +# executables +# C_USR - Extra C compiler options for libraries and for +# executables (GNU make compatible envvar) +# CLIBFLAGS - Extra C compiler options for the libraries +# HARBOURFLAGS - Extra Harbour compiler options +# PRG_USR - Extra Harbour compiler options +# (GNU make compatible envvar) +# + +# +# Notes about this makefile: +# +# 1. To add new files to a dependancy list, add an obj name to one of the +# OBJ lists for the appropriate library. +# NOTE: put .prg related obj's last in the lib list. +# +# 2. This is a recursive script. If you change the name of this file, +# be sure to change MK_FILE (a few lines down) to the new name as well. +# +# 3. Recurrsion rules are quite simple: +# If you specifiy /a on the command line, files in the obj\vc dir +# will be deleted, and when nmake recurses, it's without the /a flag +# +# If a .prg.obj rule is fired, nmake will execute this script with +# a specific target as a parameter immediatley after compiling a given +# set of prg files. +# ie: Harbour $< +# nmake /fmakefile.vc obj\vc\rtl.lib2 +# which will simply get make to re-evaluate the dependancy list for the +# lib, and as a result, it will execute the C compiler using the .c.obj +# rule below to create the obj's for the prg's that were created just +# prior to the recurrsive call. Once the obj's are created, the +# recurrsion is complete. +# See additional notes under RTL.LIB below. +# + +MK_FILE = makefile.vc +MK_FLAGS = $(MAKEFLAGS: =) + +OBJ_DIR = ..\..\obj\vc +LIB_DIR = ..\..\lib\vc +BIN_DIR = ..\..\bin + +# +# Directory macros. These should never have to change. +# + +INCLUDE_DIR = ..\..\include +TOOLS_DIR = . + +# +# C compiler definition and C flags. These should never have to change. +# + +AS = masm +CFLAGS = -I$(INCLUDE_DIR) -TP -W3 -nologo $(C_USR) $(CFLAGS) +CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) +CLIBFLAGSDEBUG = -Zi $(CLIBFLAGS) +HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w2 -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS) +LDFLAGS = $(LDFLAGS) + +# +# Macros to access our library names +# + +TOOLS_LIB = $(LIB_DIR)\hbwin32ddrw.lib + +HARBOUR_EXE = $(BIN_DIR)\harbour.exe + +# +# Rules +# + +.SUFFIXES: .prg .lib .c .cpp .obj .asm + +# override builtin + +.c.obj:: + $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< + +# +# +# + +LIBLIST = \ + $(TOOLS_LIB) + +# +# TOOLS.LIB rules +# + +{$(TOOLS_DIR)}.c{$(OBJ_DIR)}.obj:: + $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< + +{$(TOOLS_DIR)}.prg{$(OBJ_DIR)}.obj:: + $(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< + $(MAKE) -nologo /$(MK_FLAGS) /f$(MK_FILE) $(TOOLS_LIB)2 + +TOOLS_LIB_OBJS = \ + $(OBJ_DIR)\w32_ddrw.obj \ + +# +# Our default target +# + + +all: \ + $(TOOLS_LIB) + +CLEAN: + -@if exist $(OBJ_DIR)\w32_ddrw.* del $(OBJ_DIR)\w32_ddrw.* + -@if exist $(TOOLS_LIB) del $(TOOLS_LIB) + +# +# Library dependencies and build rules +# + +$(TOOLS_LIB) : $(TOOLS_LIB_OBJS) + lib /out:$@ $** + +# dummy targets used for prg to c creation + +$(TOOLS_LIB)2 : $(TOOLS_LIB_OBJS) diff --git a/harbour/contrib/directx/readme.1st b/harbour/contrib/directx/readme.txt similarity index 100% rename from harbour/contrib/directx/readme.1st rename to harbour/contrib/directx/readme.txt diff --git a/harbour/contrib/directx/media/anima2.bmp b/harbour/contrib/directx/test/anima2.bmp similarity index 100% rename from harbour/contrib/directx/media/anima2.bmp rename to harbour/contrib/directx/test/anima2.bmp diff --git a/harbour/contrib/directx/media/black.bmp b/harbour/contrib/directx/test/black.bmp similarity index 100% rename from harbour/contrib/directx/media/black.bmp rename to harbour/contrib/directx/test/black.bmp diff --git a/harbour/contrib/directx/media/brick1.bmp b/harbour/contrib/directx/test/brick1.bmp similarity index 100% rename from harbour/contrib/directx/media/brick1.bmp rename to harbour/contrib/directx/test/brick1.bmp diff --git a/harbour/contrib/directx/media/brick2.bmp b/harbour/contrib/directx/test/brick2.bmp similarity index 100% rename from harbour/contrib/directx/media/brick2.bmp rename to harbour/contrib/directx/test/brick2.bmp diff --git a/harbour/contrib/directx/media/brick3.bmp b/harbour/contrib/directx/test/brick3.bmp similarity index 100% rename from harbour/contrib/directx/media/brick3.bmp rename to harbour/contrib/directx/test/brick3.bmp diff --git a/harbour/contrib/directx/media/shot.bmp b/harbour/contrib/directx/test/shot.bmp similarity index 100% rename from harbour/contrib/directx/media/shot.bmp rename to harbour/contrib/directx/test/shot.bmp diff --git a/harbour/contrib/directx/samples/testdx.prg b/harbour/contrib/directx/test/testdx.prg similarity index 100% rename from harbour/contrib/directx/samples/testdx.prg rename to harbour/contrib/directx/test/testdx.prg diff --git a/harbour/contrib/directx/w32_ddrw.cpp b/harbour/contrib/directx/w32_ddrw.cpp index 15432d95e7..ca258410c0 100644 --- a/harbour/contrib/directx/w32_ddrw.cpp +++ b/harbour/contrib/directx/w32_ddrw.cpp @@ -28,6 +28,8 @@ #define INITGUID #include "w32_ddrw.h" +HB_EXTERN_BEGIN + BOOL hb_dd_g_handling_events = FALSE; // painting? @@ -98,7 +100,7 @@ short int hb_dd_g_KeyDown[256]; - HB_FUNC( HB_DD_ISKEYPRESSED ) + HB_FUNC( DD_ISKEYPRESSED ) { if ( hb_dd_g_KeyDown[ hb_parnl( 1 ) ] ) hb_retl( 1 ); @@ -108,7 +110,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPGETXY ) + HB_FUNC( DD_SPGETXY ) { // This function is Broken ( hb_stornl fail ); @@ -121,40 +123,40 @@ hb_stornl( hb_dd_Sprites[ n ].y, -1, 1 ); } - HB_FUNC( HB_DD_SPGETX ) + HB_FUNC( DD_SPGETX ) { hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].x ); } - HB_FUNC( HB_DD_SPGETY ) + HB_FUNC( DD_SPGETY ) { hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].y ); } //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPGETVISIBLE ) + HB_FUNC( DD_SPGETVISIBLE ) { hb_retl( hb_dd_Sprites[ hb_parnl( 1 ) ].Visible ); } //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPSETVISIBLE ) + HB_FUNC( DD_SPSETVISIBLE ) { hb_dd_Sprites[ hb_parnl( 1 ) ].Visible = ( int ) hb_parl( 2 ); } //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPONRENDER ) + HB_FUNC( DD_SPONRENDER ) { hb_dd_Sprites[ hb_parnl( 1 ) ].OnRender = strdup( hb_parc(1) ); } //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPCLEARDIRECTION ) + HB_FUNC( DD_SPCLEARDIRECTION ) { long n = hb_parnl( 1 ); hb_dd_Sprites[ n ].xIncrement = 0; @@ -164,21 +166,21 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPSETSOLID ) + HB_FUNC( DD_SPSETSOLID ) { hb_dd_Sprites[hb_parnl( 1 ) ].Solid = hb_parl( 2 ); } //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPSETMASKED ) + HB_FUNC( DD_SPSETMASKED ) { hb_dd_Sprites[hb_parnl( 1 ) ].Masked = hb_parl( 2 ); } //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPSETDIRECTION ) + HB_FUNC( DD_SPSETDIRECTION ) { long n =hb_parnl( 1 ); @@ -189,7 +191,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPONFIRSTFRAME ) + HB_FUNC( DD_SPONFIRSTFRAME ) { long n =hb_parnl( 1 ); hb_dd_Sprites[ n ].OnFirstFrame = strdup( hb_parc(2) ); @@ -197,7 +199,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPONOUTSCREEN ) + HB_FUNC( DD_SPONOUTSCREEN ) { long n =hb_parnl( 1 ); hb_dd_Sprites[ n ].OnOutScreen = strdup( hb_parc(2) ); @@ -205,7 +207,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPONCOLLISION ) + HB_FUNC( DD_SPONCOLLISION ) { long n =hb_parnl( 1 ); hb_dd_Sprites[ n ].OnCollision = strdup( hb_parc(2) ); @@ -214,7 +216,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_CREATESPRITE ) + HB_FUNC( DD_CREATESPRITE ) { long n = hb_dd_g_SpritesCount; @@ -236,7 +238,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_SPSETXY ) + HB_FUNC( DD_SPSETXY ) { long n =hb_parnl( 1 ); long x =hb_parnl( 2 ); @@ -274,7 +276,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_MSGBOX ) + HB_FUNC( DD_MSGBOX ) { char *m1; char *m2; @@ -579,7 +581,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_CREATEWINDOW ) + HB_FUNC( DD_CREATEWINDOW ) { HWND m_hWnd; @@ -633,7 +635,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_LOADBMPINTOSURFACE ) + HB_FUNC( DD_LOADBMPINTOSURFACE ) { long nSurface = hb_parnl( 1 ); char * cBitmap = hb_parc ( 2 ); @@ -667,7 +669,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_CREATEOFFSCREENBITMAP ) + HB_FUNC( DD_CREATEOFFSCREENBITMAP ) { DDSURFACEDESC2 ddsd; HRESULT hRet; @@ -807,7 +809,7 @@ //------------------------------------------------------------------// - HB_FUNC( HB_DD_STARTWINDOW ) + HB_FUNC( DD_STARTWINDOW ) { MSG msg; BOOL loop = TRUE; @@ -893,4 +895,6 @@ long hb_dd_checkError( HRESULT hr ) void hb_dd_g_Error( char *, long , char *) { -} \ No newline at end of file +} + +HB_EXTERN_END diff --git a/harbour/contrib/directx/w32_ddrw.h b/harbour/contrib/directx/w32_ddrw.h index 05de8bac8d..ddebc29887 100644 --- a/harbour/contrib/directx/w32_ddrw.h +++ b/harbour/contrib/directx/w32_ddrw.h @@ -45,6 +45,8 @@ #include "ddraw.h" +HB_EXTERN_BEGIN + // Main Message Loop @@ -73,3 +75,4 @@ extern "C" DWORD hb_dd_DDColorMatch ( IDirectDrawSurface4 * pdds, COLORREF rgb void DD_MsgBox ( void ); void WinError ( void ); +HB_EXTERN_END