| 1 |
/* |
| 2 |
** ClanLib SDK |
| 3 |
** Copyright (c) 1997-2005 The ClanLib Team |
| 4 |
** |
| 5 |
** This software is provided 'as-is', without any express or implied |
| 6 |
** warranty. In no event will the authors be held liable for any damages |
| 7 |
** arising from the use of this software. |
| 8 |
** |
| 9 |
** Permission is granted to anyone to use this software for any purpose, |
| 10 |
** including commercial applications, and to alter it and redistribute it |
| 11 |
** freely, subject to the following restrictions: |
| 12 |
** |
| 13 |
** 1. The origin of this software must not be misrepresented; you must not |
| 14 |
** claim that you wrote the original software. If you use this software |
| 15 |
** in a product, an acknowledgment in the product documentation would be |
| 16 |
** appreciated but is not required. |
| 17 |
** 2. Altered source versions must be plainly marked as such, and must not be |
| 18 |
** misrepresented as being the original software. |
| 19 |
** 3. This notice may not be removed or altered from any source distribution. |
| 20 |
** |
| 21 |
** Note: Some of the libraries ClanLib may link to may have additional |
| 22 |
** requirements or restrictions. |
| 23 |
** |
| 24 |
** File Author(s): |
| 25 |
** |
| 26 |
** Magnus Norddahl |
| 27 |
** (if your name is missing here, please add it) |
| 28 |
*/ |
| 29 |
|
| 30 |
#include "provider_test.h" |
| 31 |
|
| 32 |
ProviderTest app; |
| 33 |
|
| 34 |
int |
| 35 |
ProviderTest::main(int argc, char** argv) |
| 36 |
{ |
| 37 |
CL_SetupCore::init(); |
| 38 |
CL_SetupDisplay::init(); |
| 39 |
#ifdef USE_SDL |
| 40 |
CL_SetupSDL::init(); |
| 41 |
#else |
| 42 |
CL_SetupGL::init(); |
| 43 |
#endif |
| 44 |
// Set a videomode - 640x480x16bpp |
| 45 |
// false means that this program should not run full-screen |
| 46 |
CL_DisplayWindow window("ProviderTest", 640, 480); |
| 47 |
|
| 48 |
CL_Surface colorkeyed_png("colorkeyed_png.png"); |
| 49 |
CL_Surface indexed_png("indexed_png.png"); |
| 50 |
CL_Surface grayscaled_png("grayscaled_png.png"); |
| 51 |
CL_Surface grayscaled_alpha_png("grayscaled_alpha_png.png"); |
| 52 |
CL_Surface grayscaled_colorkey_png("grayscaled_colorkey_png.png"); |
| 53 |
CL_Surface rgb_png("rgb_png.png"); |
| 54 |
CL_Surface rgba_png("rgba_png.png"); |
| 55 |
CL_Surface grayscaled_jpg("grayscaled_jpg.jpg"); |
| 56 |
CL_Surface truecolor_jpg("truecolor_jpg.jpg"); |
| 57 |
|
| 58 |
while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE)) |
| 59 |
{ |
| 60 |
const int check_size = 16; |
| 61 |
CL_Display::clear(CL_Color(0, 0, 0)); |
| 62 |
for (int y = 0; y < 640; y += check_size*2) |
| 63 |
{ |
| 64 |
for (int x = 0; x < 640; x += check_size*2) |
| 65 |
CL_Display::fill_rect(CL_Rect(x, y, x + check_size, y + check_size), |
| 66 |
CL_Color(100, 100, 100)); |
| 67 |
for (int x = check_size; x < 640; x += check_size*2) |
| 68 |
CL_Display::fill_rect(CL_Rect(x, y + check_size, |
| 69 |
x + check_size, y + check_size*2), |
| 70 |
CL_Color(100, 100, 100)); |
| 71 |
} |
| 72 |
|
| 73 |
colorkeyed_png.draw(40, 30); |
| 74 |
indexed_png.draw(240, 30); |
| 75 |
rgba_png.draw(440, 30); |
| 76 |
|
| 77 |
grayscaled_png.draw(40, 180); |
| 78 |
grayscaled_alpha_png.draw(240, 180); |
| 79 |
grayscaled_colorkey_png.draw(440, 180); |
| 80 |
|
| 81 |
rgb_png.draw(40, 330); |
| 82 |
grayscaled_jpg.draw(240, 330); |
| 83 |
truecolor_jpg.draw(440, 330); |
| 84 |
|
| 85 |
CL_Display::flip(); |
| 86 |
CL_System::keep_alive(); |
| 87 |
CL_System::sleep(10); |
| 88 |
} |
| 89 |
|
| 90 |
#ifdef USE_SDL |
| 91 |
CL_SetupSDL::deinit(); |
| 92 |
#else |
| 93 |
CL_SetupGL::deinit(); |
| 94 |
#endif |
| 95 |
CL_SetupDisplay::deinit(); |
| 96 |
CL_SetupCore::deinit(); |
| 97 |
|
| 98 |
return 0; |
| 99 |
} |
| 100 |
|
| 101 |
/* EOF */ |