Commit 7721c0f4 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

gui: add accumulator-2 model

parent f6fc2d0b
Pipeline #11690 passed with stage
in 1 minute and 7 seconds
......@@ -105,6 +105,7 @@ static inline const char* status_string[] = {
"model_quantifier_bad_external_message",
"model_cross_bad_external_message",
"model_time_func_bad_init_message",
"model_accumulator_bad_external_message",
"gui_not_enough_memory",
"io_file_format_error",
"io_file_format_model_error",
......
......@@ -718,6 +718,13 @@ struct editor
} break;
case dynamics_type::generator: {
auto& dyn = sim.generator_models.get(mdl.id);
ImGui::PushItemWidth(120.0f);
ImGui::InputDouble("value", &dyn.default_value);
ImGui::InputDouble("period", &dyn.default_period);
ImGui::InputDouble("offset", &dyn.default_offset);
ImGui::PopItemWidth();
imnodes::BeginOutputAttribute(get_out(dyn.y[0]));
ImGui::TextUnformatted("prod");
imnodes::EndAttribute();
......@@ -757,6 +764,21 @@ struct editor
ImGui::TextUnformatted("out");
imnodes::EndAttribute();
} break;
case dynamics_type::accumulator_2: {
auto& dyn = sim.accumulator_2_models.get(mdl.id);
imnodes::BeginInputAttribute(get_in(dyn.x[0]));
ImGui::TextUnformatted("number-1");
imnodes::EndAttribute();
imnodes::BeginInputAttribute(get_in(dyn.x[1]));
ImGui::TextUnformatted("number-2");
imnodes::EndAttribute();
imnodes::BeginInputAttribute(get_in(dyn.x[2]));
ImGui::TextUnformatted("acc-1");
imnodes::EndAttribute();
imnodes::BeginInputAttribute(get_in(dyn.x[3]));
ImGui::TextUnformatted("acc-2");
imnodes::EndAttribute();
} break;
case dynamics_type::time_func: {
auto& dyn = sim.time_func_models.get(mdl.id);
const char* items[] = { "time", "square" };
......@@ -1039,6 +1061,14 @@ struct editor
}
}
if (ImGui::MenuItem("accumulator-2")) {
if (sim.accumulator_2_models.can_alloc(1u) &&
sim.models.can_alloc(1u)) {
auto& mdl = sim.accumulator_2_models.alloc();
sim.alloc(mdl, sim.accumulator_2_models.get_id(mdl), "acc-2");
}
}
if (ImGui::MenuItem("time_func")) {
if (sim.time_func_models.can_alloc(1u) &&
sim.models.can_alloc(1u)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment