DIRECTOR: LINGO: Implement the rect of the stage

The rect of stage returns the values of the stage rect.
This commit is contained in:
Roland van Laar 2022-04-03 12:05:30 +02:00
parent db006fac21
commit c342819a60
3 changed files with 17 additions and 0 deletions

View File

@ -480,6 +480,7 @@ bool Window::hasField(int field) {
case kTheDrawRect:
case kTheFileName:
case kTheModal:
case kTheRect:
case kTheSourceRect:
case kTheTitle:
case kTheTitleVisible:
@ -502,6 +503,9 @@ Datum Window::getField(int field) {
return isVisible();
case kTheWindowType:
return getWindowType();
case kTheRect:
return getStageRect();
default:
warning("Window::getField: unhandled field '%s'", g_lingo->field2str(field));
return Datum();

View File

@ -189,6 +189,18 @@ void Window::setStageColor(uint32 stageColor, bool forceReset) {
}
}
Datum Window::getStageRect() {
Graphics::ManagedSurface *surface = getSurface();
Datum d;
d.type = RECT;
d.u.farr = new FArray;
d.u.farr->arr.push_back(0);
d.u.farr->arr.push_back(0);
d.u.farr->arr.push_back(surface->w);
d.u.farr->arr.push_back(surface->h);
return d;
}
void Window::reset() {
resize(_composeSurface->w, _composeSurface->h, true);
_composeSurface->clear(_stageColor);

View File

@ -123,6 +123,7 @@ public:
int getWindowType() const { return _windowType; }
void setTitleVisible(bool titleVisible) { _titleVisible = titleVisible; updateBorderType(); };
bool isTitleVisible() { return _titleVisible; };
Datum getStageRect();
void updateBorderType();