FINAL: v1

This commit is contained in:
2026-03-26 19:34:47 +01:00
parent 031c0e7293
commit 0f776347f4
11 changed files with 181 additions and 17 deletions

View File

@@ -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;
};