-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMazeGUI.cpp
More file actions
45 lines (36 loc) · 874 Bytes
/
MazeGUI.cpp
File metadata and controls
45 lines (36 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "MazeGUI.h"
DWORD WINAPI traverseMaze(LPVOID* parameters)
{
MazeGUI* maze_frame = (MazeGUI*) (parameters[0]);
maze_frame->solve();
}
void MazeGUI::startMazeThread()
{
//start a new thread to solve the maze
LPVOID* params = new LPVOID[1];
params[0] = this;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) traverseMaze, params, 0, NULL);
}
BEGIN_EVENT_TABLE (MazeGUI, wxFrame)
EVT_BUTTON (wxID_HIGHEST + 1, MazeGUI::on_maze_button_click_event)
END_EVENT_TABLE()
MazeGUI::MazeGUI(Maze* m) : wxFrame((wxFrame *)NULL, -1, wxT("Maze"), wxPoint(500,300), wxSize(875,438))
{
maze = m;
}
void MazeGUI::setDrawPanel(DrawPanel* draw_panel)
{
maze_panel = draw_panel;
}
void MazeGUI::update()
{
Refresh();
}
void MazeGUI::solve()
{
maze->solve();
}
void MazeGUI::on_maze_button_click_event(wxCommandEvent& evt)
{
startMazeThread();
}