Mercurial > fife-parpg
comparison ext/guichan-0.8.2/examples/openglallegroaction.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 demonstrates how to use actions | |
3 * in Guichan. The example uses the OpenGL back end and the | |
4 * Allegro back end. | |
5 */ | |
6 | |
7 #include <guichan.hpp> | |
8 #include <iostream> | |
9 | |
10 // Here we store a global Gui object. We make it global | |
11 // so it's easily accessable. Of course, global variables | |
12 // should normally be avioded when it comes to OOP, but | |
13 // this examples is not an example that shows how to make a | |
14 // good and clean C++ application but merely an example | |
15 // that shows how to use Guichan. | |
16 namespace globals | |
17 { | |
18 gcn::Gui* gui; | |
19 } | |
20 | |
21 // Include code to set up an OpenGL and Allegro application with Guichan. | |
22 // The openglallegro.hpp file is responsible for creating and deleting | |
23 // the global Gui object. | |
24 #include "openglallegro.hpp" | |
25 // Include code to set up a Guichan GUI that demonstrates how | |
26 // to use actions in Guichan. The code populates the global Gui object. | |
27 #include "action.hpp" | |
28 | |
29 int main(int argc, char **argv) | |
30 { | |
31 try | |
32 { | |
33 openglallegro::init(); | |
34 action::init(); | |
35 openglallegro::run(); | |
36 action::halt(); | |
37 openglallegro::halt(); | |
38 } | |
39 /* | |
40 * Catch all Guichan exceptions | |
41 */ | |
42 catch (gcn::Exception e) | |
43 { | |
44 std::cerr << e.getMessage() << std::endl; | |
45 return 1; | |
46 } | |
47 /* | |
48 * Catch all Std exceptions | |
49 */ | |
50 catch (std::exception e) | |
51 { | |
52 std::cerr << "Std exception: " << e.what() << std::endl; | |
53 return 1; | |
54 } | |
55 /* | |
56 * Catch all Unknown exceptions | |
57 */ | |
58 catch (...) | |
59 { | |
60 std::cerr << "Unknown exception" << std::endl; | |
61 return 1; | |
62 } | |
63 | |
64 return 0; | |
65 } | |
66 END_OF_MAIN() |