Created Frequently asked Questions Common Questions (markdown)

master
Jeffery Myers 3 anni fa
parent
commit
e3df9a6548
1 ha cambiato i file con 28 aggiunte e 0 eliminazioni
  1. +28
    -0
      Frequently-asked-Questions--Common-Questions.md

+ 28
- 0
Frequently-asked-Questions--Common-Questions.md

@ -0,0 +1,28 @@
This page will go over some of the common questions new users have when starting out using raylib.
* How do I make a timer?
Raylib has no built in timer system. You are expected to keep track of time in your own code. You can do with with the GetTime and GetFrameTime functions. Below is an example of a simple timer struct and functions to use it.
```
typedef struct
{
double StartTime;
double Lifetime;
}Timer;
void StartTimer(Timer* timer, double lifetime)
{
timer->StartTime = GetTime();
timer->Lifetime = lifetime;
}
bool TimerDone(Timer timer)
{
return GetTime() - timer.StartTime >= timer.Lifetime;
}
double GetElapsed(Timer timer)
{
return GetTime() - timer.StartTime;
}
```

Caricamento…
Annulla
Salva