mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-13 05:00:59 +00:00
SVN/newgui: kDrawStatus implemented
svn-id: r44670
This commit is contained in:
parent
ec43c30503
commit
3654cefe33
@ -30,6 +30,7 @@
|
||||
#include "sci/gfx/gfx_gui.h"
|
||||
#include "sci/gfx/menubar.h"
|
||||
#include "sci/gfx/gfx_state_internal.h" // required for GfxPort, GfxVisual
|
||||
#include "sci/gui/gui.h"
|
||||
|
||||
namespace Sci {
|
||||
|
||||
@ -65,32 +66,20 @@ reg_t kGetMenu(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
|
||||
reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t text = argv[0];
|
||||
int fgcolor = (argc > 1) ? argv[1].toSint16() : s->status_bar_foreground;
|
||||
int bgcolor = (argc > 2) ? argv[2].toSint16() : s->status_bar_background;
|
||||
reg_t textReference = argv[0];
|
||||
Common::String text;
|
||||
int16 colorPen = (argc > 1) ? argv[1].toSint16() : 0; // old code was: s->status_bar_foreground;
|
||||
int16 colorBack = (argc > 2) ? argv[2].toSint16() : 255; // s->status_bar_background;
|
||||
|
||||
s->titlebar_port->_color.visual = get_pic_color(s, fgcolor);
|
||||
s->titlebar_port->_color.mask = GFX_MASK_VISUAL;
|
||||
s->titlebar_port->_bgcolor.visual = get_pic_color(s, bgcolor);
|
||||
s->titlebar_port->_bgcolor.mask = GFX_MASK_VISUAL;
|
||||
|
||||
s->status_bar_foreground = fgcolor;
|
||||
s->status_bar_background = bgcolor;
|
||||
|
||||
if (text.segment) {
|
||||
s->_statusBarText = s->_segMan->getString(text);
|
||||
}
|
||||
|
||||
sciw_set_status_bar(s, s->titlebar_port, s->_statusBarText, fgcolor, bgcolor);
|
||||
|
||||
gfxop_update(s->gfx_state);
|
||||
if (!textReference.isNull())
|
||||
text = s->_segMan->getString(textReference);
|
||||
|
||||
s->gui->drawStatus(s->strSplit(text.c_str(), NULL).c_str(), colorPen, colorBack);
|
||||
return s->r_acc;
|
||||
}
|
||||
|
||||
|
||||
reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
if (argv[0].toSint16())
|
||||
sciw_set_menubar(s, s->titlebar_port, s->_menubar, -1);
|
||||
else
|
||||
|
@ -54,7 +54,7 @@ SciGui::~SciGui() {
|
||||
void SciGui::init(bool oldGfxFunctions) {
|
||||
_usesOldGfxFunctions = oldGfxFunctions;
|
||||
|
||||
/* Set default SCI0 palette */
|
||||
|
||||
}
|
||||
|
||||
int16 SciGui::getTimeTicks() {
|
||||
@ -232,6 +232,19 @@ void SciGui::textColors(int argc, reg_t *argv) {
|
||||
_gfx->SetTextColors(argc, argv);
|
||||
}
|
||||
|
||||
void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
|
||||
GuiPort *oldPort = _gfx->SetPort(_gfx->_menuPort);
|
||||
if (text) {
|
||||
_gfx->FillRect(_gfx->_menuRect, 1, colorBack);
|
||||
_gfx->PenColor(colorPen);
|
||||
_gfx->MoveTo(0, 1);
|
||||
_gfx->Draw_String(text);
|
||||
_gfx->SetPort(oldPort);
|
||||
// _gfx->ShowBits(*_theMenuBar, 1);
|
||||
_screen->copyToScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void SciGui::drawPicture(GuiResourceId pictureId, uint16 style, uint16 flags, int16 EGApaletteNo) {
|
||||
bool addToFlag = flags ? true : false;
|
||||
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind);
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
virtual void textFonts(int argc, reg_t *argv);
|
||||
virtual void textColors(int argc, reg_t *argv);
|
||||
|
||||
virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack);
|
||||
virtual void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo);
|
||||
virtual void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo);
|
||||
virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse);
|
||||
|
@ -63,6 +63,7 @@ void SciGuiGfx::init() {
|
||||
OpenPort(_menuPort);
|
||||
SetFont(0);
|
||||
_menuPort->rect = Common::Rect(0, 0, _screen->_width, _screen->_height);
|
||||
_menuRect = Common::Rect(0, 0, _screen->_width, 10);
|
||||
|
||||
// HEAPHANDLE theMenuBarH = heapNewPtr(34, kDataPort, "MenuBar");
|
||||
// heapClearPtr(theMenuBarH);
|
||||
@ -1152,6 +1153,15 @@ void SciGuiGfx::Draw_Pattern(int16 x, int16 y, byte color, byte priority, byte c
|
||||
}
|
||||
}
|
||||
|
||||
void SciGuiGfx::Draw_String(const char *text) {
|
||||
GuiResourceId orgFontId = GetFontId();
|
||||
int16 orgPenColor = _curPort->penClr;
|
||||
|
||||
DrawText(text, 0, strlen(text), orgFontId, orgPenColor);
|
||||
SetFont(orgFontId);
|
||||
PenColor(orgPenColor);
|
||||
}
|
||||
|
||||
void SciGuiGfx::Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control) {
|
||||
Common::Stack<Common::Point> stack;
|
||||
Common::Point p, p1;
|
||||
|
@ -110,6 +110,7 @@ public:
|
||||
void Draw_Circle(Common::Rect box, byte size, byte color, byte prio, byte control);
|
||||
void Draw_TexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture);
|
||||
void Draw_Pattern(int16 x, int16 y, byte pic_color, byte pic_priority, byte pic_control, byte code, byte texture);
|
||||
void Draw_String(const char *text);
|
||||
void Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control);
|
||||
|
||||
void drawPicture(GuiResourceId pictureId, uint16 style, bool addToFlag, GuiResourceId paletteId);
|
||||
@ -129,6 +130,7 @@ public:
|
||||
void SetNowSeen(reg_t objectReference);
|
||||
|
||||
GuiPort *_menuPort;
|
||||
Common::Rect _menuRect;
|
||||
uint32 _sysTicks;
|
||||
int32 _sysSpeed; // ticker timer in ms
|
||||
GuiPalette _sysPalette;
|
||||
|
@ -487,6 +487,21 @@ void SciGui32::textColors(int argc, reg_t *argv) {
|
||||
// stub
|
||||
}
|
||||
|
||||
void SciGui32::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
|
||||
s->titlebar_port->_color.visual = get_pic_color(s, colorPen);
|
||||
s->titlebar_port->_color.mask = GFX_MASK_VISUAL;
|
||||
s->titlebar_port->_bgcolor.visual = get_pic_color(s, colorBack);
|
||||
s->titlebar_port->_bgcolor.mask = GFX_MASK_VISUAL;
|
||||
|
||||
s->status_bar_foreground = colorPen;
|
||||
s->status_bar_background = colorBack;
|
||||
s->_statusBarText = text;
|
||||
|
||||
sciw_set_status_bar(s, s->titlebar_port, s->_statusBarText, colorPen, colorBack);
|
||||
|
||||
gfxop_update(s->gfx_state);
|
||||
}
|
||||
|
||||
void SciGui32::drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo) {
|
||||
drawn_pic_t dp;
|
||||
gfx_color_t transparent = s->wm_port->_bgcolor;
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
void textFonts(int argc, reg_t *argv);
|
||||
void textColors(int argc, reg_t *argv);
|
||||
|
||||
void drawStatus(const char *text, int16 colorPen, int16 colorBack);
|
||||
void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo);
|
||||
void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo);
|
||||
void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse);
|
||||
|
Loading…
x
Reference in New Issue
Block a user