Add AgiButtonStyle and create correct style according to render mode (Supports PC and Amiga styles).

svn-id: r28009
This commit is contained in:
Kari Salminen 2007-07-10 15:28:43 +00:00
parent 728fe1ff86
commit 80cdd532bc
2 changed files with 166 additions and 0 deletions

View file

@ -535,6 +535,58 @@ static const GameSettings agiSettings[] = {
{NULL, NULL, 0, 0, NULL}
};
AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, bool positive) const {
if (_amigaStyle)
if (positive)
if (pressed) // Positive pressed Amiga-style button
return AgiTextColor(amigaBlack, _olderAgi? amigaOrange : amigaPurple);
else // Positive unpressed Amiga-style button
return AgiTextColor(amigaWhite, amigaGreen);
else // _amigaStyle && !positive
if (pressed) // Negative pressed Amiga-style button
return AgiTextColor(amigaBlack, amigaCyan);
else // Negative unpressed Amiga-style button
return AgiTextColor(amigaWhite, amigaRed);
else // PC-style button
if (hasFocus || pressed) // A pressed or in focus PC-style button
return AgiTextColor(pcWhite, pcBlack);
else // An unpressed PC-style button without focus
return AgiTextColor(pcBlack, pcWhite);
}
AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, bool baseFgColor, bool baseBgColor) const {
return getColor(hasFocus, pressed, AgiTextColor(baseFgColor, baseBgColor));
}
AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, const AgiTextColor &baseColor) const {
if (hasFocus || pressed)
return baseColor.swap();
else
return baseColor;
}
int AgiButtonStyle::getTextOffset(bool hasFocus, bool pressed) const {
return (pressed && !_amigaStyle) ? 1 : 0;
}
bool AgiButtonStyle::getBorder(bool hasFocus, bool pressed) const {
return _amigaStyle && !_authenticAmiga && (hasFocus || pressed);
}
void AgiButtonStyle::setAmigaStyle(bool amigaStyle, bool olderAgi, bool authenticAmiga) {
_amigaStyle = amigaStyle;
_olderAgi = olderAgi;
_authenticAmiga = authenticAmiga;
}
void AgiButtonStyle::setPcStyle(bool pcStyle) {
setAmigaStyle(!pcStyle);
}
AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) {
setAmigaStyle(renderMode == Common::kRenderAmiga);
}
AgiEngine::AgiEngine(OSystem *syst) : Engine(syst) {
// Setup mixer
@ -635,6 +687,7 @@ void AgiEngine::initialize() {
}
}
_buttonStyle = AgiButtonStyle(_renderMode);
_console = new Console(this);
_gfx = new GfxMgr(this);
_sound = new SoundMgr(this, _mixer);