mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
NANCY: Make RenderObject non-abstract
Made RenderObject non-abstract so it can be used in some simple cases without the need for subclassing.
This commit is contained in:
parent
c9b2e4473d
commit
a29cdd43c0
@ -33,7 +33,7 @@ namespace Action {
|
||||
class LeverPuzzle : public ActionRecord, public RenderObject {
|
||||
public:
|
||||
enum SolveState { kNotSolved, kPlaySound, kWaitForSound };
|
||||
LeverPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
LeverPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom, 7) {}
|
||||
virtual ~LeverPuzzle() {}
|
||||
|
||||
virtual void init() override;
|
||||
@ -65,8 +65,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "LeverPuzzle"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 7; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
void drawLever(uint id);
|
||||
|
@ -33,7 +33,7 @@ namespace Action {
|
||||
class OrderingPuzzle : public ActionRecord, public RenderObject {
|
||||
public:
|
||||
enum SolveState { kNotSolved, kPlaySound, kWaitForSound };
|
||||
OrderingPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
OrderingPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom, 7) {}
|
||||
virtual ~OrderingPuzzle() {}
|
||||
|
||||
virtual void init() override;
|
||||
@ -65,8 +65,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "OrderingPuzzle"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 7; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
void drawElement(uint id);
|
||||
|
@ -33,7 +33,7 @@ namespace Action {
|
||||
class PasswordPuzzle : public ActionRecord, public RenderObject {
|
||||
public:
|
||||
enum SolveState { kNotSolved, kFailed, kSolved };
|
||||
PasswordPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
PasswordPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom, 7) {}
|
||||
virtual ~PasswordPuzzle() {}
|
||||
|
||||
virtual void init() override;
|
||||
@ -69,8 +69,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "PasswordPuzzle"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 7; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
void drawText();
|
||||
|
@ -70,7 +70,7 @@ struct FlagsStruct {
|
||||
};
|
||||
|
||||
public:
|
||||
PlayPrimaryVideoChan0(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
PlayPrimaryVideoChan0(RenderObject &redrawFrom) : RenderObject(redrawFrom, 8) {}
|
||||
virtual ~PlayPrimaryVideoChan0();
|
||||
|
||||
virtual void init() override;
|
||||
@ -111,8 +111,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "PlayPrimaryVideoChan0"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 8; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
};
|
||||
|
||||
|
@ -425,7 +425,7 @@ public:
|
||||
virtual void readData(Common::SeekableReadStream &stream) override;
|
||||
virtual void execute() override;
|
||||
|
||||
ShowInventoryItem(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
ShowInventoryItem(RenderObject &redrawFrom) : RenderObject(redrawFrom, 9) {}
|
||||
virtual ~ShowInventoryItem() { _fullSurface.free(); }
|
||||
|
||||
virtual void init() override;
|
||||
@ -440,8 +440,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "ShowInventoryItem"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 9; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
};
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace Action {
|
||||
class RotatingLockPuzzle : public ActionRecord, public RenderObject {
|
||||
public:
|
||||
enum SolveState { kNotSolved, kPlaySound, kWaitForSound };
|
||||
RotatingLockPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
RotatingLockPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom, 7) {}
|
||||
virtual ~RotatingLockPuzzle() {}
|
||||
|
||||
virtual void init() override;
|
||||
@ -67,8 +67,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "RotatingLockPuzzle"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 7; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
void drawDial(uint id);
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
EventFlagDescription flagDesc;
|
||||
};
|
||||
|
||||
PlaySecondaryMovie(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
PlaySecondaryMovie(RenderObject &redrawFrom) : RenderObject(redrawFrom, 8) {}
|
||||
virtual ~PlaySecondaryMovie();
|
||||
|
||||
virtual void init() override;
|
||||
@ -66,8 +66,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "PlaySecondaryMovie"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 8; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
AVFDecoder _decoder;
|
||||
|
@ -38,7 +38,7 @@ class PlaySecondaryVideo : public ActionRecord, public RenderObject {
|
||||
public:
|
||||
enum HoverState { kNoHover, kHover, kEndHover };
|
||||
|
||||
PlaySecondaryVideo(uint chan, RenderObject &redrawFrom) : RenderObject(redrawFrom), channel(chan) {}
|
||||
PlaySecondaryVideo(uint chan, RenderObject &redrawFrom) : RenderObject(redrawFrom, 8), channel(chan) {}
|
||||
virtual ~PlaySecondaryVideo() { _decoder.close(); }
|
||||
|
||||
virtual void init() override;
|
||||
@ -63,8 +63,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return Common::String::format("PlaySecondaryVideoChan%i", channel); }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 8; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
HoverState _hoverState = kNoHover;
|
||||
|
@ -38,7 +38,7 @@ namespace Action {
|
||||
class SliderPuzzle: public ActionRecord, public RenderObject {
|
||||
public:
|
||||
enum SolveState { kNotSolved, kWaitForSound };
|
||||
SliderPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
SliderPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom, 7) {}
|
||||
virtual ~SliderPuzzle() {}
|
||||
|
||||
virtual void init() override;
|
||||
@ -67,8 +67,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "SliderPuzzle"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 7; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
void drawTile(int tileID, uint posX, uint posY);
|
||||
|
@ -52,7 +52,7 @@ void PlayStaticBitmapAnimation::readData(Common::SeekableReadStream &stream) {
|
||||
_loopFirstFrame = stream.readUint16LE();
|
||||
_loopLastFrame = stream.readUint16LE();
|
||||
_frameTime = Common::Rational(1000, stream.readUint16LE()).toInt();
|
||||
_zOrder = stream.readUint16LE();
|
||||
_z = stream.readUint16LE();
|
||||
|
||||
if (_isInterruptible) {
|
||||
_interruptCondition.label = stream.readSint16LE();
|
||||
|
@ -37,7 +37,7 @@ namespace Action {
|
||||
// action record types, whose functionality is nearly identical
|
||||
class PlayStaticBitmapAnimation : public ActionRecord, public RenderObject {
|
||||
public:
|
||||
PlayStaticBitmapAnimation(bool interruptible, RenderObject &redrawFrom) : RenderObject(redrawFrom), _isInterruptible(interruptible) {}
|
||||
PlayStaticBitmapAnimation(bool interruptible, RenderObject &redrawFrom) : RenderObject(redrawFrom, 7), _isInterruptible(interruptible) {}
|
||||
virtual ~PlayStaticBitmapAnimation() { _fullSurface.free(); }
|
||||
|
||||
virtual void init() override;
|
||||
@ -56,7 +56,6 @@ public:
|
||||
uint16 _loopFirstFrame = 0; // 0x16
|
||||
uint16 _loopLastFrame = 0; // 0x18
|
||||
Time _frameTime;
|
||||
uint16 _zOrder = 0; // 0x1C
|
||||
EventFlagDescription _interruptCondition; // 0x1E
|
||||
SceneChangeDescription _sceneChange;
|
||||
MultiEventFlagDescription _triggerFlags; // 0x2A
|
||||
@ -76,8 +75,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return _isInterruptible ? "PlayIntStaticBitmapAnimation" : "PlayStaticBitmapAnimation"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return _zOrder; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
void setFrame(uint frame);
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
enum CallState { kWaiting, kButtonPress, kRinging, kBadNumber, kCall, kHangUp };
|
||||
|
||||
Telephone(RenderObject &redrawFrom) :
|
||||
RenderObject(redrawFrom),
|
||||
RenderObject(redrawFrom, 7),
|
||||
_callState(kWaiting),
|
||||
_selected(0) {}
|
||||
virtual ~Telephone() {}
|
||||
@ -83,8 +83,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "Telephone"; }
|
||||
|
||||
virtual uint16 getZOrder() const override { return 7; }
|
||||
virtual bool isViewportRelative() const override { return true; }
|
||||
|
||||
void drawButton(uint id);
|
||||
|
@ -28,6 +28,24 @@
|
||||
|
||||
namespace Nancy {
|
||||
|
||||
RenderObject::RenderObject(uint16 zOrder) :
|
||||
_needsRedraw(true),
|
||||
_isVisible(true),
|
||||
_redrawFrom(nullptr),
|
||||
_z(zOrder) {}
|
||||
|
||||
RenderObject::RenderObject(RenderObject &redrawFrom, uint16 zOrder) :
|
||||
_needsRedraw(true),
|
||||
_isVisible(true),
|
||||
_redrawFrom(&redrawFrom),
|
||||
_z(zOrder) {}
|
||||
|
||||
RenderObject::RenderObject(RenderObject &redrawFrom, uint16 zOrder, Graphics::ManagedSurface &surface, const Common::Rect &srcBounds, const Common::Rect &destBounds) :
|
||||
RenderObject(redrawFrom, zOrder) {
|
||||
_drawSurface.create(surface, srcBounds);
|
||||
_screenPosition = destBounds;
|
||||
}
|
||||
|
||||
void RenderObject::init() {
|
||||
_previousScreenPosition = _screenPosition;
|
||||
}
|
||||
|
@ -37,15 +37,9 @@ class GraphicsManager;
|
||||
class RenderObject {
|
||||
friend class GraphicsManager;
|
||||
public:
|
||||
RenderObject() :
|
||||
_needsRedraw(true),
|
||||
_isVisible(true),
|
||||
_redrawFrom(nullptr) {}
|
||||
|
||||
RenderObject(RenderObject &redrawFrom) :
|
||||
_needsRedraw(true),
|
||||
_isVisible(true),
|
||||
_redrawFrom(&redrawFrom) {}
|
||||
RenderObject(uint16 zOrder);
|
||||
RenderObject(RenderObject &redrawFrom, uint16 zOrder);
|
||||
RenderObject(RenderObject &redrawFrom, uint16 zOrder, Graphics::ManagedSurface &surface, const Common::Rect &srcBounds, const Common::Rect &destBounds);
|
||||
|
||||
virtual ~RenderObject();
|
||||
|
||||
@ -67,22 +61,23 @@ public:
|
||||
Common::Rect convertToScreen(const Common::Rect &rect) const;
|
||||
|
||||
Common::Rect getBounds() const { return Common::Rect(_drawSurface.w, _drawSurface.h); }
|
||||
Graphics::ManagedSurface &getDrawSurface() { return _drawSurface; }
|
||||
|
||||
Graphics::ManagedSurface _drawSurface;
|
||||
Common::Rect _screenPosition;
|
||||
|
||||
protected:
|
||||
// Z order and blit type are extracted directly from the corresponding
|
||||
// ZRenderStruct from the original engine
|
||||
virtual uint16 getZOrder() const = 0;
|
||||
uint16 getZOrder() const { return _z; }
|
||||
|
||||
// Needed for proper handling of objects inside the viewport
|
||||
virtual bool isViewportRelative() const { return false; }
|
||||
|
||||
RenderObject *_redrawFrom;
|
||||
|
||||
Graphics::ManagedSurface _drawSurface;
|
||||
Common::Rect _screenPosition;
|
||||
bool _needsRedraw;
|
||||
bool _isVisible;
|
||||
uint16 _z;
|
||||
Common::Rect _previousScreenPosition;
|
||||
};
|
||||
|
||||
|
@ -52,11 +52,8 @@ protected:
|
||||
class CreditsText : public RenderObject {
|
||||
friend class Credits;
|
||||
public:
|
||||
CreditsText(RenderObject &redrawFrom) : RenderObject(redrawFrom) {}
|
||||
CreditsText(RenderObject &redrawFrom) : RenderObject(redrawFrom, 1) {}
|
||||
virtual ~CreditsText() = default;
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 1; }
|
||||
};
|
||||
|
||||
State _state;
|
||||
|
@ -82,7 +82,7 @@ void Help::init() {
|
||||
buttonSrc.right = chunk->readUint16LE();
|
||||
buttonSrc.bottom = chunk->readUint16LE();
|
||||
|
||||
_button = new UI::Button(_image, _image.getDrawSurface(), buttonSrc, buttonDest);
|
||||
_button = new UI::Button(_image, 5, _image._drawSurface, buttonSrc, buttonDest);
|
||||
_button->init();
|
||||
|
||||
_state = kBegin;
|
||||
|
@ -93,7 +93,6 @@ void MainMenu::init() {
|
||||
}
|
||||
|
||||
_buttonDown.registerGraphics();
|
||||
_buttonDown._redrawFrom = &_background;
|
||||
|
||||
_state = kRun;
|
||||
}
|
||||
@ -117,7 +116,7 @@ void MainMenu::run() {
|
||||
_selected = i;
|
||||
_state = kStop;
|
||||
|
||||
_buttonDown._drawSurface.create(_background.getDrawSurface(), _srcRects[i]);
|
||||
_buttonDown._drawSurface.create(_background._drawSurface, _srcRects[i]);
|
||||
_buttonDown._screenPosition = _destRects[i];
|
||||
_buttonDown.setVisible(true);
|
||||
|
||||
|
@ -35,24 +35,13 @@ namespace State {
|
||||
class MainMenu : public State, public Common::Singleton<MainMenu> {
|
||||
friend class MainMenuButton;
|
||||
public:
|
||||
MainMenu() : _state(kInit), _selected(-1), _playedOKSound(false) {}
|
||||
MainMenu() : _state(kInit), _selected(-1), _playedOKSound(false), _buttonDown(_background, 5) {}
|
||||
|
||||
// State API
|
||||
virtual void process() override;
|
||||
virtual void onStateExit() override;
|
||||
|
||||
private:
|
||||
// This is not a UI::Button subclass since the cursor doesn't change on hover
|
||||
class ButtonDownLabel : public RenderObject {
|
||||
friend class MainMenu;
|
||||
public:
|
||||
ButtonDownLabel() {}
|
||||
virtual ~ButtonDownLabel() override {}
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 5; }
|
||||
};
|
||||
|
||||
void init();
|
||||
void run();
|
||||
void stop();
|
||||
@ -60,7 +49,7 @@ private:
|
||||
enum State { kInit, kRun, kStop };
|
||||
|
||||
UI::FullScreenImage _background;
|
||||
ButtonDownLabel _buttonDown;
|
||||
RenderObject _buttonDown;
|
||||
State _state;
|
||||
int16 _selected;
|
||||
bool _playedOKSound;
|
||||
|
@ -44,7 +44,7 @@ Map::Map() : _state(kInit),
|
||||
_mapButtonClicked(false),
|
||||
_pickedLocationID(-1),
|
||||
_viewport(),
|
||||
_label(NancySceneState.getFrame(), this),
|
||||
_label(NancySceneState.getFrame(), 7),
|
||||
_button(nullptr) {}
|
||||
|
||||
Map::~Map() {
|
||||
@ -68,12 +68,14 @@ void Map::init() {
|
||||
_viewport.init();
|
||||
_label.init();
|
||||
|
||||
setLabel(-1);
|
||||
|
||||
Common::Rect buttonSrc, buttonDest;
|
||||
chunk->seek(0x7A, SEEK_SET);
|
||||
readRect(*chunk, buttonSrc);
|
||||
readRect(*chunk, buttonDest);
|
||||
|
||||
_button = new UI::Button(NancySceneState.getFrame(), g_nancy->_graphicsManager->_object0, buttonSrc, buttonDest);
|
||||
_button = new UI::Button(NancySceneState.getFrame(), 9, g_nancy->_graphicsManager->_object0, buttonSrc, buttonDest);
|
||||
_button->init();
|
||||
_button->setVisible(true);
|
||||
|
||||
@ -145,7 +147,7 @@ void Map::run() {
|
||||
|
||||
NancyInput input = g_nancy->_input->getInput();
|
||||
|
||||
_label.setLabel(-1);
|
||||
setLabel(-1);
|
||||
|
||||
_button->handleInput(input);
|
||||
|
||||
@ -160,7 +162,7 @@ void Map::run() {
|
||||
if (loc.isActive && _viewport.convertToScreen(loc.hotspot).contains(input.mousePos)) {
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kHotspotArrow);
|
||||
|
||||
_label.setLabel(i);
|
||||
setLabel(i);
|
||||
|
||||
if (input.input & NancyInput::kLeftMouseButtonUp) {
|
||||
_pickedLocationID = i;
|
||||
@ -197,19 +199,13 @@ void Map::registerGraphics() {
|
||||
_button->registerGraphics();
|
||||
}
|
||||
|
||||
void Map::MapLabel::init() {
|
||||
setLabel(-1);
|
||||
|
||||
RenderObject::init();
|
||||
}
|
||||
|
||||
void Map::MapLabel::setLabel(int labelID) {
|
||||
void Map::setLabel(int labelID) {
|
||||
if (labelID == -1) {
|
||||
setVisible(false);
|
||||
_label.setVisible(false);
|
||||
} else {
|
||||
_screenPosition = _parent->_locations[labelID].labelDest;
|
||||
_drawSurface.create(g_nancy->_graphicsManager->_object0, _parent->_locations[labelID].labelSrc);
|
||||
setVisible(true);
|
||||
_label._screenPosition = _locations[labelID].labelDest;
|
||||
_label._drawSurface.create(g_nancy->_graphicsManager->_object0, _locations[labelID].labelSrc);
|
||||
_label.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,28 +67,15 @@ private:
|
||||
Common::Rect labelDest;
|
||||
};
|
||||
|
||||
class MapLabel : public Nancy::RenderObject {
|
||||
public:
|
||||
MapLabel(RenderObject &redrawFrom, Map *parent) : Nancy::RenderObject(redrawFrom), _parent(parent) {}
|
||||
virtual ~MapLabel() = default;
|
||||
|
||||
virtual void init() override;
|
||||
|
||||
void setLabel(int labelID);
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 7; }
|
||||
|
||||
Map *_parent;
|
||||
};
|
||||
|
||||
void init();
|
||||
void run();
|
||||
|
||||
void registerGraphics();
|
||||
|
||||
void setLabel(int labelID);
|
||||
|
||||
Nancy::UI::Viewport _viewport;
|
||||
MapLabel _label;
|
||||
RenderObject _label;
|
||||
UI::Button *_button;
|
||||
SoundDescription _sound;
|
||||
|
||||
|
@ -627,8 +627,8 @@ void Scene::initStaticData() {
|
||||
readRect(*chunk, helpSrc);
|
||||
readRect(*chunk, menuDest);
|
||||
readRect(*chunk, helpDest);
|
||||
_menuButton = new UI::Button(_frame, g_nancy->_graphicsManager->_object0, menuSrc, menuDest);
|
||||
_helpButton = new UI::Button(_frame, g_nancy->_graphicsManager->_object0, helpSrc, helpDest);
|
||||
_menuButton = new UI::Button(_frame, 5, g_nancy->_graphicsManager->_object0, menuSrc, menuDest);
|
||||
_helpButton = new UI::Button(_frame, 5, g_nancy->_graphicsManager->_object0, helpSrc, helpDest);
|
||||
_menuButton->init();
|
||||
_helpButton->init();
|
||||
g_nancy->_cursorManager->showCursor(true);
|
||||
|
@ -34,11 +34,9 @@
|
||||
namespace Nancy {
|
||||
namespace UI {
|
||||
|
||||
Button::Button(RenderObject &redrawFrom, Graphics::ManagedSurface &surface, const Common::Rect &srcBounds, const Common::Rect &destBounds) :
|
||||
RenderObject(redrawFrom),
|
||||
Button::Button(RenderObject &redrawFrom, uint16 zOrder, Graphics::ManagedSurface &surface, const Common::Rect &srcBounds, const Common::Rect &destBounds) :
|
||||
RenderObject(redrawFrom, zOrder, surface, srcBounds, destBounds),
|
||||
_isClicked(false) {
|
||||
_drawSurface.create(surface, srcBounds);
|
||||
_screenPosition = destBounds;
|
||||
setVisible(false);
|
||||
setTransparent(true);
|
||||
}
|
||||
|
@ -33,15 +33,12 @@ namespace UI {
|
||||
|
||||
class Button : public RenderObject {
|
||||
public:
|
||||
Button(RenderObject &redrawFrom, Graphics::ManagedSurface &surface, const Common::Rect &srcBounds, const Common::Rect &destBounds);
|
||||
Button(RenderObject &redrawFrom, uint16 zOrder, Graphics::ManagedSurface &surface, const Common::Rect &srcBounds, const Common::Rect &destBounds);
|
||||
virtual ~Button() = default;
|
||||
|
||||
void handleInput(NancyInput &input);
|
||||
|
||||
bool _isClicked;
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 5; }
|
||||
};
|
||||
|
||||
} // End of namespace UI
|
||||
|
@ -30,14 +30,13 @@ namespace UI {
|
||||
|
||||
class FullScreenImage : public RenderObject {
|
||||
public:
|
||||
FullScreenImage() : RenderObject() {}
|
||||
FullScreenImage() : RenderObject(0) {}
|
||||
virtual ~FullScreenImage() = default;
|
||||
|
||||
void init(const Common::String &imageName);
|
||||
|
||||
protected:
|
||||
virtual void init() override {}
|
||||
virtual uint16 getZOrder() const override { return 0; }
|
||||
};
|
||||
|
||||
} // End of namespace UI
|
||||
|
@ -38,7 +38,7 @@ namespace Nancy {
|
||||
namespace UI {
|
||||
|
||||
InventoryBox::InventoryBox(RenderObject &redrawFrom) :
|
||||
RenderObject(redrawFrom),
|
||||
RenderObject(redrawFrom, 6),
|
||||
_scrollbar(nullptr),
|
||||
_shades(*this, this),
|
||||
_scrollbarPos(0),
|
||||
@ -106,7 +106,7 @@ void InventoryBox::init() {
|
||||
|
||||
RenderObject::init();
|
||||
|
||||
_scrollbar = new Scrollbar(NancySceneState.getFrame(), scrollbarSrcBounds, scrollbarDefaultPos, scrollbarMaxScroll - scrollbarDefaultPos.y);
|
||||
_scrollbar = new Scrollbar(NancySceneState.getFrame(), 9, scrollbarSrcBounds, scrollbarDefaultPos, scrollbarMaxScroll - scrollbarDefaultPos.y);
|
||||
_scrollbar->init();
|
||||
_shades.init();
|
||||
}
|
||||
|
@ -66,9 +66,6 @@ public:
|
||||
|
||||
ItemDescription getItemDescription(uint id) const { return _itemDescriptions[id]; }
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 6; }
|
||||
|
||||
void onScrollbarMove();
|
||||
|
||||
private:
|
||||
@ -78,7 +75,7 @@ private:
|
||||
class Shades : public RenderObject {
|
||||
public:
|
||||
Shades(RenderObject &redrawFrom, InventoryBox *parent) :
|
||||
RenderObject(redrawFrom),
|
||||
RenderObject(redrawFrom, 9),
|
||||
_parent(parent),
|
||||
_soundTriggered(false),
|
||||
_areOpen(false),
|
||||
@ -90,9 +87,6 @@ private:
|
||||
|
||||
void setOpen(bool open) { _areOpen = open; }
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 9; }
|
||||
|
||||
void setAnimationFrame(uint frame);
|
||||
|
||||
InventoryBox *_parent;
|
||||
|
@ -30,8 +30,8 @@
|
||||
namespace Nancy {
|
||||
namespace UI {
|
||||
|
||||
Scrollbar::Scrollbar(RenderObject &redrawFrom, const Common::Rect &srcBounds, const Common::Point &topPosition, uint16 scrollDistance, bool isVertical) :
|
||||
RenderObject(redrawFrom),
|
||||
Scrollbar::Scrollbar(RenderObject &redrawFrom, uint16 zOrder, const Common::Rect &srcBounds, const Common::Point &topPosition, uint16 scrollDistance, bool isVertical) :
|
||||
RenderObject(redrawFrom, zOrder),
|
||||
_isVertical(isVertical),
|
||||
_isClicked(false),
|
||||
_currentPosition(0),
|
||||
|
@ -33,7 +33,7 @@ namespace UI {
|
||||
|
||||
class Scrollbar : public RenderObject {
|
||||
public:
|
||||
Scrollbar(RenderObject &redrawFrom, const Common::Rect &srcBounds, const Common::Point &topPosition, uint16 scrollDistance, bool isVertical = true);
|
||||
Scrollbar(RenderObject &redrawFrom, uint16 zOrder, const Common::Rect &srcBounds, const Common::Point &topPosition, uint16 scrollDistance, bool isVertical = true);
|
||||
virtual ~Scrollbar() = default;
|
||||
|
||||
virtual void init() override;
|
||||
@ -43,9 +43,6 @@ public:
|
||||
void resetPosition();
|
||||
float getPos() const { return _currentPosition; }
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 9; }
|
||||
|
||||
void calculatePosition();
|
||||
|
||||
Common::Point _startPosition;
|
||||
|
@ -44,7 +44,7 @@ const char Textbox::_tabToken[] = "<t>";
|
||||
const char Textbox::_telephoneEndToken[] = "<e>";
|
||||
|
||||
Textbox::Textbox(RenderObject &redrawFrom) :
|
||||
RenderObject(redrawFrom),
|
||||
RenderObject(redrawFrom, 6),
|
||||
_firstLineOffset(0),
|
||||
_lineHeight(0),
|
||||
_borderWidth(0),
|
||||
@ -91,7 +91,7 @@ void Textbox::init() {
|
||||
|
||||
RenderObject::init();
|
||||
|
||||
_scrollbar = new Scrollbar(NancySceneState.getFrame(), scrollbarSrcBounds, scrollbarDefaultPos, scrollbarMaxScroll - scrollbarDefaultPos.y);
|
||||
_scrollbar = new Scrollbar(NancySceneState.getFrame(), 9, scrollbarSrcBounds, scrollbarDefaultPos, scrollbarMaxScroll - scrollbarDefaultPos.y);
|
||||
_scrollbar->init();
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,6 @@ public:
|
||||
|
||||
static void assembleTextLine(char *rawCaption, Common::String &output, uint size);
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 6; }
|
||||
|
||||
private:
|
||||
uint16 getInnerHeight() const;
|
||||
void onScrollbarMove();
|
||||
|
@ -42,7 +42,7 @@ namespace UI {
|
||||
class Viewport : public Nancy::RenderObject {
|
||||
public:
|
||||
Viewport() :
|
||||
RenderObject(),
|
||||
RenderObject(6),
|
||||
_movementLastFrame(0),
|
||||
_edgesMask(0),
|
||||
_currentFrame(0),
|
||||
@ -78,9 +78,6 @@ public:
|
||||
void disableEdges(byte edges);
|
||||
void enableEdges(byte edges);
|
||||
|
||||
protected:
|
||||
virtual uint16 getZOrder() const override { return 6; }
|
||||
|
||||
Common::Rect _upHotspot;
|
||||
Common::Rect _downHotspot;
|
||||
Common::Rect _leftHotspot;
|
||||
|
Loading…
Reference in New Issue
Block a user