Custom C++ Engine
Integrate Compuon into any C++17 codebase. Link the static library from the SDK package and include the headers.
CMake Integration
add_library(compuon STATIC IMPORTED)
set_target_properties(compuon PROPERTIES
IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/third_party/compuon/lib/libcompuon.a
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/third_party/compuon/include
)
target_link_libraries(YourGame PRIVATE compuon)On Windows, point IMPORTED_LOCATION at compuon.lib instead.
Initialization
#include <compuon/compuon.h>
#include <compuon/compuon_c.h>
using namespace compuon;
bool running = true;
void update() { running = false; }
void render() {}
int main() {
const uint64_t key_seed = 0x12345678ULL;
const uint64_t prng_seed = 0xABCDEF01ULL;
compuon_init(key_seed, prng_seed);
while (running) {
compuon_frame_tick();
update();
render();
}
compuon_shutdown();
}Using Compuon<T>
#include <compuon/compuon.h>
using namespace compuon;
struct Player {
Compuon<int> hp{100};
Compuon<int> gold{0};
Compuon<float> speed{5.0f};
Compuon<float> x{0.0f}, y{0.0f};
void take_damage(int dmg) {
hp -= Compuon<int>(dmg);
if (hp <= Compuon<int>(0)) die();
}
void move(float dx, float dy) {
x += Compuon<float>(dx * speed.val());
y += Compuon<float>(dy * speed.val());
}
void add_gold(int amount) {
gold += Compuon<int>(amount);
}
void die() {}
};Supported Types
| Type | Use Case |
|---|---|
| Compuon<int> | Health, ammo, score, gold |
| Compuon<float> | Speed, position, damage multiplier |
| Compuon<int64_t> | Large counters, timestamps |
Build Requirements
- + C++17 or later
- + GCC 9+, Clang 10+, or MSVC 2019+
- + No external dependencies
- + Link the Compuon static library from the SDK package