GDC 2006 2D Physics Demo for D
clayasaurus
clayasaurus at gmail.com
Mon Oct 30 18:52:03 PST 2006
Jarrett Billingsley wrote:
> "clayasaurus" <clayasaurus at gmail.com> wrote in message
> news:ei67hf$2dgi$1 at digitaldaemon.com...
>> After quite a conversion process, I've successfully converted the c++ GDC
>> 2006 2D Physics demo to D.
>>
>> Original:
>> http://www.gphysics.com/archives/18
>>
>> D Version:
>> http://www.dsource.org/projects/arcgames/browser/trunk/physics/demo.zip?format=raw
>>
>> Use keys 1-9 to switch through demo, and space bar to launch the 'bomb'.
>>
>> It also comes with a public domain red black tree implementation that
>> seems to work. The author of
>> http://eternallyconfuzzled.com/tuts/redblack.html told me he is going to
>> add a license page that says all the code on his pages are in public
>> domain.
>>
>> Special thanks to Christian Kamm for helping me track done a bug.
>>
>> ~ Clay
>
> Sweet, but it runs at about 3000 FPS, and so is nearly impossible to see
> anything running except the pyramid demo. I see some kind of delta timing
> with the "dt" global in main.d, but it's set to a constant 1/60, and in
> windowed mode on Windows, it'll try to update the screen as fast as
> possible, so the frame time will be something other than 1/60 of a second.
>
> Is there maybe a way to force it to run in fullscreen, so it's limited to
> the refresh rate? I'd recompile it but I don't have Derelict, so..
>
Derelict comes with the demo.zip package along with SDL.dll. If you have
the D compiler and build, all you need to do is 'build main.d -Rn -full
-release -O' to build it.
Throw in an SDL_Delay(40) in the main while loop if you want a quick
solution, or add a 'flags = SDL_OPENGL | SDL_FULLSCREEN' to the SDL
video flags for fullscreen in main.d around line 668.
Within the next year or so I'm going to integrate this into my 2D game
library ( http://arcgames.dsource.org/arc/arc/time.html ) which has a
delay timer that will delay the main loop as needed to keep a constant
frame rate.
I need to figure out how to add circle shapes and eventually polygon
shapes, however the author says at GDC 2007 he'll put more shapes in his
demo. There is also a java port that supports circle and line shapes
http://code.google.com/p/phys2d/
More information about the Digitalmars-d-announce
mailing list