From 464637a743236cb86fd4d796b0f1b02d190e865c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 May 2014 17:04:12 +0300 Subject: Add function for show/test draw primitives. --- src/test/testlauncher.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/test/testlauncher.cpp') 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; -- cgit v1.2.3-60-g2f50