STARTREK: Reduce usage of SharedPtr

This commit is contained in:
Filippos Karapetis 2019-12-27 14:00:02 +02:00
parent 14a07a4871
commit 454149c49d
2 changed files with 9 additions and 9 deletions

View File

@ -477,7 +477,7 @@ public:
* Draw a line of text to a standard bitmap (NOT a "TextBitmap", whose pixel array is
* an array of characters, but an actual standard bitmap).
*/
void drawTextLineToBitmap(const char *text, int textLen, int x, int y, SharedPtr<Bitmap> bitmap);
void drawTextLineToBitmap(const char *text, int textLen, int x, int y, Bitmap *bitmap);
String centerTextboxHeader(String headerText);
void getTextboxHeader(String *headerTextOutput, String speakerText, int choiceIndex);
@ -549,8 +549,8 @@ private:
char _textInputBuffer[TEXT_INPUT_BUFFER_SIZE];
int16 _textInputCursorPos;
char _textInputCursorChar;
SharedPtr<Bitmap> _textInputBitmapSkeleton;
SharedPtr<Bitmap> _textInputBitmap;
Bitmap *_textInputBitmapSkeleton;
Bitmap *_textInputBitmap;
Sprite _textInputSprite;
// menu.cpp

View File

@ -80,7 +80,7 @@ const char *StarTrekEngine::getNextTextLine(const char *text, char *lineOutput,
return lastSpaceInput + 1;
}
void StarTrekEngine::drawTextLineToBitmap(const char *text, int textLen, int x, int y, SharedPtr<Bitmap> bitmap) {
void StarTrekEngine::drawTextLineToBitmap(const char *text, int textLen, int x, int y, Bitmap *bitmap) {
const int charWidth = 8;
int textOffset = 0;
@ -850,8 +850,8 @@ void StarTrekEngine::initTextInputSprite(int16 textboxX, int16 textboxY, const C
int16 width = headerLen * 8 + 8;
int16 height = row * 8 + 8;
_textInputBitmapSkeleton = SharedPtr<Bitmap>(new Bitmap(width, height));
_textInputBitmap = SharedPtr<Bitmap>(new Bitmap(width, height));
_textInputBitmapSkeleton = new Bitmap(width, height);
_textInputBitmap = new Bitmap(width, height);
_textInputBitmapSkeleton->xoffset = width / 2;
if (textboxX + width / 2 >= SCREEN_WIDTH)
@ -908,7 +908,7 @@ void StarTrekEngine::initTextInputSprite(int16 textboxX, int16 textboxY, const C
_gfx->addSprite(&_textInputSprite);
_textInputSprite.drawMode = 2;
_textInputSprite.field8 = "System";
_textInputSprite.bitmap = _textInputBitmap;
_textInputSprite.bitmap = SharedPtr<Bitmap>(_textInputBitmap);
_textInputSprite.setXYAndPriority(textboxX, textboxY, 15);
_textInputSprite.drawPriority2 = 8;
_gfx->drawAllSprites();
@ -920,8 +920,8 @@ void StarTrekEngine::cleanupTextInputSprite() {
_gfx->delSprite(&_textInputSprite);
_textInputSprite.bitmap.reset();
_textInputBitmapSkeleton.reset();
_textInputBitmap.reset();
delete _textInputBitmapSkeleton;
delete _textInputBitmap;
}
} // End of namespace StarTrek