Skip to content

Commit 7fef593

Browse files
committed
refactor: add algorithm options via code
1 parent ac6a92c commit 7fef593

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/main_scene/main_scene.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ void MainScene::_notification(int p_what) {
4444
if (load_button) load_button->connect("pressed", Callable(this, "_on_load_button_pressed"));
4545

4646
algo_button = get_node<OptionButton>("UI/AlgoButton");
47-
if (algo_button) algo_button->connect("item_selected", Callable(this, "_on_algo_button_selected"));
47+
if (algo_button) {
48+
algo_button->connect("item_selected", Callable(this, "_on_algo_button_selected"));
49+
algo_button->add_item("Greedy Best First Search");
50+
algo_button->add_item("Uniform Cost Search");
51+
algo_button->add_item("A* Search");
52+
algo_button->select(0);
53+
}
4854

4955
time_label = get_node<Label>("UI/TimeLabel");
5056
if (time_label) time_label->set_text("Time: 0.0s");

tukang-parkir-simulator/scenes/main.tscn

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,6 @@ offset_top = 25.0
126126
offset_right = -30.0
127127
offset_bottom = 69.0
128128
grow_horizontal = 0
129-
selected = 0
130-
item_count = 3
131-
popup/item_0/text = "Greedy Best First Search"
132-
popup/item_0/id = 0
133-
popup/item_1/text = "Uniform Cost Search"
134-
popup/item_1/id = 1
135-
popup/item_2/text = "A*"
136-
popup/item_2/id = 2
137129

138130
[node name="TimeLabel" type="Label" parent="UI"]
139131
anchors_preset = 7

0 commit comments

Comments
 (0)