For Programmers: Free Programming Magazines  


Home > Archive > Tcl > February 2005 > TclGame Extension









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author TclGame Extension
Googie

2005-02-21, 9:00 pm

Hi there, folks!

As we can see on PyGame example - scripting languages can handle games
developing issue and they can handle it very nice!

Tcl already hasn't got any advanced extension for that job. I've just
started maintaning one, called - guess :) - TclGame. It's early
development version (I call it 0.0.1 for now), but quiet usable
already. It's set of SDL, SDL_image and SDL_mixer bindings for Tcl,
made using SWIG (currently only Linux tested).

You can find tar.gz package at:
http://scripts.one.pl/tclgame/tclgame.tar.gz
There is no homepage yet.

Requirements:
- Tcl :) (and Tk for tests)
- SDL
- SDL_image
- SDL_mixer
- Optionaly SWIG wrapper, if you want to wrap interface files by
yourself (if currently wrapped source ain't compile for you).

QUICK WAY:
----------

tar xzf tclgame.tar.gz
cd tclgame
../compile.sh
../test.sh

You should see Tk window. Go ahead, test it :)
You can use extension by loading file tclgame.so, which is placed in
lib/ subdirectory.

IF YOU WANT TO KNOW MORE:
-------------------------

Package contains 4 subdirectories:
lib/ <- here will be placed compiled extension.
swig/ <- here are SWIG interface files
tests/ <- here is test.tcl script for tests (see below)
wrapped/ <- here is already wrapped SWIG interface to C source code

There are also two important files in main directory:
compile.sh
and
test.sh
The first one compiles extension from wrapped C source, to binary
extension, loadable by Tcl. The second one runs test, if your
extension work fine (it's kind of poor demo).

There is no autoconf (configure script) required, neither automake
(Makefile), becoude there is only one C source file and SDL gives us
sdl-config, so compiling is easy.

DOCUMENTATION:
--------------

Firstly, take a look at tests/test.tcl.
Secondly, you can use almost any function from SDL, SDL_mixer and
SDL_image API: http://sdldoc.csn.ul.ie/ ,
http://jcatki.no-ip.org/SDL_mixer/ ,
http://jcatki.no-ip.org/SDL_image/ .

Currently no callback functions are supported, no OpenGL functions, no
'returning value via argument pointer', but I'm working at them.

EPILOGUE:
---------

It would be nice to read your feeling about it - how does it work? Is
it needed for Tcl, how 're you thinkin?
Any hints, any suggestions, any infos are welcome :)

--
Pozdrawiam (Greetings)!
Googie
Googie

2005-02-21, 9:00 pm

Oh, I forgot...

For people who had touched SDL (or used it more recently), there is no
requirement for creating SDL_Rect structure in Tcl. TclGame interface
allows to use simply:

SDL_BlitSurface $sourceSurface "0 0 15 20" $screen ""

which is equivalent to:

SDL_Rect srcRect = {0, 0, 15, 20};
SDL_BlitSurface(sourceSurface, &srcRect, screen, NULL);

in C. The same for SDL_Color. We can use (well known from Tk) format
#RRGGBB, or #RRGGBBAA for Alpha-Colors:

SDL_FillRect $screen "100 100 30 30" #0000FF

which will fill 30x30 sized rectangle (at x,y = 100,100) with blue
color.

All done with SWIG typemaps. Plans are to make TclGame familiar with
Tcl syntax as much as I can.



And the second thing I forgot:
Plans (yet another) are to include separate paragui.so, a ParaGUI
bindings for Tcl (which I already made on my box), SGE bindings for
Tcl and meaby other libraries (as separate *.so) into TclGame Package.
It's going to be complete set of bindings to many libraries which
would give a real power to make games for Tcl developer. Of course,
compiled will be only these library bindings, which libraries are
installed on system (autoconf will be used for detecting).

--
Pozdrawiam (Greetings)!
Googie
Mac A. Cody

2005-02-21, 9:00 pm

Googie wrote:
> Hi there, folks!
>
> As we can see on PyGame example - scripting languages can handle games
> developing issue and they can handle it very nice!
>
> Tcl already hasn't got any advanced extension for that job. I've just
> started maintaning one, called - guess :) - TclGame. It's early
> development version (I call it 0.0.1 for now), but quiet usable
> already. It's set of SDL, SDL_image and SDL_mixer bindings for Tcl,
> made using SWIG (currently only Linux tested).
>


Another possibility is using the Nebula Device 3D game engine (at
http://nebuladevice.cubik.org/ ), which has a scriptable interface
through Tcl/Tk.

Regards,

Mac

Googie

2005-02-22, 4:00 am

Mac A. Cody wrote:

> Another possibility is using the Nebula Device 3D game engine (at
> http://nebuladevice.cubik.org/ ), which has a scriptable interface
> through Tcl/Tk.


Where have you read about Tcl/Tk interface? I can't see it.

--
Pozdrawiam (Greetings)!
Googie
Andreas Kupries

2005-02-22, 4:00 am

Googie <googie@no.spam.org> writes:

> Mac A. Cody wrote:


[color=darkred]
> Where have you read about Tcl/Tk interface? I can't see it.


http://nebuladevice.cubik.org/

Section 'what is the nebula device'

--
So long,
Andreas Kupries <akupries@shaw.ca>
<http://www.purl.org/NET/akupries/>
Developer @ <http://www.activestate.com/>
-------------------------------------------------------------------------------
}
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com