	                          
	       @@@@@@   @@                             @@@@@@@
	       @@@@@@@  @@                       @@   @@@@@@@@
	       @@@  @@       @@                 @@     @@    @
	       @@@  @@ @@@ @@@@@@   @@@    @@@ @@@@@   @@  @
	       @@   @@ @@@ @@@@@@@ @@ @@  @@@@@ @@    @@@@@@
	       @@   @@ @@@  @@    @@@@@@ @@@   @@@    @@@@@@
	      @@@  @@  @@@ @@@    @@@@   @@    @@@    @@   @ 
	      @@@  @@  @@  @@@    @@   @ @@  @ @@@  @ @@     @
	     @@@@@@@  @@@@ @@@    @@@@@@ @@@@@ @@@@@  @@@@@@@
	     @@@@@@    @@@ @@      @@@    @@@   @@   @@@@@@@

	     ======== DirectE : DirectX for Euphoria ========= 
		  	      
		  	      Version 080709	      
			         Mic, 2008	      	




Files:
------

[Libraries]
* directe.ew............DirectE include file.
* directe.dll...........DirectE library.

[Media]
* atmos.jpg.............Texture file.
* wood.jpg..............Another texture.
* kungfu.avi............Grandmaster of the hampster clan.
* mmx3intro.mid.........MIDI song composed by Dave Phaneuf.

[Examples]
* simple.exw............Shows how to set up a DirectE application.
* rotate.exw............Shows how to perform transformations.			     
* lines.exw.............Shows how to draw lines.
* draw_text.exw.........Shows how to draw text using TrueType fonts.
* cube.exw..............Shows how to set up a display, do backface culling, etc.
* texture.exw...........Shows how to put a texture on an object.
* lighting.exw..........Shows how to use lightsources and materials.
* pixel_shader_test.....Shows how to use a pixel shader.
* play_midi.exw.........Shows how to play an audio file using DirectShow.
* play_video.exw........Shows how to play a video file using DirectShow.
* mouse.exw.............Shows how to use the mouse callbacks.
* tunnel.exw............Another texture mapping example.



What's new?
-----------

[080709]
* Added deBlendFunc (see blending.exw).

* Added deFogf and deFogf.

* Added dePointParamf, dePointParamfv and dePointSize (see point_sprites.exw).

* Added dePolygonMode and deShadeModel.

* Added deCompileShader, deCompileShaderFromFile, deGetShaderParamByName,
  deSetShaderParamf and deSetShaderParami (see hlsl_test.exw).


[080322]
* Updated the library to use DirectX9.

* Added deGetDevice, deAssembleShader, deAssembleShaderFromFile,  deCreateShader,
  deDestroyShader, deSetPixelShader and deSetVertexShader.

* Added another example program.


[030215]
* Fixed dePushMatrix and dePopMatrix (they weren't working correctly).

* Fixed a bug in deTexParameter.

* Added dlCoordSystem for toggling between left- and right-handed coordinate systems. You'll
  have to call deLookAt and dePerspective again after changing the coordinate system, if you
  use them.

* Added deLockSurface and deUnlockSurface.

* Added another parameter to deInitDisplayMode: integer vsync, which specifies whether to
  sync video to the vertical retrace or not. Use the constants DE_VSYNC and DE_NO_VSYNC.

* Added dePostRedisplay

* Added deMouseFunc, deMotionFunc and dePassiveMotionFunc (see mouse.exw).


[030208]
* Changed some initialization code. By mistake, it was trying to create a backbuffer
  the size of the screen, and not the size of the window (oops). Also, it now chooses
  hardware vertex processing if available.

* DECOLOR_XRGB() now sets alpha to 255 instead of 0.

* Added deClearColor, deClearDepth and deClear (similar to glClearColor,
  glClearDepth and glClear in OpenGL).

* Added deCreateFont, deDrawText and deDestroyFont (see draw_text.exw).

* Added deLightf, deLightfv and deLighti for dealing with lightsources.

* Added deMaterialfv for dealing with materials.

* Added deLoadMedia, dePlayMedia, dePauseMedia, deStopMedia, deUnloadMedia,
  deResizeMedia, deGetMediaPosition, deGetMediaDuration, deGetMediaDimensions,
  deSetMediaPosition and deMediaEventFunc for dealing with media playback (through
  DirectShow).



What is this?
-------------

DirectE is a DirectX wrapper for Euphoria (version 2.1 or above). DirectX version
9.0 or above is required. 



Usage:
------

So far, only parts of Direct3D and DirectShow have been wrapped. I have designed
DirectE to be similar to my OpenGL wrapper (EuGL), so there are some OpenGL-ish
names in the API. Basically, what you have to do to get a program up and running is
to write a number of event handlers and then call deMain(). Something like this:

procedure display()
	-- do something ...
end procedure

procedure init()
	-- do something ...
end procedure

procedure key(integer keycode,integer x,integer y)
	-- do something ...
end procedure


deInitDisplayMode(640, 480, 32, DE_WINDOWED)
deInitWindowTitle("Hello world")

deDisplayFunc(routine_id("display"))
deInitFunc(routine_id("init"))
deKeyboardFunc(routine_id("key"))

deEnable(DE_LOG)	-- Enable logging. Logs are written to de_log.txt
deMain(DE_HANDLE_EVENTS)


To put the window in fullscreen mode you can pass DE_FULLSCREEN instead of DE_WINDOWED
as the last argument to deMain().
As you may have noticed, the syntax is very similar to GLUT. These are the callbacks
that are supported in this version of DirectE:

deDisplayFunc()
deExitFunc()
deInitFunc()
deKeyboardFunc()
deMediaEventFunc()
deMotionFunc()
deMouseFunc()
dePassiveMotionFunc()
deReshapeFunc()
deTimerFunc()
deVisibilityFunc()

All of them take the same kind of parameters as their GLUT counterparts (except they
take routine_id:s instead of function pointers). If you haven't used GLUT, just look
up eg. glutKeyboardFunc on google. There are a few callbacks that are specific to
DirectE: The InitFunc will be called right after ShowWindow() has been called.
The ExitFunc() will be called after the event loop has finished, but before the main
window has been destroyed. The MediaEventFunc is for dealing with media events, eg. when
playing back video. See play_video.exw and play_midi.exw for examples of its use.
This version of DirectE only supports one TimerFunc, but support for multiple timers
might be added in the future.

If you use dePushMatrix() you might want to keep in mind that the maximum stack depth
is seven (per matrix mode). This means that you can only push seven matrices on the
stack (while staying in the same matrix mode) before you have to pop one or more of
them.

That's all the info for now. The example programs are reasonably well-commented, so
you can always take a look at them. If you have delt with Direct3D before you'll
probably understand what's going on, and if you haven't; now is a good time to learn!



Issues
------

"- None of the examples run/display correctly on my computer"

Well that's a shame..  No, seriously, make sure you have at least DirectX version 9.0
and the latest set of drivers for your graphics card. Other than that, I can't think
of any reason why the programs won't run. If you call deEnable(DE_LOG) before deMain()
you'll get a log file that may or may not contain useful info about what went wrong.


"- Program x won't run in fullscreen"

Maybe the resolution/bitcount you chose isn't supported by your device (i.e. your
graphics card). Try a standard mode like 640x480x16 and see if that works.


"- The play_video examples crashes/doesn't work on my computer"

The sample video was encoded with DivX (5.0.3) You could try getting a new DirectShow
filter for DivX, e.g. FFDShow.


	

/Mic, 2008

micol972@gmail.com
http://jiggawatt.org/badc0de/

