- added DFrameBuffer::HasBegun2D to allow scripting to test if 2D drawing is active (instead of using IsLocked, which may return false when vid_hw2d is active)

This commit is contained in:
Magnus Norddahl 2017-03-29 00:45:53 +02:00
commit d160424aea
6 changed files with 14 additions and 10 deletions

View file

@ -116,7 +116,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawChar)
PARAM_FLOAT(y);
PARAM_INT(chr);
if (!screen->IsLocked()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
VMVa_List args = { param + 5, 0, numparam - 5 };
screen->DrawChar(font, cr, x, y, chr, args);
return 0;
@ -242,7 +242,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawText)
PARAM_FLOAT(y);
PARAM_STRING(chr);
if (!screen->IsLocked()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
VMVa_List args = { param + 5, 0, numparam - 5 };
const char *txt = chr[0] == '$' ? GStrings(&chr[1]) : chr.GetChars();
screen->DrawText(font, cr, x, y, txt, args);