Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion VortexEngine/VortexLib/VortexLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,11 @@ EMSCRIPTEN_BINDINGS(Vortex) {
.function("parseJson", &Vortex::parseJson)
.function("setLockEnabled", &Vortex::setLockEnabled)
.function("lockEnabled", &Vortex::lockEnabled)
.function("engine", &Vortex::engine);
.function("engine", &Vortex::engine)
.function("getVersion", &Vortex::getVersion)
.function("getVersionMajor", &Vortex::getVersionMajor)
.function("getVersionMinor", &Vortex::getVersionMinor)
.function("getVersionBuild", &Vortex::getVersionBuild);

function("getDataArray", &getDataArray);
function("getRawDataArray", &getRawDataArray);
Expand Down Expand Up @@ -1991,6 +1995,24 @@ string Vortex::getStorageFilename()
return m_engine.storage().getStorageFilename();
}

// get the engine version as a string
std::string Vortex::getVersion() const {
return VORTEX_VERSION;
}

// get the version as separated integers
uint8_t Vortex::getVersionMajor() const {
return VORTEX_VERSION_MAJOR;
}

uint8_t Vortex::getVersionMinor() const {
return VORTEX_VERSION_MINOR;
}

uint8_t Vortex::getVersionBuild() const {
return VORTEX_BUILD_NUMBER;
}

json Vortex::modeToJson(const Mode *mode)
{
if (!mode) {
Expand Down Expand Up @@ -2216,6 +2238,7 @@ json Vortex::saveToJson()

saveJson["version_major"] = static_cast<uint8_t>(VORTEX_VERSION_MAJOR);
saveJson["version_minor"] = static_cast<uint8_t>(VORTEX_VERSION_MINOR);
saveJson["version_build"] = static_cast<uint8_t>(VORTEX_BUILD_NUMBER);
saveJson["global_flags"] = m_engine.modes().globalFlags();
saveJson["brightness"] = static_cast<uint8_t>(m_engine.leds().getBrightness());

Expand Down
7 changes: 7 additions & 0 deletions VortexEngine/VortexLib/VortexLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ class Vortex
void setLockEnabled(bool enable) { m_lockEnabled = enable; }
bool lockEnabled() { return m_lockEnabled; }

// get the engine version as a string
std::string getVersion() const;
// get the version as separated integers
uint8_t getVersionMajor() const;
uint8_t getVersionMinor() const;
uint8_t getVersionBuild() const;

// convert a mode to/from a json object
json modeToJson(const Mode *mode);
Mode *modeFromJson(const json &modeJson);
Expand Down