Voxvision  1
Creating and manipulating voxel octrees
Data Structures | Macros | Functions | Variables
fps-control.h File Reference

FPS controller. More...

#include <SDL2/SDL.h>
#include "../voxvision.h"

Go to the source code of this file.

Data Structures

struct  vox_fps_info
 Frame counter info. More...
 

Macros

#define vox_fpsstatus_updated(status)   (status)&1
 true if FPS controller status was updated.
 
#define vox_fpsstatus_fps(status)   (status)>>1
 Get actual FPS value.
 
#define vox_fpsstatus(fps, updated)   ((fps)<<1 | ((updated) ? 1: 0))
 Construct FPS status.
 

Functions

VOX_EXPORT vox_fps_controller_t vox_make_fps_controller (unsigned int fps)
 Make FPS controller. More...
 
VOX_EXPORT void vox_destroy_fps_controller (vox_fps_controller_t controller)
 Destroy FPS controller created earlier.
 

Variables

struct vox_fps_info(^ vox_fps_controller_t )(void)
 FPS controller type.
 

Detailed Description

FPS controller.

Function Documentation

◆ vox_make_fps_controller()

VOX_EXPORT vox_fps_controller_t vox_make_fps_controller ( unsigned int  fps)

Make FPS controller.

FPS controller is a block that must be called once in a rendering loop. It will put a thread to sleep to achieve a specified amount of frames per second. This block returns FPS controller status (see vox_fps_info).

Parameters
fpsA desired FPS value. If it's zero, only count FPS, do not put a thread to sleep.
Returns
FPS controller status.