Skip to content

Commit

Permalink
DIRECTOR: Render checkbox and button rectangles
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Iskrich authored and sev- committed Aug 3, 2016
1 parent f4325f3 commit 350f816
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions engines/director/score.cpp
Expand Up @@ -1268,6 +1268,31 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
}
}

void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) {
renderText(surface, spriteId);

uint16 castID = _sprites[spriteId]->_castId;
ButtonCast *button = static_cast<ButtonCast *>(_vm->_currentScore->_casts[castID]);

uint32 rectLeft = button->initialRect.left;
uint32 rectTop = button->initialRect.top;

int x = _sprites[spriteId]->_startPoint.x + rectLeft;
int y = _sprites[spriteId]->_startPoint.y + rectTop;
int height = _sprites[spriteId]->_height;
int width = _sprites[spriteId]->_width;

switch (button->buttonType) {
case kTypeCheckBox:
//Magic numbers: checkbox square need to move left about 5px from text and 12px side size (d4)
surface.frameRect(Common::Rect(x - 17, y, x + 12, y + 12), 0);
break;
case kTypeButton:
surface.frameRect(Common::Rect(x, y, x + width, y + height), 0);
break;
}
}

Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
uint16 imgId = spriteId + 1024;
Image::ImageDecoder *img = NULL;
Expand Down
3 changes: 2 additions & 1 deletion engines/director/score.h
Expand Up @@ -301,7 +301,8 @@ class Frame {
void playTransition(Score *score);
void playSoundChannel();
void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail);
void renderText(Graphics::ManagedSurface &surface, uint16 castId);
void renderText(Graphics::ManagedSurface &surface, uint16 spriteId);
void renderButton(Graphics::ManagedSurface &surface, uint16 spriteId);
void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
Expand Down

0 comments on commit 350f816

Please sign in to comment.