FINAL: v1
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <shared_mutex>
|
||||
#include <random>
|
||||
#include <cstdlib>
|
||||
|
||||
#define DISABLE_COPY(Class) \
|
||||
Class(const Class&) = delete; \
|
||||
@@ -46,4 +49,19 @@
|
||||
#define TARGET_FPS 60
|
||||
#define TARGET_UPDATE_RATE 120
|
||||
#define ENABLE_LOW_LATENCY_VSYNC 1
|
||||
#define VSYNC_FPS_OFFSET 2
|
||||
#define VSYNC_FPS_OFFSET 2
|
||||
|
||||
class Utils {
|
||||
public:
|
||||
static Utils& getUtils() { static Utils instance; return instance; }
|
||||
// Random in range 32 bits
|
||||
int rirng32(int a, int b) {
|
||||
std::lock_guard lock(mMutex);
|
||||
std::mt19937 mGen(mRd());
|
||||
std::uniform_int_distribution<> distr(a, b);
|
||||
return distr(mGen);
|
||||
}
|
||||
private:
|
||||
mutable std::shared_mutex mMutex;
|
||||
std::random_device mRd;
|
||||
};
|
||||
Reference in New Issue
Block a user