Posted by Peter on March 29, 2006
I have been playing around with graphics in Dr. Scheme again. You can download my latest experiment from Sourceforge (and run it with the command
(main go-for-a-drive)). In this demo you can fly a small spaceship with the a, d, and w keys and quit with q. Unfortunately because I needed to be able to detect multiple keys being held down at once I was forced to modify the graphics library slightly. Simply overwrite the two files in the PLT\collects\graphics directory with the ones provided in the release. Then delete the compiled directory and recompile with the new versions by running the Setup PLT utility in the root PLT folder.
Unfortunately there are still some problems with the graphics library that I can’t simply fix with edits. One is that I want the program to finish automatically when the window is closed (at the moment you have to exit from within the program or manually use the break command, closing the window has no effect). The other problem is flicker when drawing. What I really want to do is draw to a back-buffer and then flip it in all at once.
Thus I am going to attempt to write my own graphics routines using DirectX (obviously for windows only). Although I know how to code in C/C++ and use DirectX already I worry that actually writing the interface between the C code and Scheme will be taxing at best. The problem is that they encourage you to use their own compiler interface, which aids in linking with the Scheme libraries, ect. Unfortunately I may need to compile without their interface, since I will also need to link to the DirectX libraries. If anyone could point me to a better tutorial than the documentation found on the PLT/Dr. Scheme website it would be much appreciated.