1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-21 20:39:57 +01:00
This commit is contained in:
Miloslav Číž 2019-06-01 19:22:55 +02:00
parent d3e3112fdd
commit 4649c33832

View file

@ -6,6 +6,7 @@
#include <SDL2/SDL.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
//#define S3L_PRESET_HIGHEST_QUALITY
@ -164,6 +165,10 @@ else
S3L_Transform3D modelTransform;
S3L_DrawConfig conf;
clock_t nextT;
int fps = 0;
void draw()
{
S3L_newFrame();
@ -181,6 +186,19 @@ void draw()
if (offScreenPixels > 0)
printf("offscreen pixels: %d\n",offScreenPixels);
clock_t nowT = clock();
double timeDiff = ((double) (nowT - nextT)) / CLOCKS_PER_SEC;
fps++;
if (timeDiff >= 1.0)
{
nextT = nowT;
printf("FPS: %d\n",fps);
fps = 0;
}
}
int main()
@ -191,6 +209,8 @@ int main()
SDL_Surface *screenSurface = SDL_GetWindowSurface(window);
SDL_Event event;
nextT = clock();
S3L_initCamera(&scene.camera);
// scene.camera.transform.translation.z = -S3L_FRACTIONS_PER_UNIT * 2;