This commit is contained in:
Pawel Kolodziejski 2009-04-07 12:15:12 +00:00
parent b3474c4f11
commit 324f978e2f
2 changed files with 10 additions and 18 deletions

View file

@ -2385,38 +2385,30 @@ static void KillTextObject() {
* in the table in the LUA parameter 2. * in the table in the LUA parameter 2.
*/ */
static void ChangeTextObject() { static void ChangeTextObject() {
TextObject *modifyObject, *textObject; TextObject *textObject;
lua_Object tableObj; lua_Object tableObj;
const char *line; const char *line;
DEBUG_FUNCTION(); DEBUG_FUNCTION();
textObject = check_textobject(1); textObject = check_textobject(1);
// when called in certain instances (such as don's computer)
// the second parameter is the string and the third is the table
if (lua_isstring(lua_getparam(2))) { if (lua_isstring(lua_getparam(2))) {
tableObj = lua_getparam(3); tableObj = lua_getparam(3);
} else } else
tableObj = lua_getparam(2); tableObj = lua_getparam(2);
modifyObject = TextObjectExists((char *)textObject->name()); textObject->destroyBitmap();
if (!modifyObject) {
if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
warning("ChangeTextObject(): Cannot find active text object");
return;
}
modifyObject->destroyBitmap();
if (lua_istable(tableObj)) if (lua_istable(tableObj))
getTextObjectParams(modifyObject, tableObj); getTextObjectParams(textObject, tableObj);
else if (lua_isstring(lua_getparam(2))) {
if (lua_isstring(lua_getparam(2))) {
line = lua_getstring(lua_getparam(2)); line = lua_getstring(lua_getparam(2));
modifyObject->setText((char *)line); textObject->setText((char *)line);
} }
modifyObject->createBitmap(); textObject->createBitmap();
lua_pushnumber(modifyObject->getBitmapWidth()); lua_pushnumber(textObject->getBitmapWidth());
lua_pushnumber(modifyObject->getBitmapHeight()); lua_pushnumber(textObject->getBitmapHeight());
} }
/* Return the "text speed", this option must be handled /* Return the "text speed", this option must be handled

View file

@ -156,7 +156,7 @@ void TextObject::createBitmap() {
} }
_textBitmap = new uint8[_font->getHeight() * (_bitmapWidthPtr[j] + 1)]; _textBitmap = new uint8[_font->getHeight() * (_bitmapWidthPtr[j] + 1)];
memset(_textBitmap, 0, _font->getHeight() * (_bitmapWidthPtr[j] + 1)); memset(_textBitmap, 0xff, _font->getHeight() * (_bitmapWidthPtr[j] + 1));
// Fill bitmap // Fill bitmap
int startOffset = 0; int startOffset = 0;