SCI/newgui: support for disabled menu entries, changed textface (int) to greyedOutput (bool)
svn-id: r45863
This commit is contained in:
parent
fbfafb576e
commit
b85c254c5f
8 changed files with 25 additions and 18 deletions
|
@ -180,7 +180,7 @@ void SciGui::disposeWindow(uint16 windowPtr, bool reanimate) {
|
|||
#define SCI_DISPLAY_SETALIGNMENT 101
|
||||
#define SCI_DISPLAY_SETPENCOLOR 102
|
||||
#define SCI_DISPLAY_SETBACKGROUNDCOLOR 103
|
||||
#define SCI_DISPLAY_SETTEXTFACE 104
|
||||
#define SCI_DISPLAY_SETGREYEDOUTPUT 104
|
||||
#define SCI_DISPLAY_SETFONT 105
|
||||
#define SCI_DISPLAY_WIDTH 106
|
||||
#define SCI_DISPLAY_SAVEUNDER 107
|
||||
|
@ -200,7 +200,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
|
|||
// setting defaults
|
||||
_gfx->PenMode(0);
|
||||
_gfx->PenColor(0);
|
||||
_gfx->TextFace(0);
|
||||
_gfx->TextGreyedOutput(false);
|
||||
// processing codes in argv
|
||||
while (argc > 0) {
|
||||
displayArg = argv[0].toUint16();
|
||||
|
@ -222,8 +222,8 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
|
|||
bgcolor = argv[0].toUint16();
|
||||
argc--; argv++;
|
||||
break;
|
||||
case SCI_DISPLAY_SETTEXTFACE:
|
||||
_gfx->TextFace(argv[0].toUint16());
|
||||
case SCI_DISPLAY_SETGREYEDOUTPUT:
|
||||
_gfx->TextGreyedOutput(argv[0].isNull() ? false : true);
|
||||
argc--; argv++;
|
||||
break;
|
||||
case SCI_DISPLAY_SETFONT:
|
||||
|
@ -365,9 +365,9 @@ void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, i
|
|||
_gfx->EraseRect(rect);
|
||||
_gfx->FrameRect(rect);
|
||||
rect.grow(-2);
|
||||
_gfx->TextFace(style & 1 ? 0 : 1);
|
||||
_gfx->TextGreyedOutput(style & 1 ? false : true);
|
||||
_text->Box(text, 0, rect, SCI_TEXT_ALIGNMENT_CENTER, fontId);
|
||||
_gfx->TextFace(0);
|
||||
_gfx->TextGreyedOutput(false);
|
||||
rect.grow(1);
|
||||
if (style & 8) // selected
|
||||
_gfx->FrameRect(rect);
|
||||
|
|
|
@ -78,7 +78,7 @@ byte *SciGuiFont::getCharData(byte chr) {
|
|||
return chr < _numChars ? _resourceData + _chars[chr].offset + 2 : 0;
|
||||
}
|
||||
|
||||
void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface) {
|
||||
void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput) {
|
||||
int charWidth = MIN<int>(getCharWidth(chr), screen->_width - left);
|
||||
int charHeight = MIN<int>(getCharHeight(chr), 200 - top);
|
||||
byte b = 0, mask = 0xFF;
|
||||
|
@ -86,7 +86,7 @@ void SciGuiFont::draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, by
|
|||
|
||||
byte *pIn = getCharData(chr);
|
||||
for (int i = 0; i < charHeight; i++, y++) {
|
||||
if (textface & 1) // "grayed" output
|
||||
if (greyedOutput)
|
||||
mask = top++ % 2 ? 0xAA : 0x55;
|
||||
for (int done = 0; done < charWidth; done++) {
|
||||
if ((done & 7) == 0) // fetching next data byte
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
byte getCharWidth(byte chr);
|
||||
byte getCharHeight(byte chr);
|
||||
byte *getCharData(byte chr);
|
||||
void draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, byte textface);
|
||||
void draw(SciGuiScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput);
|
||||
|
||||
private:
|
||||
ResourceManager *_resMan;
|
||||
|
|
|
@ -123,7 +123,7 @@ void SciGuiGfx::OpenPort(GuiPort *port) {
|
|||
|
||||
port->top = 0;
|
||||
port->left = 0;
|
||||
port->textFace = 0;
|
||||
port->greyedOutput = false;
|
||||
port->penClr = 0;
|
||||
port->backClr = 255;
|
||||
port->penMode = 0;
|
||||
|
@ -142,8 +142,8 @@ void SciGuiGfx::PenMode(int16 mode) {
|
|||
_curPort->penMode = mode;
|
||||
}
|
||||
|
||||
void SciGuiGfx::TextFace(int16 textFace) {
|
||||
_curPort->textFace = textFace;
|
||||
void SciGuiGfx::TextGreyedOutput(bool state) {
|
||||
_curPort->greyedOutput = state;
|
||||
}
|
||||
|
||||
int16 SciGuiGfx::GetPointSize() {
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
void PenColor(int16 color);
|
||||
void BackColor(int16 color);
|
||||
void PenMode(int16 mode);
|
||||
void TextFace(int16 textFace);
|
||||
void TextGreyedOutput(bool state);
|
||||
int16 GetPointSize();
|
||||
|
||||
void ClearScreen(byte color = 255);
|
||||
|
|
|
@ -49,12 +49,13 @@ struct GuiPort {
|
|||
int16 curTop, curLeft;
|
||||
int16 fontHeight;
|
||||
GuiResourceId fontId;
|
||||
int16 textFace, penClr, backClr;
|
||||
bool greyedOutput;
|
||||
int16 penClr, backClr;
|
||||
int16 penMode;
|
||||
|
||||
GuiPort(uint16 theId) : id(theId), top(0), left(0),
|
||||
curTop(0), curLeft(0),
|
||||
fontHeight(0), fontId(0), textFace(0),
|
||||
fontHeight(0), fontId(0), greyedOutput(false),
|
||||
penClr(0), backClr(0xFF), penMode(0) {
|
||||
}
|
||||
};
|
||||
|
|
|
@ -509,6 +509,7 @@ void SciGuiMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) {
|
|||
listItemEntry = *listItemIterator;
|
||||
if (listItemEntry->menuId == newMenuId) {
|
||||
if (!listItemEntry->separatorLine) {
|
||||
_gfx->TextGreyedOutput(listItemEntry->enabled ? false : true);
|
||||
_gfx->MoveTo(_menuRect.left, topPos);
|
||||
_text->Draw_String(listItemEntry->text.c_str());
|
||||
_gfx->MoveTo(_menuRect.right - listItemEntry->textRightAlignedWidth - 5, topPos);
|
||||
|
@ -527,6 +528,8 @@ void SciGuiMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) {
|
|||
}
|
||||
listItemIterator++;
|
||||
}
|
||||
_gfx->TextGreyedOutput(false);
|
||||
|
||||
|
||||
_menuRect.left -= 8;
|
||||
_menuRect.left--; _menuRect.right++; _menuRect.bottom++;
|
||||
|
@ -579,8 +582,11 @@ GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() {
|
|||
_curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id;
|
||||
return NULL;
|
||||
case SCI_K_ENTER:
|
||||
_curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id;
|
||||
return curItemEntry;
|
||||
if (curItemEntry->enabled) {
|
||||
_curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id;
|
||||
return curItemEntry;
|
||||
}
|
||||
break;
|
||||
case SCI_K_LEFT:
|
||||
newMenuId--; newItemId = 1;
|
||||
break;
|
||||
|
|
|
@ -335,7 +335,7 @@ void SciGuiText::Draw(const char *text, int16 from, int16 len, GuiResourceId org
|
|||
_gfx->EraseRect(rect);
|
||||
}
|
||||
// CharStd
|
||||
_font->draw(_screen, curChar, _gfx->_curPort->top + _gfx->_curPort->curTop, _gfx->_curPort->left + _gfx->_curPort->curLeft, _gfx->_curPort->penClr, _gfx->_curPort->textFace);
|
||||
_font->draw(_screen, curChar, _gfx->_curPort->top + _gfx->_curPort->curTop, _gfx->_curPort->left + _gfx->_curPort->curLeft, _gfx->_curPort->penClr, _gfx->_curPort->greyedOutput);
|
||||
_gfx->_curPort->curLeft += charWidth;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue