diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-14 21:51:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-14 21:51:25 +0300 |
commit | f43b3c4de32e049e087b4dec3c81c99307f46c1d (patch) | |
tree | ce0510f3642e0900abbceeb9c6a322c62a92b1d3 /src/test/testlauncher.cpp | |
parent | 7b6e1592f9d969cad8cd85598250000e1628d70c (diff) | |
download | manaverse-f43b3c4de32e049e087b4dec3c81c99307f46c1d.tar.gz manaverse-f43b3c4de32e049e087b4dec3c81c99307f46c1d.tar.bz2 manaverse-f43b3c4de32e049e087b4dec3c81c99307f46c1d.tar.xz manaverse-f43b3c4de32e049e087b4dec3c81c99307f46c1d.zip |
Add another build in fps test, unused.
Diffstat (limited to 'src/test/testlauncher.cpp')
-rw-r--r-- | src/test/testlauncher.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index c1bde0810..22a77eb0e 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -92,6 +92,8 @@ int TestLauncher::exec() return testDraw(); else if (mTest == "103") return testFps2(); + else if (mTest == "104") + return testFps3(); return -1; } @@ -219,6 +221,53 @@ int TestLauncher::testFps2() return 0; } +int TestLauncher::testFps3() +{ + timeval start; + timeval end; + + Wallpaper::loadWallpapers(); + Wallpaper::getWallpaper(800, 600); + Image *img[2]; + + img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_up.png"); + img[1] = Theme::getImageFromTheme("graphics/sprites/arrow_left.png"); + ImageVertexes *const vert1 = new ImageVertexes; + vert1->image = img[0]; + ImageVertexes *const vert2 = new ImageVertexes; + vert2->image = img[1]; + + for (int f = 0; f < 50; f ++) + { + for (int d = 0; d < 50; d ++) + { + mainGraphics->calcTileVertexes(vert1, img[0], f * 16, d * 12); + mainGraphics->calcTileVertexes(vert1, img[1], f * 16 + 5, d * 12); + } + } + mainGraphics->finalize(vert1); + mainGraphics->finalize(vert2); + + const int cnt = 2000; + + gettimeofday(&start, nullptr); + for (int k = 0; k < cnt; k ++) + { + mainGraphics->drawTileVertexes(vert1); + mainGraphics->drawTileVertexes(vert2); + mainGraphics->updateScreen(); + } + + gettimeofday(&end, nullptr); + const int tFps = calcFps(&start, &end, cnt); + file << mTest << std::endl; + file << tFps << std::endl; + + printf("fps: %u\n", tFps); + sleep(1); + return 0; +} + int TestLauncher::testBatches() { int batches = 512; |