[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Flushing af stdin



On Fri, 2 Jun 2000 10:03:21 +0200 (CEST), Mads Bondo Dydensborg wrote:
>On Fri, 2 Jun 2000, Frank Damgaard wrote:
>
>> Ja, hvis man skal have tiden på dagen. 
>
>Det skulle man - pointen er netop at du i et spil vil have det tætteste du
>kan få på den tid der rent faktisk er gået. 
>
>> Men ok, er det busy-waiting-løkker vi skal have, så er det vel ok :)
>> 
>> At bruge select() kræver at man tænker lidt anderledes , men den
>> er vel mere generel. Fra manual siden select(2) :
>> 
>>        timeout  is  an  upper bound on the amount of time elapsed
>>        before select returns. It may be zero, causing  select  to
>>        return  immediately.  If  timeout  is  NULL  (no timeout),
>>        select can block indefinitely.
>> 
>> 
>> dvs:
>> 
>>    time = 0  returner omgående
>>    time > 0  returner senest efter "time"
>>    time= NULL vent til der er input i file descriptor listen.
>
>Alle disse er underlagt almindelige regler om process skift. Da Linux ikke
>er et realtidssystem har du ingen garantier på den tid du snakker om. Med
>gettimeofday kan du selv se hvor lang tid der er gået, og så få din
>simulations-/spiltid til at forløbe så naturligt som muligt.

Men i et tetris / slå-din-modstander-ned / platform-spil er du vel sådan set
ligeglad med hvor lang tid, der i virkeligheden er gået.
Lige meget hvad du gør, kan du aldrig garantere at du får lov at køre
dit main-loop igennem 10 gange pr. sek.
Hvis du så vil tælle den faktiske spilletid kan du lave det separat.
Altså noget ala:

>
>Mads
>
>-- 
>Mads Bondo Dydensborg.                               sslug@sslug
>You know you're a Linux geek when...
>
>    You feel the desire to master vi.
>
>                                                - segfault
>


-- 
	Peter Seidler


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *