-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_area.cxx
47 lines (37 loc) · 965 Bytes
/
my_area.cxx
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
45
46
47
#include "sys.h"
#include "debug.h"
#include "MyArea.h"
#include "statefultask/AIEngine.h"
#include "statefultask/AIAuxiliaryThread.h"
#include <gtkmm.h>
bool on_idle()
{
gMainThreadEngine.mainloop();
return true;
}
int main(int argc, char** argv)
{
#ifdef DEBUGGLOBAL
GlobalObjectManager::main_entered();
#endif
Debug(NAMESPACE_DEBUG::init());
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
Gtk::Window win;
win.set_title("BUNNIES!");
// Make window as large as our drawing area.
win.set_size_request(MyArea::width, MyArea::height);
win.set_resizable(false);
AIAuxiliaryThread::start();
MyArea area;
for(int i = 0; i < 10; ++i)
{
boost::intrusive_ptr<Bunny> bunny = new Bunny(area);
area.add_bunny(bunny);
bunny->run();
}
win.add(area);
area.show();
//run statefultask's mainloop whenever idle
Glib::signal_idle().connect( sigc::ptr_fun(&on_idle) );
return app->run(win);
}