SDL Wrappers for Euphoria
1st
version notes
July 1,
2002
Mark K.
Akita - mkakita@earthlink.net
Greetings!
This is the first version of my SDL wrappers for the Euphoria programming language. Before we delve into details some definitions are in order. SDL is short for Simple Directmedia Layer, a library for programming games and multimedia applications that includes functions for graphics, sounds, controllers (joystick/mouse/keyboard) and CD audio. The SDL wrapper file makes the SDL library functions accessible form Euphoria. SDL was written by Sam Lantinga and is distributed under the GNU Lesser Public License.
The official SDL website http://www.libsdl.org contains more information both general and specific.
What you need to get started…
The following files are included with this SDL wrapper
package:
README.TXT – this file in plain text form
README.HTML – this file in HTML form
SDL.DLL – The actual SDL dynamic link library
SDL_WRAP.EW – The Euphoria wrapper include file
SDLDEX01.EXW – Demo program 1: makes kaleidoscopic pictures
SDLDEX02.EXW – Demo program 2: Galton box simulation
SDLDEX03.EXW – Demo program 3: the swirling arcs
SDLDEX04.EXW – Demo program 4: Change the cursor to a smiley
SDLDEX05.EXW – Demo program 5: Scrolling map demo
SDLDEX06.EXW – Demo program 6: Controller input demo
BITMAPS – a folder containing the images used by the demo
programs
The demo programs are quick examples of how to use the SDL
library. You can quit any of the Demos
by pressing the Escape [Esc] key. You
can also press either mouse button to quit in every demo except SDLEX04. In SDLEX04 pressing the mouse buttons will
cause the smiley to blink. In SDLEX05
you can use the arrow keys to scroll the map.
In SDLEX06 use the arrow keys to move the “Keys” object and the mouse or
joystick (if attached) to move the others.
Feel free to use the SDL_WRAP file in your own
projects. If you write a game or
application program that includes the SDL_WRAP.EW file, make sure to credit me
(Mark K. Akita) somewhere in the help, docs or “about” screen.
Writing your own SDL programs in Euphoria…
You’ll need a moderate amount of Euphoria programming
knowledge to use the SDL library in your own programs. You can get a copy of the complete SDL
documentation from http://sdldoc.csn.ul.ie/pub/
in PDF or HTML form. The SDL docs
contain descriptions of all the functions and examples in C. You can also study the SDLDEX01-06 demo
programs for specific examples of how to call the various SDL functions from
Euphoria. The demos don’t use every
available SDL function but should provide a basic framework for creating programs. SDL programs written in Euphoria are for the
Win32 OS rather than DOS and should have an EXW extension. All of the SDL functions called through
SDL_WRAP use a standard Euphoria function call rather than a C_PROC or C_FUNC
call. Euphoria PEEK and POKE functions
are used to simulate C structures.
Nearly all of the SDL functions included in the wrapper are
working. The notable exceptions are
functions that require callbacks. While
C handles passing callback addresses effortlessly I was unable to get Euphoria
to properly send a callback address.
The main functions affected by the callback problem are:
SDL_OpenAudio
SDL_CreateThread
SDL_AddTimer
Maybe some wise Euphoria guru will know how to get around
the callback problem and will upload a patch for the wrappers.
What else?
Currently I have 3 other SDL/Euphoria projects in various
stages of completion:
The Euphoria wrapper file for the SDL_MIXER library, which
adds MIDI/MOD music and multiple channels of audio sample playback to SDL, will
be finished soon.
A series of examples showing how to use Open GL with SDL is
also in the works. Right now I have a
few of the demos converted from C and I’m working on the others.
I’ve also started work on a game program that uses SDL and
SDL_MIXER.
That’s All Folks!
Send comments & feedback to mkakita@earthlink.net