Hullo all. Smiley
I've created a
very simple plugin for Dark Basic Professional to help out with timer based movements. It's not advanced at all. It's just intended to be used by those people who don't want to setup a timer based movement system for every project they create - hence I made it (mainly for myself).
Here's the readme file.
Quote: "Timing Plugin v1.0
-------------------------------------------------
This is a simple plugin to help control
timing in Dark Basic Pro. This allows you to
more easily implement timer based movement which
allows for quicker development times.
I made this to help me out because I was
making a bunch of really small projects to test
out some other plugins. Each one would spin an
object around in a timer based fashion to ensure
the demo runs just as smoothly across all
computers.
Commands
-------------------------------------------------
setTimerDivisor divisor#
Sets the divisor for the returned time. The
default value is 30.0.
divisor# = getTimerDivisor()
Gets the divisor set by setTimerDivisor.
updateTimer
Updates the timer. This updates the return
value in getTimer(). Call by SYNC.
getTimer
Retrieve's the scalar timer value. The return
value can be multiplied by a 1.0 based
scalar value to keep proportionally based
timing. For example, if you want an object to
move twice as fast as normal, then multiply
this value by 2.0. If you want it to move half
as fast, multiply this value by 0.5.
Installation
-------------------------------------------------
Copy the file "Timing.dll" to the
Compilerplugins-user directory in the main DBPro
installation directory. Copy the file "timer.ini"
to the Editorkeywords directory in the main
DBPro installation directory. Restart your IDE &
it'll be ready to be used."
It can be downloaded
from my forums, here.
Hopefully some of the newcomers and demo writers will find this useful.
Also, here's some example code as to how to use it:
sync on
sync
cls
print "Loading"
sync
make object cube 1, 100
setTimerDivisor 30.0
updateTimer
do
turn object left 1, getTimer() * 1.0
updateTimer
text 1, 1, "FPS: " + str$(screen fps())
text 1, 21, "Timer Divisor: " + str$(getTimerDivisor())
sync
loop
Cheers,
-naota
I used to do a lot of time traveling when I was younger. I called it tequila. I would drink this potion and wake up 3 days in the future! 'Where am I trusty dumpster? Get me home!' - Craig Ferguson