gint: Add libprof for more accurate FPS

This commit is contained in:
duarteapcoelho 2022-12-08 16:20:43 +00:00
parent 136e536544
commit 332771104f
7 changed files with 22 additions and 3 deletions

View File

@ -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

View File

@ -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 =

View File

@ -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();

View File

@ -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

View File

@ -3,6 +3,8 @@
#include <fxcg/rtc.h>
namespace Time {
void init(){
}
void update(){
const float lastTime = time;
time = RTC_GetTicks();

View File

@ -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));

View File

@ -3,5 +3,6 @@
namespace Time {
extern float time;
extern float delta;
void init();
void update();
};