aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/text32.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/text32.h')
-rw-r--r--engines/sci/graphics/text32.h43
1 files changed, 33 insertions, 10 deletions
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 20adb3d7c7..a61760dd87 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -23,15 +23,23 @@
#ifndef SCI_GRAPHICS_TEXT32_H
#define SCI_GRAPHICS_TEXT32_H
+#include "sci/engine/state.h"
#include "sci/graphics/celobj32.h"
#include "sci/graphics/frameout.h"
+#include "sci/graphics/helpers.h"
namespace Sci {
enum TextAlign {
- kTextAlignLeft = 0,
- kTextAlignCenter = 1,
- kTextAlignRight = 2
+ kTextAlignDefault = -1,
+ kTextAlignLeft = 0,
+ kTextAlignCenter = 1,
+ kTextAlignRight = 2
+};
+
+enum ScrollDirection {
+ kScrollUp,
+ kScrollDown
};
enum BitmapFlags {
@@ -53,6 +61,7 @@ inline void set##property(uint##size value) {\
class BitmapResource {
byte *_bitmap;
reg_t _object;
+ Buffer _buffer;
/**
* Gets the size of the bitmap header for the current
@@ -96,6 +105,8 @@ public:
if (_bitmap == nullptr || getUncompressedDataOffset() != getBitmapHeaderSize()) {
error("Invalid Text bitmap %04x:%04x", PRINT_REG(bitmap));
}
+
+ _buffer = Buffer(getWidth(), getHeight(), getPixels());
}
/**
@@ -103,7 +114,6 @@ public:
* segment manager.
*/
inline BitmapResource(SegManager *segMan, const int16 width, const int16 height, const uint8 skipColor, const int16 displaceX, const int16 displaceY, const int16 scaledWidth, const int16 scaledHeight, const uint32 hunkPaletteOffset, const bool remap) {
-
_object = segMan->allocateHunkEntry("Bitmap()", getBitmapSize(width, height));
_bitmap = segMan->getHunkPointer(_object);
@@ -124,12 +134,18 @@ public:
setControlOffset(0);
setScaledWidth(scaledWidth);
setScaledHeight(scaledHeight);
+
+ _buffer = Buffer(getWidth(), getHeight(), getPixels());
}
- reg_t getObject() const {
+ inline reg_t getObject() const {
return _object;
}
+ inline Buffer &getBuffer() {
+ return _buffer;
+ }
+
BITMAP_PROPERTY(16, Width, 0);
BITMAP_PROPERTY(16, Height, 2);
@@ -173,7 +189,7 @@ public:
return READ_SCI11ENDIAN_UINT32(_bitmap + 20);
}
- void setHunkPaletteOffset(uint32 hunkPaletteOffset) {
+ inline void setHunkPaletteOffset(uint32 hunkPaletteOffset) {
if (hunkPaletteOffset) {
hunkPaletteOffset += getBitmapHeaderSize();
}
@@ -351,15 +367,15 @@ public:
/**
* The size of the x-dimension of the coordinate system
- * used by the text renderer.
+ * used by the text renderer. Static since it was global in SSCI.
*/
- int16 _scaledWidth;
+ static int16 _scaledWidth;
/**
* The size of the y-dimension of the coordinate system
- * used by the text renderer.
+ * used by the text renderer. Static since it was global in SSCI.
*/
- int16 _scaledHeight;
+ static int16 _scaledHeight;
/**
* The currently active font resource used to write text
@@ -456,6 +472,13 @@ public:
* `textRect` using the given font.
*/
int16 getTextCount(const Common::String &text, const uint index, const GuiResourceId fontId, const Common::Rect &textRect, const bool doScaling);
+
+ /**
+ * Scroll up/down one line. `numLines` is the number of the lines in the
+ * textarea, and `textLine` contains the text to draw as the newly
+ * visible line. Originally FontMgr::DrawOneLine and FontMgr::UpOneLine.
+ */
+ void scrollLine(const Common::String &textLine, int numLines, uint8 color, TextAlign align, GuiResourceId fontId, ScrollDirection dir);
};
} // End of namespace Sci