| 1 |
#include <ClanLib/application.h> |
| 2 |
#include <ClanLib/core.h> |
| 3 |
#include <ClanLib/display.h> |
| 4 |
#include <ClanLib/gl.h> |
| 5 |
|
| 6 |
///////////////////////////////////////////////////////////////////////////// |
| 7 |
// Application class |
| 8 |
|
| 9 |
class Application : public CL_ClanApplication |
| 10 |
{ |
| 11 |
public: |
| 12 |
int main(int argc, char** argv); |
| 13 |
|
| 14 |
private: |
| 15 |
void statetree_test(); |
| 16 |
} app; |
| 17 |
|
| 18 |
///////////////////////////////////////////////////////////////////////////// |
| 19 |
// Application main entry point: |
| 20 |
|
| 21 |
int Application::main(int argc, char** argv) |
| 22 |
{ |
| 23 |
CL_ConsoleWindow debug_console("Debug console", 80, 1000); |
| 24 |
debug_console.redirect_stdio(); |
| 25 |
|
| 26 |
try |
| 27 |
{ |
| 28 |
CL_SetupCore::init(); |
| 29 |
CL_SetupDisplay::init(); |
| 30 |
CL_SetupGL::init(); |
| 31 |
|
| 32 |
CL_DisplayWindow window("ClanLib StateTree test program", 800, 600, false, true); |
| 33 |
|
| 34 |
statetree_test(); |
| 35 |
|
| 36 |
CL_SetupGL::deinit(); |
| 37 |
CL_SetupDisplay::deinit(); |
| 38 |
CL_SetupCore::deinit(); |
| 39 |
} |
| 40 |
catch (CL_Error error) |
| 41 |
{ |
| 42 |
std::cout << "Uncaught error: " << error.message.c_str() << std::endl; |
| 43 |
} |
| 44 |
|
| 45 |
debug_console.display_close_message(); |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
void Application::statetree_test() |
| 50 |
{ |
| 51 |
CL_Surface image1("images/test32.tga"); |
| 52 |
|
| 53 |
while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE)) |
| 54 |
{ |
| 55 |
// image1.draw(200,200); |
| 56 |
image1.draw(CL_Rect(0,0,100,100), CL_Rect(200,200,300,300)); |
| 57 |
|
| 58 |
CL_Display::draw_line(0,0,100,100, CL_Color(255,255,255)); |
| 59 |
CL_Display::fill_rect(CL_Rect(100,100,200,200), CL_Color(255,255,255)); |
| 60 |
|
| 61 |
CL_System::keep_alive(); |
| 62 |
CL_Display::flip(); |
| 63 |
} |
| 64 |
} |