gint: Add libprof for more accurate FPS
This commit is contained in:
parent
136e536544
commit
332771104f
|
@ -47,6 +47,7 @@ This version supports multiplayer, but it's slower than the gint version.
|
|||
This version doesn't support multiplayer, but it runs faster and doesn't have a border.
|
||||
#### Linux
|
||||
- Install gint ([https://gitea.planet-casio.com/Lephenixnoir/gint](https://gitea.planet-casio.com/Lephenixnoir/gint))
|
||||
- Install libprof ([https://gitea.planet-casio.com/Lephenixnoir/libprof](https://gitea.planet-casio.com/Lephenixnoir/libprof))
|
||||
- Run `make gint`
|
||||
|
||||
## Technical information
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CC = sh-elf-g++
|
||||
CFLAGS += -Wall -Wextra -Ofast -funroll-loops -DGINT
|
||||
CFLAGS += -DFXCG50 -DTARGET_FXCG50 -m4-nofpu -mb -ffreestanding -nostdlib -fstrict-volatile-bitfields
|
||||
LDFLAGS = -m4-nofpu -mb -nostdlib -Wl,--no-warn-rwx-segments -T fxcg50.ld -lgint-cg -lc -lgcc -lgint-cg
|
||||
LDFLAGS = -m4-nofpu -mb -nostdlib -Wl,--no-warn-rwx-segments -T fxcg50.ld -lgint-cg -lc -lgcc -lgint-cg -lprof-cg
|
||||
|
||||
INCLUDES =
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ int main(){
|
|||
Track::coneMesh = {22, cone_triangles};
|
||||
Track::simpleConeMesh = {2, simpleConeTriangles};
|
||||
|
||||
Time::init();
|
||||
|
||||
Display::init();
|
||||
Display::clear(newColor(70, 180, 220));
|
||||
Display::show();
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
#ifdef GINT
|
||||
#include "time.h"
|
||||
#include <gint/rtc.h>
|
||||
#include <libprof.h>
|
||||
|
||||
namespace Time {
|
||||
void init(){}
|
||||
prof_t prof;
|
||||
void init(){
|
||||
prof_init();
|
||||
prof = prof_make();
|
||||
}
|
||||
void update(){
|
||||
prof_leave(prof);
|
||||
|
||||
const float lastTime = time;
|
||||
time = rtc_ticks();
|
||||
delta = time - lastTime;
|
||||
delta = prof_time(prof) / 1000.0f / (1000.0f / 128.0f);
|
||||
|
||||
prof = prof_make();
|
||||
prof_enter(prof);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <fxcg/rtc.h>
|
||||
|
||||
namespace Time {
|
||||
void init(){
|
||||
}
|
||||
void update(){
|
||||
const float lastTime = time;
|
||||
time = RTC_GetTicks();
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <SDL2/SDL.h>
|
||||
|
||||
namespace Time {
|
||||
void init(){
|
||||
}
|
||||
void update(){
|
||||
const float lastTime = time;
|
||||
time = ((float)(SDL_GetTicks()) / (1000.0/128.0));
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
namespace Time {
|
||||
extern float time;
|
||||
extern float delta;
|
||||
void init();
|
||||
void update();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue