Revision 2eaafff2
ID | 2eaafff20f1014a2a7998573e21437aedd65eb45 |
Added maps and menus in scoutsim.
Menu options for about, quit, clear, and viewing different maps.
scout/scoutsim/src/scoutsim.cpp | ||
---|---|---|
52 | 52 |
|
53 | 53 |
#include <boost/thread.hpp> |
54 | 54 |
|
55 |
#include <stdio.h> |
|
56 |
|
|
55 | 57 |
#include "sim_frame.h" |
56 | 58 |
|
57 | 59 |
#ifdef __WXMAC__ |
58 | 60 |
#include <ApplicationServices/ApplicationServices.h> |
59 | 61 |
#endif |
60 | 62 |
|
63 |
using namespace std; |
|
64 |
|
|
61 | 65 |
class ScoutApp : public wxApp |
62 | 66 |
{ |
63 | 67 |
public: |
... | ... | |
70 | 74 |
|
71 | 75 |
bool OnInit() |
72 | 76 |
{ |
77 |
std::cout << "Starting scout app." << std::endl; |
|
73 | 78 |
#ifdef __WXMAC__ |
74 | 79 |
ProcessSerialNumber PSN; |
75 | 80 |
GetCurrentProcess(&PSN); |
76 | 81 |
TransformProcessType(&PSN,kProcessTransformToForegroundApplication); |
77 | 82 |
SetFrontProcess(&PSN); |
78 | 83 |
#endif |
79 |
|
|
80 | 84 |
// Create our own copy of argv, with regular char*s. |
81 | 85 |
local_argv = new char*[ argc ]; |
82 | 86 |
for ( int i = 0; i < argc; ++i ) |
... | ... | |
84 | 88 |
local_argv[ i ] = strdup( wxString( argv[ i ] ).mb_str() ); |
85 | 89 |
} |
86 | 90 |
|
91 |
// Check for incorrect usage |
|
92 |
if (argc != 2) |
|
93 |
{ |
|
94 |
cout << endl << "Error." << endl << endl; |
|
95 |
cout << "Usage: " << local_argv[0] << " <map name>" << endl; |
|
96 |
cout << "To use maps/example.bmp, use 'example'." << endl; |
|
97 |
exit(0); |
|
98 |
} |
|
99 |
|
|
100 |
std::cout << "About to init node" << std::endl; |
|
87 | 101 |
ros::init(argc, local_argv, "scoutsim"); |
102 |
std::cout << "About to reset." << std::endl; |
|
88 | 103 |
nh.reset(new ros::NodeHandle); |
89 | 104 |
|
105 |
std::cout << "About to init image handlers." << std::endl; |
|
90 | 106 |
wxInitAllImageHandlers(); |
91 | 107 |
|
92 |
scoutsim::SimFrame* frame = new scoutsim::SimFrame(NULL); |
|
108 |
std::cout << "About to make a sim frame." << std::endl; |
|
109 |
scoutsim::SimFrame* frame = new scoutsim::SimFrame(NULL, string(local_argv[1])); |
|
93 | 110 |
|
94 | 111 |
SetTopWindow(frame); |
95 | 112 |
frame->Show(); |
96 | 113 |
|
114 |
std::cout << "Constructor done!" << std::endl; |
|
97 | 115 |
return true; |
98 | 116 |
} |
99 | 117 |
|
... | ... | |
109 | 127 |
} |
110 | 128 |
}; |
111 | 129 |
|
130 |
BEGIN_EVENT_TABLE(scoutsim::SimFrame, wxFrame) |
|
131 |
EVT_MENU(ID_QUIT, scoutsim::SimFrame::onQuit) |
|
132 |
EVT_MENU(ID_ABOUT, scoutsim::SimFrame::onAbout) |
|
133 |
EVT_MENU(ID_CLEAR, scoutsim::SimFrame::onClear) |
|
134 |
EVT_MENU(ID_MAP, scoutsim::SimFrame::showMap) |
|
135 |
EVT_MENU(ID_LINES, scoutsim::SimFrame::showLines) |
|
136 |
END_EVENT_TABLE() |
|
137 |
|
|
112 | 138 |
DECLARE_APP(ScoutApp); |
113 | 139 |
IMPLEMENT_APP(ScoutApp); |
Also available in: Unified diff