Skip to content

Commit

Permalink
TESTBED: Added mouse cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Sep 3, 2016
1 parent f8fc43b commit 302562d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions engines/testbed/graphics.cpp
Expand Up @@ -47,6 +47,7 @@ GFXTestSuite::GFXTestSuite() {

// Init Mouse Palette (White-black-yellow)
GFXtests::initMousePalette();
GFXtests::initMouseCursor();

// Add tests here

Expand Down Expand Up @@ -103,6 +104,29 @@ void GFXtests::initMousePalette() {
CursorMan.replaceCursorPalette(palette, 0, 3);
}

static const byte MOUSECURSOR_SCI[] = {
1,1,0,0,0,0,0,0,0,0,0,
1,2,1,0,0,0,0,0,0,0,0,
1,2,2,1,0,0,0,0,0,0,0,
1,2,2,2,1,0,0,0,0,0,0,
1,2,2,2,2,1,0,0,0,0,0,
1,2,2,2,2,2,1,0,0,0,0,
1,2,2,2,2,2,2,1,0,0,0,
1,2,2,2,2,2,2,2,1,0,0,
1,2,2,2,2,2,2,2,2,1,0,
1,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,1,0,0,0,0,
1,2,1,0,1,2,2,1,0,0,0,
1,1,0,0,1,2,2,1,0,0,0,
0,0,0,0,0,1,2,2,1,0,0,
0,0,0,0,0,1,2,2,1,0,0,
0,0,0,0,0,0,1,2,2,1,0
};

void GFXtests::initMouseCursor() {
CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
}

Common::Rect GFXtests::computeSize(const Common::Rect &cursorRect, int scalingFactor, int cursorTargetScale) {
if (cursorTargetScale == 1 || scalingFactor == 1) {
// Game data and cursor would be scaled equally.
Expand Down
1 change: 1 addition & 0 deletions engines/testbed/graphics.h
Expand Up @@ -33,6 +33,7 @@ namespace GFXtests {
void drawEllipse(int x, int y, int a, int b);
void setupMouseLoop(bool disableCursorPalette = false, const char *gfxModeName = "", int cursorTargetScale = 1);
void initMousePalette();
void initMouseCursor();
Common::Rect computeSize(const Common::Rect &cursorRect, int scalingFactor, int cursorTargetScale);
void HSVtoRGB(int &rComp, int &gComp, int &bComp, int hue, int sat, int val);
Common::Rect drawCursor(bool cursorPaletteDisabled = false, int cursorTargetScale = 1);
Expand Down

0 comments on commit 302562d

Please sign in to comment.