njin
Engine 2D gọn nhẹ để tự tay làm game theo ý mình. Vibe coding cũng ổn luôn
Loading...
Searching...
No Matches
njin_settings.h
1#pragma once
2#include "njin_json.h"
3
4namespace njin {
5struct context;
6
9
20json_value settings_to_json(const context &ctx);
21
26void settings_apply(context &ctx, const json_value &json);
27
37bool settings_save(const context &ctx, const char *file = "settings.json",
38 const json_value *game = nullptr);
39
47bool settings_load(context &ctx, const char *file = "settings.json", json_value *game = nullptr);
49} // namespace njin
bool settings_save(const context &ctx, const char *file="settings.json", const json_value *game=nullptr)
Lưu cài đặt vào file trong thư mục lưu game (save_path()), kèm dữ liệu riêng của game nếu có (độ khó,...
bool settings_load(context &ctx, const char *file="settings.json", json_value *game=nullptr)
Nạp và áp dụng cài đặt đã lưu.
void settings_apply(context &ctx, const json_value &json)
Áp dụng cài đặt từ JSON của settings_to_json().
json_value settings_to_json(const context &ctx)
Cài đặt của người chơi dạng JSON: âm lượng và tắt tiếng từng kênh, phím đã gắn, toàn màn hình,...
Một giá trị JSON: null, bool, số, chuỗi, mảng hoặc object.
Definition njin_json.h:33