Mercurial > fife-parpg
comparison ext/guichan-0.8.2/examples/allegrowidgets.cpp @ 378:64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 11 Jan 2010 23:34:52 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
377:fe6fb0e0ed23 | 378:64738befdf3b |
---|---|
1 /** | |
2 * This is an example that shows of the widgets present in | |
3 * Guichan. The example uses the Allegro back end. | |
4 */ | |
5 | |
6 #include <guichan.hpp> | |
7 #include <iostream> | |
8 | |
9 // Here we store a global Gui object. We make it global | |
10 // so it's easily accessable. Of course, global variables | |
11 // should normally be avioded when it comes to OOP, but | |
12 // this examples is not an example that shows how to make a | |
13 // good and clean C++ application but merely an example | |
14 // that shows how to use Guichan. | |
15 namespace globals | |
16 { | |
17 gcn::Gui* gui; | |
18 } | |
19 | |
20 // Include code to set up an Allegro application with Guichan. | |
21 // The allegro.hpp file is responsible for creating and deleting | |
22 // the global Gui object. | |
23 #include "allegro.hpp" | |
24 // Include code to set up a Guichan GUI with all the widgets | |
25 // of Guichan. The code populates the global Gui object. | |
26 #include "widgets.hpp" | |
27 | |
28 int main(int argc, char **argv) | |
29 { | |
30 try | |
31 { | |
32 allegro::init(); | |
33 widgets::init(); | |
34 allegro::run(); | |
35 widgets::halt(); | |
36 allegro::halt(); | |
37 } | |
38 /* | |
39 * Catch all Guichan exceptions | |
40 */ | |
41 catch (gcn::Exception e) | |
42 { | |
43 std::cerr << e.getMessage() << std::endl; | |
44 return 1; | |
45 } | |
46 /* | |
47 * Catch all Std exceptions | |
48 */ | |
49 catch (std::exception e) | |
50 { | |
51 std::cerr << "Std exception: " << e.what() << std::endl; | |
52 return 1; | |
53 } | |
54 /* | |
55 * Catch all Unknown exceptions | |
56 */ | |
57 catch (...) | |
58 { | |
59 std::cerr << "Unknown exception" << std::endl; | |
60 return 1; | |
61 } | |
62 | |
63 return 0; | |
64 } | |
65 END_OF_MAIN() |