diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-28 17:04:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-28 17:04:12 +0300 |
commit | 464637a743236cb86fd4d796b0f1b02d190e865c (patch) | |
tree | 9668b6f850c30651874f80c7f6cc9476f0b73d16 /src | |
parent | 9512b66c09f182b416bdc0107dd871856f8f70d3 (diff) | |
download | plus-464637a743236cb86fd4d796b0f1b02d190e865c.tar.gz plus-464637a743236cb86fd4d796b0f1b02d190e865c.tar.bz2 plus-464637a743236cb86fd4d796b0f1b02d190e865c.tar.xz plus-464637a743236cb86fd4d796b0f1b02d190e865c.zip |
Add function for show/test draw primitives.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/testlauncher.cpp | 41 | ||||
-rw-r--r-- | src/test/testlauncher.h | 2 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index 1a435d280..1bc51a7c7 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -24,12 +24,15 @@ #include "client.h" #include "graphicsmanager.h" +#include "graphicsvertexes.h" #include "soundmanager.h" #include "render/sdlgraphics.h" #include "gui/theme.h" +#include "gui/fonts/font.h" + #include "utils/physfscheckutils.h" #include "utils/physfsrwops.h" @@ -49,6 +52,8 @@ #include "debug.h" +extern Font *boldFont; + TestLauncher::TestLauncher(std::string test) : mTest(test), file() @@ -82,6 +87,8 @@ int TestLauncher::exec() return testInternal(); else if (mTest == "101") return testDye(); + else if (mTest == "102") + return testDraw(); return -1; } @@ -361,6 +368,40 @@ int TestLauncher::testDye() return 0; } +int TestLauncher::testDraw() +{ + Image *img[2]; + img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_left.png"); + img[1] = Theme::getImageFromTheme("graphics/sprites/arrow_right.png"); + ImageCollection *const col = new ImageCollection; + + mainGraphics->pushClipArea(Rect(10, 20, 790, 580)); + mainGraphics->setColor(Color(0xFFU, 0xFFU, 0x00U, 0xFFU)); + mainGraphics->drawRectangle(Rect(0, 0, 400, 200)); + + mainGraphics->setColor(Color(0x00U, 0x00U, 0xFFU, 0x90U)); + mainGraphics->fillRectangle(Rect(200, 100, 300, 300)); + mainGraphics->popClipArea(); + + mainGraphics->setColor(Color(0xFFU, 0x00U, 0x00U, 0xB0U)); + boldFont->drawString(mainGraphics, + "test test test test test test test test ", 300, 100); + + mainGraphics->drawPattern(img[0], 10, 400, 100, 200); + + mainGraphics->calcPattern(col, img[1], 500, 400, 150, 100); + mainGraphics->drawTileCollection(col); + + mainGraphics->setColor(Color(0x00U, 0xFFU, 0x00U, 0x90U)); + mainGraphics->drawNet(450, 10, 600, 300, 32, 20); + + mainGraphics->updateScreen(); + sleep(10); + + delete col; + return 0; +} + int TestLauncher::testVideoDetection() { file << mTest << std::endl; diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index a7ebadf4a..ed2b9251f 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -66,6 +66,8 @@ class TestLauncher final int testTextures(); + int testDraw(); + private: std::string mTest; |