back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/menu_callbacks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'menu_callbacks.cpp')
-rw-r--r--menu_callbacks.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/menu_callbacks.cpp b/menu_callbacks.cpp
index df70514..d43d848 100644
--- a/menu_callbacks.cpp
+++ b/menu_callbacks.cpp
@@ -1,10 +1,12 @@
#include <FL/Fl_Native_File_Chooser.H>
+#include <memory>
#include <stdio.h>
#include <string>
#include "menu_callbacks.hpp"
+#include "solution_algorithm.hpp"
-void load_file_callback(Fl_Widget *sender, void *window)
+void load_file_callback(Fl_Widget *sender, void*)
{
auto dialog = Fl_Native_File_Chooser{};
dialog.type(Fl_Native_File_Chooser::BROWSE_FILE);
@@ -20,15 +22,19 @@ void load_file_callback(Fl_Widget *sender, void *window)
printf("%s\n", dialog.filename());
}
-void exit_callback(Fl_Widget *w, void *params)
+void exit_callback(Fl_Widget *w, void*)
{
w->parent()->hide();
}
-void solve_problem_callback(Fl_Widget *w, void *params)
+void solve_problem_callback(Fl_Widget *w, void *gp)
{
+ std::unique_ptr<ASearch> algorithm =
+ ASearch::Start(reinterpret_cast<GameParams*>(gp));
+ Node *goal = algorithm->FindSolution();
+ algorithm->ShowSolution(goal);
}
-void about_callback(Fl_Widget *w, void *params)
+void about_callback(Fl_Widget *w, void*)
{
}