comparison ext/guichan-0.8.1/examples/openglallegroaction.cpp @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
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()