diff --git a/CMakeLists.txt b/CMakeLists.txt index 562e9c5..059d026 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(graphs VERSION 0.0.44) +project(graphs VERSION 0.0.45) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) diff --git a/lib/BLT-With-Graphics-Template b/lib/BLT-With-Graphics-Template index ae2ad8d..c9475af 160000 --- a/lib/BLT-With-Graphics-Template +++ b/lib/BLT-With-Graphics-Template @@ -1 +1 @@ -Subproject commit ae2ad8d1ab9f9fc557de8dd51065d5dae77b98fe +Subproject commit c9475afb2a37ce4126b5519b456f6e3ea4f9f978 diff --git a/src/graph.cpp b/src/graph.cpp index 9f0e425..876f229 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -86,7 +86,7 @@ void graph_t::process_mouse_drag(const blt::i32 width, const blt::i32 height) global_matrices.getOrtho())); bool mouse_pressed = blt::gfx::isMousePressed(0); - blt::i32 new_selection = selected_node; + blt::i32 new_selection = -1; for (const auto& [index, node] : blt::enumerate(nodes)) { @@ -95,7 +95,7 @@ void graph_t::process_mouse_drag(const blt::i32 width, const blt::i32 height) const auto mag = dist.magnitude(); - if (mag < POINT_SIZE && (selected_node == -1 || !mouse_pressed)) + if (mag < POINT_SIZE && mouse_pressed) { new_selection = static_cast(index); break; @@ -108,21 +108,17 @@ void graph_t::process_mouse_drag(const blt::i32 width, const blt::i32 height) nodes[selected_node].setOutlineColor(color::POINT_OUTLINE_COLOR); } - if (!mouse_pressed && blt::gfx::mouseReleaseLastFrame()) + if (mouse_pressed && new_selection == -1 && selected_node != -1) { - reset_mouse_drag(); + selected_node = -1; } selected_node = new_selection; -// if (!mouse_pressed && selected_node != -1 && found && nodes[selected_node].getOutlineColor() != color::POINT_HIGHLIGHT_COLOR) -// { -// highlight_easing.progress(8 * static_cast(blt::gfx::getFrameDeltaSeconds())); -// nodes[selected_node].setOutlineColor(highlight_easing.apply(color::POINT_OUTLINE_COLOR, color::POINT_HIGHLIGHT_COLOR)); -// } -// -// if (!found) -// reset_mouse_highlight(); + if (!mouse_pressed && blt::gfx::mouseReleaseLastFrame()) + { + reset_mouse_drag(); + } if (selected_node != -1 && mouse_pressed) { @@ -134,12 +130,7 @@ void graph_t::process_mouse_drag(const blt::i32 width, const blt::i32 height) } void graph_t::handle_mouse() -{ - for (const auto& node : nodes) - { - - } -} +{} void graph_t::create_random_graph(bounding_box bb, const blt::size_t min_nodes, const blt::size_t max_nodes, const blt::f64 connectivity, const blt::f64 scaling_connectivity, const blt::f64 distance_factor) diff --git a/src/main.cpp b/src/main.cpp index 68445bd..4cd6a4c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,6 +31,16 @@ blt::gfx::first_person_camera_2d camera; namespace im = ImGui; +/* + * TODO: + * - Highlighted Node + * + transitions to other states + * - Selected Node + * - ability to add nodes to the graph + * - ability to add edges to the graph + * - ability to remove edges from the graph (multi selection?) + * - ability to remove nodes from graph (make use of multi selection?) + */ engine_t engine; void init(const blt::gfx::window_data& data)