Skip to content

Commit

Permalink
remove boring pages and fix json
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool authored Jan 4, 2024
1 parent 2321913 commit b8ebdde
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 64 deletions.
6 changes: 0 additions & 6 deletions geode/index.md

This file was deleted.

17 changes: 0 additions & 17 deletions geode/sdk-env-var.md

This file was deleted.

2 changes: 1 addition & 1 deletion mods/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ description: A collection of tutorials for working with Geode mods
order: 3
---

# Mods
# Geode Mods

These are a collection of tutorials for working with Geode mods; how to setup your developer environment, how to add settings, dependencies, etc.
10 changes: 5 additions & 5 deletions mods/savedata.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Settings are covered [in their own tutorial](/mods/settings.md) - **this tutoria

Unlike settings, save data does not need to be declared in `mod.json`, or anywhere else for that matter. Save data is automatically brought to life when you set it for the first time. Save data is, as the name implies, saved when the game is closed, and its previous state loaded back up the next time the game is opened.

You can save any type of value as long as it implements `json::Serialize` (see the [STL container implementations](https://github.com/geode-sdk/json/blob/main/include/json/stl_serialize.hpp) for an example).
You can save any type of value as long as it implements `matjson::Serialize` (see the [STL container implementations](https://github.com/geode-sdk/json/blob/main/include/matjson/stl_serialize.hpp) for an example).

## Setting & getting save data

Expand All @@ -22,16 +22,16 @@ struct MyCustomSaveData {
};

template<>
struct json::Serialize<MyCustomSaveData> {
static MyCustomSaveData from_json(json::Value const& value) {
struct matjson::Serialize<MyCustomSaveData> {
static MyCustomSaveData from_json(matjson::Value const& value) {
return MyCustomSaveData {
.x = value["x"].as_int(),
.y = value["y"].as_int()
};
}

static json::Value to_json(MyCustomSaveData const& value) {
auto obj = json::Object();
static matjson::Value to_json(MyCustomSaveData const& value) {
auto obj = matjson::Object();
obj["x"] = value.x;
obj["y"] = value.y;
return obj;
Expand Down
4 changes: 2 additions & 2 deletions mods/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ class MySettingValue : public SettingValue {
// you are free to do whatever!

public:
bool load(json::Value const& json) override {
bool load(matjson::Value const& json) override {
// load the value of the setting from json,
// returning true if loading was succesful
}
bool save(json::Value& json) const override {
bool save(matjson::Value& json) const override {
// save the value of the setting into json,
// returning true if saving was succesful
}
Expand Down
33 changes: 0 additions & 33 deletions mods/vscode.md

This file was deleted.

0 comments on commit b8ebdde

Please sign in to comment.