Crystal Space
Welcome, Guest. Please login or register.
November 24, 2014, 09:26:59 am

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2046 Topics by 9101 Members
Latest Member: Adamgit
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Virtual Clock problem
« previous next »
Pages: [1] Print
Author Topic: Virtual Clock problem  (Read 1749 times)
zaneiel
Newbie
*
Posts: 5


View Profile Email
« on: May 26, 2006, 08:40:51 am »

its late and all so i may be missing the obviouse but anyone know why this code dosen't seem to produce my desired result?

Quote
if (kbd->GetKeyState (CSKEY_F1))
   {      
      //printf("ElapsedTicks - %d",vc->GetCurrentTicks());
      if((vc->GetCurrentTicks() - Last_Key) >= 11000.0) // <-- tried all kinds of different numbers here
            {
               Last_Key = vc->GetElapsedTicks();
               RENDER_GUI ? RENDER_GUI = false : RENDER_GUI = true;
            }
      
   }
Last_Key is of type int tried with long and float but dosen't seem to do anything -- maybe i am using vc incorrectly?
also:
Last_Key = vc->GetCurrentTicks() ;
is assigned in the constructor as is RENDER_GUI = false;

thanks in advance Tongue peace
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: May 26, 2006, 08:41:21 pm »

its late and all so i may be missing the obviouse but anyone know why this code dosen't seem to produce my desired result?

Quote
if (kbd->GetKeyState (CSKEY_F1))
   {      
      //printf("ElapsedTicks - %d",vc->GetCurrentTicks());
      if((vc->GetCurrentTicks() - Last_Key) >= 11000.0) // <-- tried all kinds of different numbers here
            {
               Last_Key = vc->GetElapsedTicks();
               RENDER_GUI ? RENDER_GUI = false : RENDER_GUI = true;
            }
      
   }
Last_Key is of type int tried with long and float but dosen't seem to do anything -- maybe i am using vc incorrectly?
also:
Last_Key = vc->GetCurrentTicks() ;
is assigned in the constructor as is RENDER_GUI = false;

thanks in advance Tongue peace

You are comparing GetCurrentTicks() with GetElapsedTicks(). That doesn't make much sense. You should use GetCurrentTicks() instead of GetElapsedTicks() inside the loop.

Greetings,
Logged
zaneiel
Newbie
*
Posts: 5


View Profile Email
« Reply #2 on: May 27, 2006, 07:35:24 am »

hrmm that would do it, i'll change and see .. however i have made so many changes to it that this version may just be a typo .. will let you know Tongue thanks

sometimes just need another set of eyes at 3am lol

*EDIT*
Yup that was it, DUH i feel like a tard thanks Jorrit Smiley
« Last Edit: May 27, 2006, 07:42:56 am by zaneiel » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.204 seconds with 15 queries.