MWin.txt	(c) Mike Bibby  26 October 1998  m_bibby@hotmail.com

The zipped package consists of these files for MASM:

	MWin.txt		.....		This file.
	MWin.asm       	.....       A MASM 611 assembler file
	MWinwin.inc	 	.....       A small Windows inc file for MASM
	Mddraw.inc     	.....       An alpha DirectDraw inc file for MASM
	GUID.inc		.....		Defines the GUIDs DDraw needs
	Images.bmp		.....		The set of sprites
	DoTWin.bat     	.....		A simple batch file for MASM. Note how the
								LINK, windows and ddraw libraries' addresses 
								are hardwired in. You may well want to change these.


Feel free to use or distribute the package, part or whole, for any 
non-commercial use, preferably crediting me.

Also feel free to contact me at the above address if you've any problems.

The assembled exe reads in a set of 32,  64 x 64 sprites from a bmp file (which 
needs to be in the same directory). It then displays these in sequence
in a 128 x 128 window, to give an "animated" effect.

It is merely a demonstration program, and whilst it should work on most sensible 
desktops, etc., it is merely a toy and makes no pretence at being optimised, 
efficient, highly practical or clever.

For instance, it isn't too fussy about the Primary surface type, doesn't try to restore 
lost surfaces, just blits unhesitatingly onto the surface, etc., etc....

But it will get you up and running, showing how to create DirectDraw objects, how to
call their methods, and how to perform a primitive animation in a window...

Also there are two full ddraw include files: Tddraw.inc and Mddraw.inc respectively.
These are still in alpha test stage as are also a couple of macros that let you call
 the methods without too much pushing, and so on. 

	!!! Please let me know if you find anything missing !!!

Also note that both include files have:
	DIRECTDRAW_VERSION = 0500h
at the top, since I'm using version five...

#########################################
 Notes on the Clipper											
#########################################
When windows overlap, you have to make sure that you don't overwrite
part of a top window, say, by writing to a window underneath.

We're writing in a window here, so we create a clipper and associate it
with the window. The idea of the clipper is to act as a kind of filter,
filering out any part of a blit that would write to a part of the window
that's not visible. In this demo we're blitting onto the primary
surface, so we link our clipper to that, too. Then when we blit to the
primary surface, the clipper filters out anything that wouldn't be
visible in our window.


#########################################
GUIDS
#########################################
TWinwin1.inc and MWinwin1.inc are minimal Windows include files for TASM
and MASM repectively that are enough for this demo. Inside these there's
a GUID defined as:

;--------------------------
_GUID struct
	Data1	DWORD 0
	Data2	WORD  0
	Data3	WORD  0
	Data4	BYTE  0
			BYTE  0
			BYTE  0
			BYTE  0
			BYTE  0
			BYTE  0
			BYTE  0
			BYTE  0
_GUID ends

GUID typedef  _GUID
;------------------------------

which takes the GUIDs I've included in GUID.inc. 

You don't actually need all those, and I've put a "semi-coloned out" way
of just using:

	IID_IDirectDraw2 GUID <0B3a6f3e0h,02b43h,011cfh, 				\
							0a2h,0deh,000h,0aah,000h,0b9h,033h,056h>

as data.

Alternatively, you could omit a structure definition and define IID_IDirectDraw2 
directly, as in:
IID_IDirectDraw2 DD 0b3a6f3e0H
	DW	02b43H
	DW	011cfH
	DB	0a2H
	DB	0deH
	DB	00H
	DB	0aaH
	DB	00H
	DB	0b9H
	DB	033H
	DB	056H

#########################################
DDERRs
#########################################
In the ddraw.h header with the SDK you'll find lots of DDERRs defined
with a macro MAKE_DDHRESULT( 380 ). I've given these values directly.
If you want to determine just the ones you want at runtime, here's a
macro:

MAKEDD_HRESULT MACRO code
	push ebx
	mov eax,1
	shl eax,31
	mov ebx,876h
	shl ebx,16
	or eax,ebx
	mov ebx,code
	or eax, ebx
	pop ebx
ENDM
