aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UMain.pas
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-11 08:11:47 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-11 08:11:47 +0000
commitd123263213fba448d5695df35660f7de4cbed433 (patch)
treeef0bb01727be4b38a44a84ef6bef8224ee38d9b2 /Game/Code/Classes/UMain.pas
parent48676faa6c0da1eb77999512322896840ea13cb1 (diff)
downloadusdx-d123263213fba448d5695df35660f7de4cbed433.tar.gz
usdx-d123263213fba448d5695df35660f7de4cbed433.tar.xz
usdx-d123263213fba448d5695df35660f7de4cbed433.zip
modified UTime to utilise SDL timer...
this allows for reliable cross platform timers. Tested working on linux. Modified UVideo and screens to get Video playback working on linux currently only video stream... no audio.. but I Will be working towards this, for all audio playback ( at least for linux ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@501 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UMain.pas16
1 files changed, 15 insertions, 1 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index aa4bc639..41676bf3 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -139,7 +139,11 @@ procedure MainLoop;
var
Delay: integer;
begin
+ Delay := 0;
SDL_EnableKeyRepeat(125, 125);
+
+
+ CountSkipTime(); // JB - for some reason this seems to be needed when we use the SDL Timer functions.
While not Done do
Begin
// joypad
@@ -158,16 +162,26 @@ begin
// delay
CountMidTime;
+
+ {$IFDEF DebugDisplay}
+ Writeln( 'TimeMid : '+ inttostr(trunc(TimeMid)) );
+ {$ENDIF}
+
// if 1000*TimeMid > 100 then beep;
Delay := Floor(1000 / 100 - 1000 * TimeMid);
+ {$IFDEF DebugDisplay}
+ Writeln( 'Delay ms : '+ inttostr(Delay) );
+ {$ENDIF}
+
if Delay >= 1 then
SDL_Delay(Delay); // dynamic, maximum is 100 fps
CountSkipTime;
// reinitialization of graphics
- if Restart then begin
+ if Restart then
+ begin
Reinitialize3D;
Restart := false;
end;