summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 87515c1..1be2ac3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,8 +16,8 @@
16#include <stdio.h> 16#include <stdio.h>
17#include <stdlib.h> 17#include <stdlib.h>
18 18
19static constexpr int BufferWidth = 160; 19static constexpr int BufferWidth = 320;
20static constexpr int BufferHeight = 120; 20static constexpr int BufferHeight = 240;
21static constexpr R Aspect = (R)BufferWidth / (R)BufferHeight; 21static constexpr R Aspect = (R)BufferWidth / (R)BufferHeight;
22 22
23static const char* WindowTitle = "GAME"; 23static const char* WindowTitle = "GAME";
@@ -140,7 +140,7 @@ static void ShowStats(const sgCounters* last_stats, const sgCounters* stats, R t
140 140
141 const uint64_t frames_elapsed = stats->frames - last_stats->frames; 141 const uint64_t frames_elapsed = stats->frames - last_stats->frames;
142#define RATE_PER_SEC(STAT) (int)((R)(stats->STAT - last_stats->STAT) / time_elapsed) 142#define RATE_PER_SEC(STAT) (int)((R)(stats->STAT - last_stats->STAT) / time_elapsed)
143#define RATE_PER_FRAME(STAT) (int)((stats->STAT - last_stats->STAT) / frames_elapsed) 143#define RATE_PER_FRAME(STAT) (int)( (stats->STAT - last_stats->STAT) / frames_elapsed)
144 const int fps = RATE_PER_SEC(frames); 144 const int fps = RATE_PER_SEC(frames);
145 const int pps = RATE_PER_SEC(pixels); 145 const int pps = RATE_PER_SEC(pixels);
146 const int tps = RATE_PER_SEC(triangles3); 146 const int tps = RATE_PER_SEC(triangles3);
@@ -148,8 +148,11 @@ static void ShowStats(const sgCounters* last_stats, const sgCounters* stats, R t
148 const int tpf = RATE_PER_FRAME(triangles3); 148 const int tpf = RATE_PER_FRAME(triangles3);
149#undef RATE_PER_FRAME 149#undef RATE_PER_FRAME
150#undef RATE_PER_SEC 150#undef RATE_PER_SEC
151 constexpr R MicrosInSec = (R)1e6;
152 const int frame_time = (int)((MicrosInSec * time_elapsed) / (R)(stats->frames - last_stats->frames));
151 153
152 printf("fps: %d, pps: %d, tps: %d, ppf: %d, tpf: %d\n", fps, pps, tps, ppf, tpf); 154 printf("time(us): %d, fps: %d, pps: %d, tps: %d, ppf: %d, tpf: %d\n",
155 frame_time, fps, pps, tps, ppf, tpf);
153} 156}
154 157
155static CameraCommand CameraCommandFromInput( 158static CameraCommand CameraCommandFromInput(