git.haldean.org qb / 69ff379
drawing improvements, early kb nav Haldean Brown 5 months ago
3 changed file(s) with 19 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1818
1919 static void init(void) {
2020 sg_setup(&(sg_desc){
21 .context = sapp_sgcontext()
21 .context = sapp_sgcontext(),
2222 });
2323 stm_setup();
24 simgui_setup(&(simgui_desc_t){ 0 });
24 simgui_setup(&(simgui_desc_t){
25 .max_vertices = 524288,
26 });
2527
2628 // initial clear color
2729 state.pass_action = (sg_pass_action) {
4848 const size_t s1 = ceil(rsamplerate * c->vismax);
4949
5050 ImGui::InvisibleButton("##empty", ImVec2(-1, 2 * rad));
51 const ImVec2 origin = ImGui::GetItemRectMin();
52 const ImVec2 corner = ImGui::GetItemRectMax();
51 const ImVec2 origin = ImVec2(0, ImGui::GetItemRectMin().y);
52 const ImVec2 corner =
53 ImVec2(ImGui::GetWindowWidth(), ImGui::GetItemRectMax().y);
5354 const double width = corner.x - origin.x;
5455 const double scale = width / (s1 - s0);
5556
22 #include "task.hpp"
33 #include "AudioFile/AudioFile.h"
44
5 #include "sokol/sokol_app.h"
56 #include "cimgui/imgui/imgui.h"
67
78 #include <cmath>
1920 ImGui::SetNextWindowSize(ImVec2((float) width, (float) height));
2021 ImGui::Begin("MainWindow", nullptr, ImGuiWindowFlags_NoDecoration);
2122
23 if (ImGui::IsKeyPressed(SAPP_KEYCODE_L)) {
24 int delta = (int) ceil((vismax - vismin) * 0.02);
25 vismin += delta;
26 vismax += delta;
27 } else if (ImGui::IsKeyPressed(SAPP_KEYCODE_H)) {
28 int delta = (int) ceil((vismax - vismin) * 0.02);
29 delta = std::min(vismin, delta);
30 vismin -= delta;
31 vismax -= delta;
32 }
33
2234 int minframe = 0, maxframe = 0;
2335 for (const auto &n : _nodes) {
2436 minframe = std::min(minframe, n->minframe());
3042 draw_node(n);
3143 }
3244 ImGui::End();
33
34 ImGui::ShowDemoWindow();
3545 }
3646
3747 void context::shutdown() {