2 Commits
+3 -4
View File
@@ -117,6 +117,8 @@ struct Viewport {
sg_image depth_image = {};
int size[2] = {400, 400};
Viewport() { Resize(size[0], size[1]); }
void Resize(int width, int height) {
width = width < 1 ? 1 : width;
height = height < 1 ? 1 : height;
@@ -191,7 +193,7 @@ struct ApplicationConfig {
AnimationPlayerWidget animation_player_widget;
struct ViewportWidget {
bool visible = false;
bool visible = true;
int position[2] = {20, 20};
int size[2] = {800, 500};
};
@@ -203,7 +205,6 @@ struct ApplicationConfig {
};
void to_json(nlohmann::json& j, const ApplicationConfig& config) {
std::cerr << "converting to json" << std::endl;
j["type"] = "AnimTestbedConfig";
j["main_window"]["position"][0] = config.window_position[0];
@@ -247,8 +248,6 @@ void to_json(nlohmann::json& j, const ApplicationConfig& config) {
}
void from_json(const nlohmann::json& j, ApplicationConfig& config) {
std::cerr << "converting from json" << std::endl;
if (j.contains("main_window")) {
if (j["main_window"].contains("position")
and j["main_window"]["position"].size() == 2) {