diff options
author | Neeraj Kumar | 2010-06-04 03:54:17 +0000 |
---|---|---|
committer | Neeraj Kumar | 2010-06-04 03:54:17 +0000 |
commit | 333989fc6d6a254f0383407de6d69be6c8ca994c (patch) | |
tree | b216ff49b41a510d808a82258a6e71cf91cc4b85 | |
parent | fababbe205395b6b8c812b458df3af65e3f5e01c (diff) | |
download | scummvm-rg350-333989fc6d6a254f0383407de6d69be6c8ca994c.tar.gz scummvm-rg350-333989fc6d6a254f0383407de6d69be6c8ca994c.tar.bz2 scummvm-rg350-333989fc6d6a254f0383407de6d69be6c8ca994c.zip |
some code on getting strings printed on the screen
svn-id: r49421
-rw-r--r-- | engines/testbed/gfxtests.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/engines/testbed/gfxtests.cpp b/engines/testbed/gfxtests.cpp index 3beed2aa44..8ed8c49a1b 100644 --- a/engines/testbed/gfxtests.cpp +++ b/engines/testbed/gfxtests.cpp @@ -1,6 +1,9 @@ #include "testbed/gfxtests.h" #include "testbed/testsuite.h" + #include "graphics/pixelformat.h" +#include "graphics/fontman.h" +#include "graphics/surface.h" namespace Testbed { @@ -49,17 +52,41 @@ bool testAspectRatio() { char blackbuf[16 * 20]; memset(blackbuf, 1, 16 * 20); // Prepare a buffer 16px wide and 240px high, to fit on a lateral strip - uint8 pal[2 * 4]; - g_system->grabPalette(pal, 0, 2); + uint8 pal[3 * 4]; + g_system->grabPalette(pal, 0, 3); pal[4] = 255; pal[5] = 255; - pal[6] = 0; + pal[6] = 255; - g_system->setPalette(pal, 0, 2); + pal[8] = 0; + pal[9] = 255; + pal[10] = 0; - g_system->copyRectToScreen((const byte *)blackbuf, 16, 20, 28, 16, 20); // Fix left strip - g_system->updateScreen(); + g_system->setPalette(pal, 0, 3); + //g_system->copyRectToScreen((const byte *)blackbuf, 16, 20, 28, 16, 20); + //g_system->updateScreen(); + + // Font usage + + Graphics::Surface *screen = g_system->lockScreen(); + + const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont)); + + uint16 h = font.getFontHeight(); + uint16 y = g_system->getHeight() / 2 - h / 2; + + + Common::Rect r(0,y,screen->w,y+h); + screen->fillRect(r,0); + + Common::String text("Hi thr!"); + + font.drawString(screen, text, 0, y, screen->w, 1, Graphics::kTextAlignCenter); + + g_system->unlockScreen(); + g_system->updateScreen(); + return true; } |