Debian Codegraph @

Tests/TextureSizeTest/main.cpp

raw
1 #include <ClanLib/application.h>
2 #include <ClanLib/core.h>
3 #include <ClanLib/display.h>
4 #include <ClanLib/gl.h>
5 #include <GL/gl.h>
6 #include <GL/glu.h>
7
8 // #include "C:\Program Files\Rational\Quantify\pure.h"
9
10 /////////////////////////////////////////////////////////////////////////////
11 // Application class
12
13 class Application : public CL_ClanApplication
14 {
15 public:
16 int main(int argc, char** argv);
17
18 void test_artifact(CL_DisplayWindow &window);
19 void test_texturesize(CL_DisplayWindow &window);
20 } app;
21
22 /////////////////////////////////////////////////////////////////////////////
23 // Application main entry point:
24
25 int Application::main(int argc, char** argv)
26 {
27 CL_ConsoleWindow debug_console("Debug console");
28 debug_console.redirect_stdio();
29
30 try
31 {
32 CL_SetupCore::init();
33 CL_SetupDisplay::init();
34 CL_SetupGL::init();
35
36 CL_DisplayWindow window("ClanLib Texture Size test program", 1024, 768, false, true);
37
38 test_artifact(window);
39
40 CL_SetupGL::deinit();
41 CL_SetupDisplay::deinit();
42 CL_SetupCore::deinit();
43 }
44 catch (CL_Error error)
45 {
46 std::cout << "Uncaught error: " << error.message.c_str() << std::endl;
47 debug_console.wait_for_key();
48 }
49
50 return 0;
51 }
52
53 void Application::test_artifact(CL_DisplayWindow &window)
54 {
55 /* CL_Surface ImageTGA("images/ship.tga");
56 CL_Surface ImagePNG("images/ship.png");
57
58 ImageTGA.set_alignment(origin_center);
59 ImagePNG.set_alignment(origin_center);
60
61 CL_SpriteDescription desc;
62 desc.add_frame(new CL_PNGProvider("images/ship.png"), true);
63 CL_Sprite sprite(desc);
64
65 while(!CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
66 {
67 CL_Display::clear();
68
69 if(CL_Keyboard::get_keycode(CL_KEY_SPACE))
70 {
71 ImageTGA.rotate(0.01f);
72 ImagePNG.rotate(0.01f);
73 sprite.rotate(0.01f);
74 }
75
76 ImageTGA.draw(100, 100);
77 ImagePNG.draw(200, 100);
78
79 sprite.draw(100,200);
80
81 CL_System::keep_alive();
82 CL_Display::flip();
83 }
84 */}
85
86 void Application::test_texturesize(CL_DisplayWindow &window)
87 {
88 /* CL_Size max_texture_size = window.get_gc()->get_max_surface_size();
89 std::cout << "Max texture size: " << max_texture_size.width << "x" << max_texture_size.height << std::endl;
90
91 std::cout << "2045x2045: ";
92 CL_SpriteDescription desc1;
93 desc1.add_frame(new CL_JPEGProvider("images/2045x2045.jpg"), true);
94 CL_Sprite sprite1(desc1);
95 std::cout << "is ok" << std::endl;
96
97 std::cout << "2046x2046: ";
98 CL_SpriteDescription desc2;
99 desc2.add_frame(new CL_JPEGProvider("images/2046x2046.jpg"), true);
100 CL_Sprite sprite2(desc2);
101 std::cout << "is ok" << std::endl;
102
103 std::cout << "2047x2047: ";
104 CL_SpriteDescription desc3;
105 desc3.add_frame(new CL_JPEGProvider("images/2047x2047.jpg"), true);
106 CL_Sprite sprite3(desc3);
107 std::cout << "is ok" << std::endl;
108
109 std::cout << "2048x2048: ";
110 CL_SpriteDescription desc4;
111 desc4.add_frame(new CL_JPEGProvider("images/2048x2048.jpg"), true);
112 CL_Sprite sprite4(desc4);
113 std::cout << "is ok" << std::endl;
114
115 std::cout << "2049x2049: ";
116 CL_SpriteDescription desc5;
117 desc5.add_frame(new CL_JPEGProvider("images/2049x2049.jpg"), true);
118 CL_Sprite sprite5(desc5);
119 std::cout << "is ok" << std::endl;
120
121 while(!CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
122 {
123 CL_Display::clear();
124 CL_System::keep_alive();
125 CL_Display::flip();
126 }
127 */
128 }