[FEATURE] bullet shooting
This commit is contained in:
@@ -17,3 +17,19 @@ uint8_t timing_get_fps(SceUInt64 dt)
|
||||
{
|
||||
return (1 / (dt / 1000.0));
|
||||
}
|
||||
|
||||
void timing_update_timer(timing_timer* timer, SceUInt64 dt)
|
||||
{
|
||||
timer->time += dt;
|
||||
}
|
||||
|
||||
uint8_t timing_check_timer_elapsed(timing_timer* timer)
|
||||
{
|
||||
if (timer->time > timer->timeout)
|
||||
{
|
||||
timer->time = 0;
|
||||
timer->elapsed = 1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
#define TIMING_H
|
||||
|
||||
#include <psp2/kernel/processmgr.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
timer_t time;
|
||||
SceUInt64 timeout;
|
||||
uint8_t elapsed;
|
||||
} timing_timer;
|
||||
|
||||
/**
|
||||
* @brief gets the delta time in ms. (the duration since this function was last called)
|
||||
@@ -9,7 +17,8 @@
|
||||
* @param sysclock the system kernel clock pointer to use
|
||||
* @return SceUInt64 the delta time in ms
|
||||
*/
|
||||
SceUInt64 timing_get_deltatime(SceKernelSysClock *sysclock);
|
||||
SceUInt64
|
||||
timing_get_deltatime(SceKernelSysClock *sysclock);
|
||||
|
||||
/**
|
||||
* @brief calculates the fps based on the given delta time
|
||||
@@ -18,4 +27,20 @@ SceUInt64 timing_get_deltatime(SceKernelSysClock *sysclock);
|
||||
* @return uint8_t the fps
|
||||
*/
|
||||
uint8_t timing_get_fps(SceUInt64 dt);
|
||||
|
||||
/**
|
||||
* @brief updates a timer with the last frametime
|
||||
*
|
||||
* @param timer the timer to update
|
||||
* @param dt the deltatime
|
||||
*/
|
||||
void timing_update_timer(timing_timer* timer, SceUInt64 dt);
|
||||
|
||||
/**
|
||||
* @brief checks if the given timer has elapsed or not
|
||||
*
|
||||
* @param timer the timer to check
|
||||
* @return uint8_t 0 if false, nonzero if true
|
||||
*/
|
||||
uint8_t timing_check_timer_elapsed(timing_timer* timer);
|
||||
#endif
|
||||
Reference in New Issue
Block a user