Created Frequently asked Questions Common Questions (markdown)

master
Jeffery Myers 3 lat temu
rodzic
commit
e3df9a6548
1 zmienionych plików z 28 dodań i 0 usunięć
  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;
}
```

Ładowanie…
Anuluj
Zapisz