drawing improvements, early kb nav
Haldean Brown
1 year, 1 month ago
18 | 18 |
|
19 | 19 |
static void init(void) {
|
20 | 20 |
sg_setup(&(sg_desc){
|
21 | |
.context = sapp_sgcontext()
|
|
21 |
.context = sapp_sgcontext(),
|
22 | 22 |
});
|
23 | 23 |
stm_setup();
|
24 | |
simgui_setup(&(simgui_desc_t){ 0 });
|
|
24 |
simgui_setup(&(simgui_desc_t){
|
|
25 |
.max_vertices = 524288,
|
|
26 |
});
|
25 | 27 |
|
26 | 28 |
// initial clear color
|
27 | 29 |
state.pass_action = (sg_pass_action) {
|
48 | 48 |
const size_t s1 = ceil(rsamplerate * c->vismax);
|
49 | 49 |
|
50 | 50 |
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);
|
53 | 54 |
const double width = corner.x - origin.x;
|
54 | 55 |
const double scale = width / (s1 - s0);
|
55 | 56 |
|
2 | 2 |
#include "task.hpp"
|
3 | 3 |
#include "AudioFile/AudioFile.h"
|
4 | 4 |
|
|
5 |
#include "sokol/sokol_app.h"
|
5 | 6 |
#include "cimgui/imgui/imgui.h"
|
6 | 7 |
|
7 | 8 |
#include <cmath>
|
|
19 | 20 |
ImGui::SetNextWindowSize(ImVec2((float) width, (float) height));
|
20 | 21 |
ImGui::Begin("MainWindow", nullptr, ImGuiWindowFlags_NoDecoration);
|
21 | 22 |
|
|
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 |
|
22 | 34 |
int minframe = 0, maxframe = 0;
|
23 | 35 |
for (const auto &n : _nodes) {
|
24 | 36 |
minframe = std::min(minframe, n->minframe());
|
|
30 | 42 |
draw_node(n);
|
31 | 43 |
}
|
32 | 44 |
ImGui::End();
|
33 | |
|
34 | |
ImGui::ShowDemoWindow();
|
35 | 45 |
}
|
36 | 46 |
|
37 | 47 |
void context::shutdown() {
|