diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-04 00:04:53 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-04 00:04:53 +0200 |
commit | f95df35dc58e01b99ffddfc4ad394feaa4460b09 (patch) | |
tree | 4e3afe06c73adc767e308991ce4192983fd7b72b /src/common/test/image_test.cpp | |
parent | d9c5a439d09211ec210195709d275596c6c3c9ba (diff) | |
download | colobot-f95df35dc58e01b99ffddfc4ad394feaa4460b09.tar.gz colobot-f95df35dc58e01b99ffddfc4ad394feaa4460b09.tar.bz2 colobot-f95df35dc58e01b99ffddfc4ad394feaa4460b09.zip |
Multitexturing support
- added CImage class for loading/saving images and a simple test for it
- added libpng library to build
- added Gfx::Texture struct
- updated the Gfx::CDevice interface to include new features
- implemented the new features in Gfx::CGLDevice
Diffstat (limited to 'src/common/test/image_test.cpp')
-rw-r--r-- | src/common/test/image_test.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/common/test/image_test.cpp b/src/common/test/image_test.cpp new file mode 100644 index 0000000..0ad1ee2 --- /dev/null +++ b/src/common/test/image_test.cpp @@ -0,0 +1,34 @@ +#include "../image.h" + +#include <SDL/SDL.h> +#include <stdio.h> + +/* For now, just a simple test: loading a file from image + * and saving it to another in PNG. */ + +int main(int argc, char *argv[]) +{ + if (argc != 3) + { + printf("Usage: %s in_image out_image\n", argv[0]); + return 0; + } + + CImage image; + + if (! image.Load(argv[1])) + { + std::string err = image.GetError(); + printf("Error loading '%s': %s\n", err.c_str()); + return 1; + } + + if (! image.SavePNG(argv[2])) + { + std::string err = image.GetError(); + printf("Error saving PNG '%s': %s\n", err.c_str()); + return 2; + } + + return 0; +} |