[Scummvm-cvs-logs] scummvm master -> 48ad18d2664f83271613191351b7b92d06fd5cf0
somaen
einarjohants at gmail.com
Mon Sep 30 11:24:57 CEST 2013
This automated email contains information about 22 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
efc4284b42 WINTERMUTE: Keep _alphaMode private in TransparentSurface
6e21111847 WINTERMUTE: Make *_entity private in UIEntity
38369687fe WINTERMUTE: Make TextAlign private in UIText
b033850e8a WINTERMUTE: Keep attributes in UIWindow private
2e457d96e8 WINTERMUTE: Make some members of UIObject private
aafe8c1f0d WINTERMUTE: Add getListener()
252e0c17ec WINTERMUTE: Make _parentNotify private in UIObject
91ebad46d3 WINTERMUTE: Keep _back private in UIObject
1361fcde7c WINTERMUTE: Avoid feeding setWidth negative values
b22eaaa98a WINTERMUTE: Keep attributes private in UIEdit
59f4a9e7ac WINTERMUTE: Keep some attributes private in UIButton
1869481767 WINTERMUTE: Setters/getters for UIButton
417bf3db02 WINTERMUTE: Make sprites private in UIButton
2a977dec8c WINTERMUTE: add UIButton::setTextAlign
5b8a6885c6 WINTERMUTE: s/put/set/ in setters
1023ac4b33 WINTERMUTE: const'ify getters
f7a9e921ae WINTERMUTE: Formatting
5afb297e39 WINTERMUTE: Constify some getters in TransparentSurface, UIObject and UIWindow
15d98724d8 WINTERMUTE: Formatting (Clean up extra whitespace in UIObject).
12e7cb401f WINTERMUTE: Formatting with Astyle (UIButton, UIEdit, UIObject, UIWindow, TransparentSurface)
ccd3258bdc WINTERMUTE: Use ; and not , to separate delete and new.
48ad18d266 Merge branch 'refac'
Commit: efc4284b42678ebc55d901902dc7db20c7aa2ff6
https://github.com/scummvm/scummvm/commit/efc4284b42678ebc55d901902dc7db20c7aa2ff6
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:06-07:00
Commit Message:
WINTERMUTE: Keep _alphaMode private in TransparentSurface
Changed paths:
engines/wintermute/base/gfx/osystem/render_ticket.cpp
engines/wintermute/graphics/transparent_surface.cpp
engines/wintermute/graphics/transparent_surface.h
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
index b1720c1..a1538e9 100644
--- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp
+++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
@@ -107,9 +107,9 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) const {
if (_owner) {
if (_transform._alphaDisable) {
- src._alphaMode = TransparentSurface::ALPHA_OPAQUE;
+ src.setAlphaMode(TransparentSurface::ALPHA_OPAQUE);
} else {
- src._alphaMode = _owner->getAlphaType();
+ src.setAlphaMode(_owner->getAlphaType());
}
}
src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _transform._flip, &clipRect, _transform._rgbaMod, clipRect.width(), clipRect.height());
@@ -127,9 +127,9 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect
if (_owner) {
if (_transform._alphaDisable) {
- src._alphaMode = TransparentSurface::ALPHA_OPAQUE;
+ src.setAlphaMode(TransparentSurface::ALPHA_OPAQUE);
} else {
- src._alphaMode = _owner->getAlphaType();
+ src.setAlphaMode(_owner->getAlphaType());
}
}
src.blit(*_targetSurface, dstRect->left, dstRect->top, _transform._flip, clipRect, _transform._rgbaMod, clipRect->width(), clipRect->height());
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index cd20035..200cffb 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -612,4 +612,11 @@ void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool
}
}
+TransparentSurface::AlphaType TransparentSurface::getAlphaMode() {
+ return _alphaMode;
+}
+
+void TransparentSurface::setAlphaMode(TransparentSurface::AlphaType mode) {
+ _alphaMode = mode;
+}
} // End of namespace Wintermute
diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h
index 598aaa5..fe5dc08 100644
--- a/engines/wintermute/graphics/transparent_surface.h
+++ b/engines/wintermute/graphics/transparent_surface.h
@@ -81,8 +81,6 @@ struct TransparentSurface : public Graphics::Surface {
ALPHA_FULL = 2
};
- AlphaType _alphaMode;
-
/**
@brief renders the surface to another surface
@param pDest a pointer to the target image. In most cases this is the framebuffer.
@@ -120,6 +118,11 @@ struct TransparentSurface : public Graphics::Surface {
TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const;
TransparentSurface *rotoscale(const TransformStruct &transform) const;
+ AlphaType getAlphaMode();
+ void setAlphaMode(AlphaType);
+private:
+ AlphaType _alphaMode;
+
};
/**
@@ -134,7 +137,6 @@ struct TransparentSurface : public Graphics::Surface {
}
};*/
-
} // End of namespace Wintermute
Commit: 6e211118470f65173515a54ad72642101c6d6e2b
https://github.com/scummvm/scummvm/commit/6e211118470f65173515a54ad72642101c6d6e2b
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:08-07:00
Commit Message:
WINTERMUTE: Make *_entity private in UIEntity
Changed paths:
engines/wintermute/ui/ui_entity.h
diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h
index 1b6e8a1..e155ca2 100644
--- a/engines/wintermute/ui/ui_entity.h
+++ b/engines/wintermute/ui/ui_entity.h
@@ -44,7 +44,6 @@ public:
virtual bool display() override { return display(0, 0); }
virtual bool display(int offsetX, int offsetY) override;
- AdEntity *_entity;
bool setEntity(const char *filename);
// scripting interface
@@ -52,6 +51,9 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value) override;
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
+
+private:
+ AdEntity *_entity;
};
} // End of namespace Wintermute
Commit: 38369687fe3c0876f7f428fc8eee0b37c9f45579
https://github.com/scummvm/scummvm/commit/38369687fe3c0876f7f428fc8eee0b37c9f45579
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:10-07:00
Commit Message:
WINTERMUTE: Make TextAlign private in UIText
Changed paths:
engines/wintermute/ui/ui_text.h
diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h
index 29ed62a..4470367 100644
--- a/engines/wintermute/ui/ui_text.h
+++ b/engines/wintermute/ui/ui_text.h
@@ -37,13 +37,13 @@ namespace Wintermute {
class UIText : public UIObject {
private:
bool sizeToFit();
+ TTextAlign _textAlign;
+ TVerticalAlign _verticalAlign;
public:
virtual bool display(int offsetX, int offsetY);
DECLARE_PERSISTENT(UIText, UIObject)
UIText(BaseGame *inGame = nullptr);
virtual ~UIText();
- TTextAlign _textAlign;
- TVerticalAlign _verticalAlign;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
Commit: b033850e8a07595dee479a37d50e87a828be356c
https://github.com/scummvm/scummvm/commit/b033850e8a07595dee479a37d50e87a828be356c
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:12-07:00
Commit Message:
WINTERMUTE: Keep attributes in UIWindow private
Changed paths:
engines/wintermute/base/base_game.cpp
engines/wintermute/ui/ui_window.cpp
engines/wintermute/ui/ui_window.h
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index b2c05d2..62ce64b 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -3031,7 +3031,7 @@ bool BaseGame::displayWindows(bool inGame) {
// display all windows
for (uint32 i = 0; i < _windows.size(); i++) {
- if (_windows[i]->_visible && _windows[i]->_inGame == inGame) {
+ if (_windows[i]->_visible && _windows[i]->getInGame() == inGame) {
res = _windows[i]->display();
if (DID_FAIL(res)) {
@@ -3131,7 +3131,7 @@ bool BaseGame::focusWindow(UIWindow *window) {
_gameRef->_focusedWindow = window;
}
- if (window->_mode == WINDOW_NORMAL && prev != window && _gameRef->validObject(prev) && (prev->_mode == WINDOW_EXCLUSIVE || prev->_mode == WINDOW_SYSTEM_EXCLUSIVE)) {
+ if (window->getMode() == WINDOW_NORMAL && prev != window && _gameRef->validObject(prev) && (prev->getMode() == WINDOW_EXCLUSIVE || prev->getMode() == WINDOW_SYSTEM_EXCLUSIVE)) {
return focusWindow(prev);
} else {
return STATUS_OK;
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
index 9066ee9..e8acd11 100644
--- a/engines/wintermute/ui/ui_window.cpp
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -1442,4 +1442,14 @@ bool UIWindow::getWindowObjects(BaseArray<UIObject *> &objects, bool interactive
return STATUS_OK;
}
+bool UIWindow::getInGame() {
+ return _inGame;
+}
+
+TWindowMode UIWindow::getMode() {
+ return _mode;
+}
+
+
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h
index 8a726fd..9175e3c 100644
--- a/engines/wintermute/ui/ui_window.h
+++ b/engines/wintermute/ui/ui_window.h
@@ -38,47 +38,32 @@ namespace Wintermute {
class UIButton;
class BaseViewport;
class UIWindow : public UIObject {
- uint32 _fadeColor;
public:
bool getWindowObjects(BaseArray<UIObject *> &Objects, bool InteractiveOnly);
- bool _pauseMusic;
void cleanup();
virtual void makeFreezable(bool freezable);
- BaseViewport *_viewport;
- bool _clipContents;
- bool _inGame;
- bool _isMenu;
- bool _fadeBackground;
virtual bool handleMouseWheel(int delta);
- UIWindow *_shieldWindow;
- UIButton *_shieldButton;
+
bool close();
bool goSystemExclusive();
bool goExclusive();
- TWindowMode _mode;
bool moveFocus(bool forward = true);
virtual bool handleMouse(TMouseEvent Event, TMouseButton Button);
- Point32 _dragFrom;
- bool _dragging;
DECLARE_PERSISTENT(UIWindow, UIObject)
- bool _transparent;
bool showWidget(const char *name, bool visible = true);
bool enableWidget(const char *name, bool enable = true);
- Rect32 _titleRect;
- Rect32 _dragRect;
+
virtual bool display(int offsetX = 0, int offsetY = 0) override;
UIWindow(BaseGame *inGame);
virtual ~UIWindow();
virtual bool handleKeypress(Common::Event *event, bool printable = false) override;
BaseArray<UIObject *> _widgets;
- TTextAlign _titleAlign;
+
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
- UITiledImage *_backInactive;
- BaseFont *_fontInactive;
- BaseSprite *_imageInactive;
+
virtual bool listen(BaseScriptHolder *param1, uint32 param2);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
@@ -87,6 +72,30 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value) override;
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString();
+
+ bool getInGame();
+ TWindowMode getMode();
+
+private:
+ bool _pauseMusic;
+ BaseViewport *_viewport;
+ bool _clipContents;
+ bool _inGame;
+ bool _isMenu;
+ bool _fadeBackground;
+ TWindowMode _mode;
+ Point32 _dragFrom;
+ bool _dragging;
+ bool _transparent;
+ uint32 _fadeColor;
+ UIWindow *_shieldWindow;
+ UIButton *_shieldButton;
+ Rect32 _titleRect;
+ Rect32 _dragRect;
+ UITiledImage *_backInactive;
+ BaseFont *_fontInactive;
+ BaseSprite *_imageInactive;
+ TTextAlign _titleAlign;
};
} // End of namespace Wintermute
Commit: 2e457d96e8095020bce006fd633382bde6c6ae26
https://github.com/scummvm/scummvm/commit/2e457d96e8095020bce006fd633382bde6c6ae26
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:16-07:00
Commit Message:
WINTERMUTE: Make some members of UIObject private
Changed paths:
engines/wintermute/ad/ad_inventory_box.cpp
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ad/ad_scene.cpp
engines/wintermute/base/base_game.cpp
engines/wintermute/ui/ui_object.cpp
engines/wintermute/ui/ui_object.h
engines/wintermute/ui/ui_window.cpp
diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp
index d703de1..681d731 100644
--- a/engines/wintermute/ad/ad_inventory_box.cpp
+++ b/engines/wintermute/ad/ad_inventory_box.cpp
@@ -120,8 +120,8 @@ bool AdInventoryBox::display() {
if (_closeButton) {
_closeButton->_posX = _closeButton->_posY = 0;
- _closeButton->_width = _gameRef->_renderer->getWidth();
- _closeButton->_height = _gameRef->_renderer->getHeight();
+ _closeButton->setWidth(_gameRef->_renderer->getWidth());
+ _closeButton->setHeight(_gameRef->_renderer->getHeight());
_closeButton->display();
}
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 9d7c17a..24eaa77 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -121,12 +121,12 @@ void AdResponseBox::clearButtons() {
//////////////////////////////////////////////////////////////////////////
bool AdResponseBox::invalidateButtons() {
for (uint32 i = 0; i < _respButtons.size(); i++) {
- _respButtons[i]->_image = nullptr;
+ _respButtons[i]->putImage(nullptr);
+ _respButtons[i]->putFont(nullptr);
+ _respButtons[i]->setText("");
_respButtons[i]->_cursor = nullptr;
- _respButtons[i]->_font = nullptr;
_respButtons[i]->_fontHover = nullptr;
_respButtons[i]->_fontPress = nullptr;
- _respButtons[i]->setText("");
}
return STATUS_OK;
}
@@ -141,11 +141,12 @@ bool AdResponseBox::createButtons() {
UIButton *btn = new UIButton(_gameRef);
if (btn) {
btn->_parent = _window;
- btn->_sharedFonts = btn->_sharedImages = true;
+ btn->setSharedFonts(true);
+ btn->setSharedImages(true);
btn->_sharedCursors = true;
// iconic
if (_responses[i]->getIcon()) {
- btn->_image = _responses[i]->getIcon();
+ btn->putImage(_responses[i]->getIcon());
if (_responses[i]->getIconHover()) {
btn->_imageHover = _responses[i]->getIconHover();
}
@@ -163,23 +164,28 @@ bool AdResponseBox::createButtons() {
// textual
else {
btn->setText(_responses[i]->getText());
- btn->_font = (_font == nullptr) ? _gameRef->getSystemFont() : _font;
+ if (_font == nullptr) {
+ btn->putFont(_gameRef->getSystemFont());
+ } else {
+ btn->putFont(_font);
+ }
btn->_fontHover = (_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover;
btn->_fontPress = btn->_fontHover;
btn->_align = _align;
if (_gameRef->_touchInterface) {
- btn->_fontHover = btn->_font;
+ btn->_fontHover = btn->getFont();
}
if (_responses[i]->getFont()) {
- btn->_font = _responses[i]->getFont();
+ btn->putFont(_responses[i]->getFont());
}
- btn->_width = _responseArea.right - _responseArea.left;
- if (btn->_width <= 0) {
- btn->_width = _gameRef->_renderer->getWidth();
+ btn->setWidth(_responseArea.right - _responseArea.left);
+ if (btn->getWidth() <= 0) {
+ // TODO: This is not very pretty. Should do it at setWidth level, heh?
+ btn->setWidth(_gameRef->_renderer->getWidth());
}
}
btn->setName("response");
@@ -187,17 +193,17 @@ bool AdResponseBox::createButtons() {
// make the responses touchable
if (_gameRef->_touchInterface) {
- btn->_height = MAX<int32>(btn->_height, 50);
+ btn->setHeight(MAX<int32>(btn->getHeight(), 50));
}
//btn->SetListener(this, btn, _responses[i]->_iD);
btn->setListener(this, btn, i);
- btn->_visible = false;
+ btn->setVisible(false);
_respButtons.add(btn);
- if (_responseArea.bottom - _responseArea.top < btn->_height) {
+ if (_responseArea.bottom - _responseArea.top < btn->getHeight()) {
_gameRef->LOG(0, "Warning: Response '%s' is too high to be displayed within response box. Correcting.", _responses[i]->getText());
- _responseArea.bottom += (btn->_height - (_responseArea.bottom - _responseArea.top));
+ _responseArea.bottom += (btn->getHeight() - (_responseArea.bottom - _responseArea.top));
}
}
}
@@ -461,7 +467,7 @@ bool AdResponseBox::display() {
if (!_horizontal) {
int totalHeight = 0;
for (i = 0; i < _respButtons.size(); i++) {
- totalHeight += (_respButtons[i]->_height + _spacing);
+ totalHeight += (_respButtons[i]->getHeight() + _spacing);
}
totalHeight -= _spacing;
@@ -487,22 +493,22 @@ bool AdResponseBox::display() {
// prepare response buttons
bool scrollNeeded = false;
for (i = _scrollOffset; i < _respButtons.size(); i++) {
- if ((_horizontal && xxx + _respButtons[i]->_width > rect.right)
- || (!_horizontal && yyy + _respButtons[i]->_height > rect.bottom)) {
+ if ((_horizontal && xxx + _respButtons[i]->getWidth() > rect.right)
+ || (!_horizontal && yyy + _respButtons[i]->getHeight() > rect.bottom)) {
scrollNeeded = true;
- _respButtons[i]->_visible = false;
+ _respButtons[i]->setVisible(false);
break;
}
- _respButtons[i]->_visible = true;
+ _respButtons[i]->setVisible(true);
_respButtons[i]->_posX = xxx;
_respButtons[i]->_posY = yyy;
if (_horizontal) {
- xxx += (_respButtons[i]->_width + _spacing);
+ xxx += (_respButtons[i]->getWidth() + _spacing);
} else {
- yyy += (_respButtons[i]->_height + _spacing);
+ yyy += (_respButtons[i]->getHeight() + _spacing);
}
}
@@ -515,8 +521,8 @@ bool AdResponseBox::display() {
// go exclusive
if (_shieldWindow) {
_shieldWindow->_posX = _shieldWindow->_posY = 0;
- _shieldWindow->_width = _gameRef->_renderer->getWidth();
- _shieldWindow->_height = _gameRef->_renderer->getHeight();
+ _shieldWindow->setWidth(_gameRef->_renderer->getWidth());
+ _shieldWindow->setHeight(_gameRef->_renderer->getHeight());
_shieldWindow->display();
}
diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp
index 668b398..46badee 100644
--- a/engines/wintermute/ad/ad_scene.cpp
+++ b/engines/wintermute/ad/ad_scene.cpp
@@ -1014,8 +1014,8 @@ bool AdScene::traverseNodes(bool doUpdate) {
}
if (_shieldWindow) {
_shieldWindow->_posX = _shieldWindow->_posY = 0;
- _shieldWindow->_width = _gameRef->_renderer->getWidth();
- _shieldWindow->_height = _gameRef->_renderer->getHeight();
+ _shieldWindow->setWidth(_gameRef->_renderer->getWidth());
+ _shieldWindow->setHeight(_gameRef->_renderer->getHeight());
_shieldWindow->display();
}
}
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 62ce64b..38fb668 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -573,7 +573,7 @@ bool BaseGame::initLoop() {
_focusedWindow = nullptr;
for (int i = _windows.size() - 1; i >= 0; i--) {
- if (_windows[i]->_visible) {
+ if (_windows[i]->isVisible()) {
_focusedWindow = _windows[i];
break;
}
@@ -3019,10 +3019,10 @@ bool BaseGame::displayWindows(bool inGame) {
bool res;
// did we lose focus? focus topmost window
- if (_focusedWindow == nullptr || !_focusedWindow->_visible || _focusedWindow->_disable) {
+ if (_focusedWindow == nullptr || !_focusedWindow->isVisible() || _focusedWindow->isDisabled()) {
_focusedWindow = nullptr;
for (int i = _windows.size() - 1; i >= 0; i--) {
- if (_windows[i]->_visible && !_windows[i]->_disable) {
+ if (_windows[i]->isVisible() && !_windows[i]->isDisabled()) {
_focusedWindow = _windows[i];
break;
}
@@ -3031,7 +3031,7 @@ bool BaseGame::displayWindows(bool inGame) {
// display all windows
for (uint32 i = 0; i < _windows.size(); i++) {
- if (_windows[i]->_visible && _windows[i]->getInGame() == inGame) {
+ if (_windows[i]->isVisible() && _windows[i]->getInGame() == inGame) {
res = _windows[i]->display();
if (DID_FAIL(res)) {
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index c32ae75..333bba8 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -648,4 +648,77 @@ bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) {
return STATUS_FAILED;
}
+int32 UIObject::getWidth() {
+ return _width;
+}
+
+int32 UIObject::getHeight() {
+ return _height;
+}
+
+void UIObject::setWidth(int32 width) {
+ // assert (width >= 0);
+ // This would be ideal, but ATM must be failing pretty much everywhere.
+ _width = width;
+}
+
+void UIObject::setHeight(int32 height) {
+ // assert (height >= 0);
+ // This would be ideal, but ATM must be failing pretty much everywhere.
+ _height = height;
+}
+
+bool UIObject::isDisabled() {
+ return _disable;
+}
+
+bool UIObject::isVisible() {
+ return _visible;
+}
+
+void UIObject::setVisible(bool visible) {
+ _visible = visible;
+}
+
+void UIObject::setDisabled(bool disable) {
+ _disable = disable;
+}
+
+bool UIObject::hasSharedFonts() {
+ return _sharedFonts;
+}
+
+void UIObject::setSharedFonts(bool shared) {
+ _sharedFonts = shared;
+}
+
+bool UIObject::hasSharedImages() {
+ return _sharedImages;
+}
+
+void UIObject::setSharedImages(bool shared) {
+ _sharedImages = shared;
+}
+
+BaseSprite *UIObject::getImage() {
+ return _image;
+}
+
+void UIObject::putImage(BaseSprite *image) {
+ _image = image;
+}
+
+bool UIObject::canFocus() {
+ return _canFocus;
+}
+
+void UIObject::putFont(BaseFont *font) {
+ _font = font;
+}
+
+BaseFont *UIObject::getFont() {
+ return _font;
+}
+
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index 5d9508c..bcd9008 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -41,7 +41,6 @@ class UIObject : public BaseObject {
public:
bool getTotalOffset(int *offsetX, int *offsetY);
- bool _canFocus;
bool focus();
virtual bool handleMouse(TMouseEvent event, TMouseButton button);
bool isFocused();
@@ -52,20 +51,11 @@ public:
virtual bool display(int offsetX) { return display(offsetX, 0); }
virtual bool display(int offsetX, int offsetY);
virtual void correctSize();
- bool _sharedFonts;
- bool _sharedImages;
void setText(const char *text);
- char *_text;
- BaseFont *_font;
- bool _visible;
+
UITiledImage *_back;
- bool _disable;
UIObject(BaseGame *inGame = nullptr);
virtual ~UIObject();
- int32 _width;
- int32 _height;
- TUIObjectType _type;
- BaseSprite *_image;
void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
BaseScriptHolder *_listenerParamObject;
uint32 _listenerParamDWORD;
@@ -78,6 +68,38 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value) override;
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString() override;
+ TUIObjectType _type;
+
+ int32 getWidth();
+ int32 getHeight();
+ void setHeight(int32 height);
+ void setWidth(int32 width);
+ bool isDisabled();
+ void setDisabled(bool disable);
+ bool isVisible();
+ void setVisible(bool visible);
+ bool hasSharedFonts();
+ void setSharedFonts(bool shared);
+ bool hasSharedImages();
+ void setSharedImages(bool shared);
+ BaseSprite *getImage();
+ void putImage(BaseSprite *image);
+ void putFont(BaseFont *font);
+ BaseFont *getFont();
+ bool canFocus();
+
+protected:
+ BaseSprite *_image;
+ BaseFont *_font;
+ bool _sharedFonts;
+ bool _sharedImages;
+ char *_text;
+ bool _visible;
+ bool _disable;
+ int32 _width;
+ int32 _height;
+ bool _canFocus;
+
};
} // End of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
index e8acd11..c098415 100644
--- a/engines/wintermute/ui/ui_window.cpp
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -141,8 +141,8 @@ bool UIWindow::display(int offsetX, int offsetY) {
}
if (_shieldButton) {
_shieldButton->_posX = _shieldButton->_posY = 0;
- _shieldButton->_width = _gameRef->_renderer->getWidth();
- _shieldButton->_height = _gameRef->_renderer->getHeight();
+ _shieldButton->setWidth(_gameRef->_renderer->getWidth());
+ _shieldButton->setHeight(_gameRef->_renderer->getHeight());
_shieldButton->display();
}
@@ -170,7 +170,7 @@ bool UIWindow::display(int offsetX, int offsetY) {
_dragFrom.y = _gameRef->_mousePos.y;
}
- if (!_focusedWidget || (!_focusedWidget->_canFocus || _focusedWidget->_disable || !_focusedWidget->_visible)) {
+ if (!_focusedWidget || (!_focusedWidget->canFocus() || _focusedWidget->isDisabled() || !_focusedWidget->isVisible())) {
moveFocus();
}
@@ -737,7 +737,7 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
bool UIWindow::enableWidget(const char *name, bool enable) {
for (uint32 i = 0; i < _widgets.size(); i++) {
if (scumm_stricmp(_widgets[i]->getName(), name) == 0) {
- _widgets[i]->_disable = !enable;
+ _widgets[i]->setDisabled(!enable);
}
}
return STATUS_OK;
@@ -748,7 +748,7 @@ bool UIWindow::enableWidget(const char *name, bool enable) {
bool UIWindow::showWidget(const char *name, bool visible) {
for (uint32 i = 0; i < _widgets.size(); i++) {
if (scumm_stricmp(_widgets[i]->getName(), name) == 0) {
- _widgets[i]->_visible = visible;
+ _widgets[i]->setVisible(visible);
}
}
return STATUS_OK;
@@ -1309,7 +1309,7 @@ bool UIWindow::moveFocus(bool forward) {
bool done = false;
while (numTries <= (int32)_widgets.size()) {
- if (_widgets[i] != _focusedWidget && _widgets[i]->_canFocus && _widgets[i]->_visible && !_widgets[i]->_disable) {
+ if (_widgets[i] != _focusedWidget && _widgets[i]->canFocus() && _widgets[i]->isVisible() && !_widgets[i]->isDisabled()) {
_focusedWidget = _widgets[i];
done = true;
break;
@@ -1419,7 +1419,7 @@ void UIWindow::makeFreezable(bool freezable) {
bool UIWindow::getWindowObjects(BaseArray<UIObject *> &objects, bool interactiveOnly) {
for (uint32 i = 0; i < _widgets.size(); i++) {
UIObject *control = _widgets[i];
- if (control->_disable && interactiveOnly) {
+ if (control->isDisabled() && interactiveOnly) {
continue;
}
Commit: aafe8c1f0d45aef7429331b5e00f74d2e42b0ce7
https://github.com/scummvm/scummvm/commit/aafe8c1f0d45aef7429331b5e00f74d2e42b0ce7
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:19-07:00
Commit Message:
WINTERMUTE: Add getListener()
Changed paths:
engines/wintermute/ad/ad_inventory_box.cpp
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ui/ui_object.cpp
engines/wintermute/ui/ui_object.h
diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp
index 681d731..313da99 100644
--- a/engines/wintermute/ad/ad_inventory_box.cpp
+++ b/engines/wintermute/ad/ad_inventory_box.cpp
@@ -323,7 +323,7 @@ bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) {
if (_window) {
for (uint32 i = 0; i < _window->_widgets.size(); i++) {
- if (!_window->_widgets[i]->_listenerObject) {
+ if (!_window->_widgets[i]->getListener()) {
_window->_widgets[i]->setListener(this, _window->_widgets[i], 0);
}
}
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 24eaa77..6d513eb 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -374,7 +374,7 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) {
if (_window) {
for (uint32 i = 0; i < _window->_widgets.size(); i++) {
- if (!_window->_widgets[i]->_listenerObject) {
+ if (!_window->_widgets[i]->getListener()) {
_window->_widgets[i]->setListener(this, _window->_widgets[i], 0);
}
}
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index 333bba8..e4bcb2a 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -720,5 +720,9 @@ BaseFont *UIObject::getFont() {
return _font;
}
+BaseScriptHolder *UIObject::getListener() {
+ return _listenerObject;
+}
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index bcd9008..6d1f6ae 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -57,9 +57,8 @@ public:
UIObject(BaseGame *inGame = nullptr);
virtual ~UIObject();
void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
- BaseScriptHolder *_listenerParamObject;
- uint32 _listenerParamDWORD;
- BaseScriptHolder *_listenerObject;
+ BaseScriptHolder *getListener();
+
UIObject *_focusedWidget;
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
@@ -89,6 +88,9 @@ public:
bool canFocus();
protected:
+ BaseScriptHolder *_listenerParamObject;
+ uint32 _listenerParamDWORD;
+ BaseScriptHolder *_listenerObject;
BaseSprite *_image;
BaseFont *_font;
bool _sharedFonts;
Commit: 252e0c17ec711c13ac5ef3bd6af68646275d63d6
https://github.com/scummvm/scummvm/commit/252e0c17ec711c13ac5ef3bd6af68646275d63d6
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:23-07:00
Commit Message:
WINTERMUTE: Make _parentNotify private in UIObject
Changed paths:
engines/wintermute/ui/ui_object.h
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index 6d1f6ae..4132d95 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -44,7 +44,7 @@ public:
bool focus();
virtual bool handleMouse(TMouseEvent event, TMouseButton button);
bool isFocused();
- bool _parentNotify;
+
DECLARE_PERSISTENT(UIObject, BaseObject)
UIObject *_parent;
virtual bool display() override { return display(0, 0); }
@@ -101,7 +101,7 @@ protected:
int32 _width;
int32 _height;
bool _canFocus;
-
+ bool _parentNotify;
};
} // End of namespace Wintermute
Commit: 91ebad46d3adc4cf48a14f0f1bbfa9e41e28ecad
https://github.com/scummvm/scummvm/commit/91ebad46d3adc4cf48a14f0f1bbfa9e41e28ecad
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:25-07:00
Commit Message:
WINTERMUTE: Keep _back private in UIObject
Changed paths:
engines/wintermute/ui/ui_object.h
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index 4132d95..6eaade4 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -53,7 +53,6 @@ public:
virtual void correctSize();
void setText(const char *text);
- UITiledImage *_back;
UIObject(BaseGame *inGame = nullptr);
virtual ~UIObject();
void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
@@ -102,6 +101,7 @@ protected:
int32 _height;
bool _canFocus;
bool _parentNotify;
+ UITiledImage *_back;
};
} // End of namespace Wintermute
Commit: 1361fcde7c0cf0cecb6896288465551d1eb195f9
https://github.com/scummvm/scummvm/commit/1361fcde7c0cf0cecb6896288465551d1eb195f9
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:27-07:00
Commit Message:
WINTERMUTE: Avoid feeding setWidth negative values
Changed paths:
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ui/ui_object.cpp
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 6d513eb..f9680e9 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -182,10 +182,12 @@ bool AdResponseBox::createButtons() {
btn->putFont(_responses[i]->getFont());
}
- btn->setWidth(_responseArea.right - _responseArea.left);
- if (btn->getWidth() <= 0) {
- // TODO: This is not very pretty. Should do it at setWidth level, heh?
+ int width = _responseArea.right - _responseArea.left;
+
+ if (width <= 0) {
btn->setWidth(_gameRef->_renderer->getWidth());
+ } else {
+ btn->setWidth(width);
}
}
btn->setName("response");
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index e4bcb2a..0824f1f 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -657,14 +657,12 @@ int32 UIObject::getHeight() {
}
void UIObject::setWidth(int32 width) {
- // assert (width >= 0);
- // This would be ideal, but ATM must be failing pretty much everywhere.
+ assert (width >= 0);
_width = width;
}
void UIObject::setHeight(int32 height) {
- // assert (height >= 0);
- // This would be ideal, but ATM must be failing pretty much everywhere.
+ assert (height >= 0);
_height = height;
}
Commit: b22eaaa98a9620fae346b1bd1bf67311cb312ec0
https://github.com/scummvm/scummvm/commit/b22eaaa98a9620fae346b1bd1bf67311cb312ec0
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:32-07:00
Commit Message:
WINTERMUTE: Keep attributes private in UIEdit
Changed paths:
engines/wintermute/ui/ui_edit.h
diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h
index a057be9..7a37901 100644
--- a/engines/wintermute/ui/ui_edit.h
+++ b/engines/wintermute/ui/ui_edit.h
@@ -38,21 +38,15 @@ class BaseFont;
class UIEdit : public UIObject {
public:
DECLARE_PERSISTENT(UIEdit, UIObject)
- int32 _maxLength;
+
int insertChars(int pos, const byte *chars, int num);
int deleteChars(int start, int end);
- bool _cursorVisible;
- uint32 _lastBlinkTime;
+
virtual bool display(int offsetX, int offsetY);
virtual bool handleKeypress(Common::Event *event, bool printable = false);
- int32 _scrollOffset;
- int32 _frameWidth;
- uint32 _cursorBlinkRate;
+
void setCursorChar(const char *character);
- char *_cursorChar;
- int32 _selEnd;
- int32 _selStart;
- BaseFont *_fontSelected;
+
UIEdit(BaseGame *inGame);
virtual ~UIEdit();
@@ -65,6 +59,17 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value) override;
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString() override;
+private:
+ uint32 _cursorBlinkRate;
+ uint32 _lastBlinkTime;
+ int32 _selEnd;
+ int32 _selStart;
+ int32 _scrollOffset;
+ int32 _frameWidth;
+ BaseFont *_fontSelected;
+ int32 _maxLength;
+ bool _cursorVisible;
+ char *_cursorChar;
};
} // End of namespace Wintermute
Commit: 59f4a9e7ac519405a728b9d9a448114c05fe4776
https://github.com/scummvm/scummvm/commit/59f4a9e7ac519405a728b9d9a448114c05fe4776
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:35-07:00
Commit Message:
WINTERMUTE: Keep some attributes private in UIButton
Changed paths:
engines/wintermute/ui/ui_button.h
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h
index b5002f3..846121e 100644
--- a/engines/wintermute/ui/ui_button.h
+++ b/engines/wintermute/ui/ui_button.h
@@ -37,31 +37,15 @@ namespace Wintermute {
class UIButton : public UIObject {
public:
- bool _pixelPerfect;
- bool _stayPressed;
- bool _centerImage;
- bool _oneTimePress;
+
uint32 _oneTimePressTime;
DECLARE_PERSISTENT(UIButton, UIObject)
void press();
virtual bool display() { return display(0, 0); }
virtual bool display(int offsetX, int offsetY);
- bool _press;
- bool _hover;
+
void correctSize();
- TTextAlign _align;
- BaseSprite *_imageHover;
- BaseSprite *_imagePress;
- BaseSprite *_imageDisable;
- BaseSprite *_imageFocus;
- BaseFont *_fontDisable;
- BaseFont *_fontPress;
- BaseFont *_fontHover;
- BaseFont *_fontFocus;
- UITiledImage *_backPress;
- UITiledImage *_backHover;
- UITiledImage *_backDisable;
- UITiledImage *_backFocus;
+
UIButton(BaseGame *inGame = nullptr);
virtual ~UIButton();
bool loadFile(const char *filename);
@@ -73,6 +57,28 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value) override;
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString() override;
+ BaseFont *_fontDisable;
+ BaseFont *_fontPress;
+ BaseFont *_fontHover;
+ BaseFont *_fontFocus;
+ BaseSprite *_imageHover;
+ BaseSprite *_imagePress;
+ BaseSprite *_imageDisable;
+ BaseSprite *_imageFocus;
+ TTextAlign _align;
+
+private:
+ bool _pixelPerfect;
+ bool _stayPressed;
+ bool _centerImage;
+ bool _oneTimePress;
+ UITiledImage *_backPress;
+ UITiledImage *_backHover;
+ UITiledImage *_backDisable;
+ UITiledImage *_backFocus;
+ bool _press;
+ bool _hover;
+
};
} // End of namespace Wintermute
Commit: 1869481767b205b3475d9d79e69f69c8cc184b02
https://github.com/scummvm/scummvm/commit/1869481767b205b3475d9d79e69f69c8cc184b02
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:37-07:00
Commit Message:
WINTERMUTE: Setters/getters for UIButton
Changed paths:
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ui/ui_button.cpp
engines/wintermute/ui/ui_button.h
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index f9680e9..229ba81 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -125,8 +125,8 @@ bool AdResponseBox::invalidateButtons() {
_respButtons[i]->putFont(nullptr);
_respButtons[i]->setText("");
_respButtons[i]->_cursor = nullptr;
- _respButtons[i]->_fontHover = nullptr;
- _respButtons[i]->_fontPress = nullptr;
+ _respButtons[i]->putFontHover(nullptr);
+ _respButtons[i]->putFontPress(nullptr);
}
return STATUS_OK;
}
@@ -169,12 +169,12 @@ bool AdResponseBox::createButtons() {
} else {
btn->putFont(_font);
}
- btn->_fontHover = (_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover;
- btn->_fontPress = btn->_fontHover;
+ btn->putFontHover((_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover);
+ btn->putFontPress(btn->getFontHover());
btn->_align = _align;
if (_gameRef->_touchInterface) {
- btn->_fontHover = btn->getFont();
+ btn->putFontHover(btn->getFont());
}
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index b2e6c39..eff1059 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -1206,4 +1206,16 @@ bool UIButton::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
+void UIButton::putFontHover(BaseFont *font) {
+ _fontHover = font;
+}
+
+BaseFont *UIButton::getFontHover() {
+ return _fontHover;
+}
+
+void UIButton::putFontPress(BaseFont *font) {
+ _fontPress = font;
+}
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h
index 846121e..2d7cb01 100644
--- a/engines/wintermute/ui/ui_button.h
+++ b/engines/wintermute/ui/ui_button.h
@@ -57,15 +57,16 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value) override;
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString() override;
- BaseFont *_fontDisable;
- BaseFont *_fontPress;
- BaseFont *_fontHover;
- BaseFont *_fontFocus;
+
BaseSprite *_imageHover;
BaseSprite *_imagePress;
BaseSprite *_imageDisable;
BaseSprite *_imageFocus;
TTextAlign _align;
+
+ void putFontHover(BaseFont *font);
+ BaseFont *getFontHover();
+ void putFontPress(BaseFont *font);
private:
bool _pixelPerfect;
@@ -78,7 +79,10 @@ private:
UITiledImage *_backFocus;
bool _press;
bool _hover;
-
+ BaseFont *_fontDisable;
+ BaseFont *_fontPress;
+ BaseFont *_fontHover;
+ BaseFont *_fontFocus;
};
} // End of namespace Wintermute
Commit: 417bf3db02ec3af8184d3de7d4ed87181342367f
https://github.com/scummvm/scummvm/commit/417bf3db02ec3af8184d3de7d4ed87181342367f
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:41-07:00
Commit Message:
WINTERMUTE: Make sprites private in UIButton
Changed paths:
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ui/ui_button.cpp
engines/wintermute/ui/ui_button.h
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 229ba81..8454f21 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -148,10 +148,10 @@ bool AdResponseBox::createButtons() {
if (_responses[i]->getIcon()) {
btn->putImage(_responses[i]->getIcon());
if (_responses[i]->getIconHover()) {
- btn->_imageHover = _responses[i]->getIconHover();
+ btn->putImageHover(_responses[i]->getIconHover());
}
if (_responses[i]->getIconPressed()) {
- btn->_imagePress = _responses[i]->getIconPressed();
+ btn->putImagePress(_responses[i]->getIconPressed());
}
btn->setCaption(_responses[i]->getText());
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index eff1059..1d26674 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -1218,4 +1218,12 @@ void UIButton::putFontPress(BaseFont *font) {
_fontPress = font;
}
+void UIButton::putImageHover(BaseSprite *sprite) {
+ _imageHover = sprite;
+}
+
+void UIButton::putImagePress(BaseSprite *sprite) {
+ _imagePress = sprite;
+}
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h
index 2d7cb01..bf2144f 100644
--- a/engines/wintermute/ui/ui_button.h
+++ b/engines/wintermute/ui/ui_button.h
@@ -58,15 +58,14 @@ public:
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString() override;
- BaseSprite *_imageHover;
- BaseSprite *_imagePress;
- BaseSprite *_imageDisable;
- BaseSprite *_imageFocus;
TTextAlign _align;
void putFontHover(BaseFont *font);
BaseFont *getFontHover();
void putFontPress(BaseFont *font);
+
+ void putImageHover(BaseSprite *sprite);
+ void putImagePress(BaseSprite *sprite);
private:
bool _pixelPerfect;
@@ -83,6 +82,11 @@ private:
BaseFont *_fontPress;
BaseFont *_fontHover;
BaseFont *_fontFocus;
+ BaseSprite *_imageHover;
+ BaseSprite *_imagePress;
+ BaseSprite *_imageDisable;
+ BaseSprite *_imageFocus;
+
};
} // End of namespace Wintermute
Commit: 2a977dec8c180c297c000b3c09b068f76344c313
https://github.com/scummvm/scummvm/commit/2a977dec8c180c297c000b3c09b068f76344c313
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:43-07:00
Commit Message:
WINTERMUTE: add UIButton::setTextAlign
Changed paths:
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ui/ui_button.cpp
engines/wintermute/ui/ui_button.h
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 8454f21..267a207 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -171,7 +171,7 @@ bool AdResponseBox::createButtons() {
}
btn->putFontHover((_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover);
btn->putFontPress(btn->getFontHover());
- btn->_align = _align;
+ btn->setTextAlign(_align);
if (_gameRef->_touchInterface) {
btn->putFontHover(btn->getFont());
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index 1d26674..a299603 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -1226,4 +1226,10 @@ void UIButton::putImagePress(BaseSprite *sprite) {
_imagePress = sprite;
}
+void UIButton::setTextAlign(TTextAlign align) {
+ _align = align;
+}
+
+
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h
index bf2144f..ea41435 100644
--- a/engines/wintermute/ui/ui_button.h
+++ b/engines/wintermute/ui/ui_button.h
@@ -38,7 +38,6 @@ namespace Wintermute {
class UIButton : public UIObject {
public:
- uint32 _oneTimePressTime;
DECLARE_PERSISTENT(UIButton, UIObject)
void press();
virtual bool display() { return display(0, 0); }
@@ -58,12 +57,13 @@ public:
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString() override;
- TTextAlign _align;
void putFontHover(BaseFont *font);
BaseFont *getFontHover();
void putFontPress(BaseFont *font);
+ void setTextAlign(TTextAlign align);
+
void putImageHover(BaseSprite *sprite);
void putImagePress(BaseSprite *sprite);
@@ -86,6 +86,8 @@ private:
BaseSprite *_imagePress;
BaseSprite *_imageDisable;
BaseSprite *_imageFocus;
+ uint32 _oneTimePressTime;
+ TTextAlign _align;
};
Commit: 5b8a6885c67fe2e1af3dab0e634da1938f8e544c
https://github.com/scummvm/scummvm/commit/5b8a6885c67fe2e1af3dab0e634da1938f8e544c
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:46-07:00
Commit Message:
WINTERMUTE: s/put/set/ in setters
Changed paths:
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ui/ui_button.cpp
engines/wintermute/ui/ui_button.h
engines/wintermute/ui/ui_object.cpp
engines/wintermute/ui/ui_object.h
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 267a207..9fcc33e 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -121,12 +121,12 @@ void AdResponseBox::clearButtons() {
//////////////////////////////////////////////////////////////////////////
bool AdResponseBox::invalidateButtons() {
for (uint32 i = 0; i < _respButtons.size(); i++) {
- _respButtons[i]->putImage(nullptr);
- _respButtons[i]->putFont(nullptr);
+ _respButtons[i]->setImage(nullptr);
+ _respButtons[i]->setFont(nullptr);
_respButtons[i]->setText("");
_respButtons[i]->_cursor = nullptr;
- _respButtons[i]->putFontHover(nullptr);
- _respButtons[i]->putFontPress(nullptr);
+ _respButtons[i]->setFontHover(nullptr);
+ _respButtons[i]->setFontPress(nullptr);
}
return STATUS_OK;
}
@@ -146,12 +146,12 @@ bool AdResponseBox::createButtons() {
btn->_sharedCursors = true;
// iconic
if (_responses[i]->getIcon()) {
- btn->putImage(_responses[i]->getIcon());
+ btn->setImage(_responses[i]->getIcon());
if (_responses[i]->getIconHover()) {
- btn->putImageHover(_responses[i]->getIconHover());
+ btn->setImageHover(_responses[i]->getIconHover());
}
if (_responses[i]->getIconPressed()) {
- btn->putImagePress(_responses[i]->getIconPressed());
+ btn->setImagePress(_responses[i]->getIconPressed());
}
btn->setCaption(_responses[i]->getText());
@@ -165,21 +165,21 @@ bool AdResponseBox::createButtons() {
else {
btn->setText(_responses[i]->getText());
if (_font == nullptr) {
- btn->putFont(_gameRef->getSystemFont());
+ btn->setFont(_gameRef->getSystemFont());
} else {
- btn->putFont(_font);
+ btn->setFont(_font);
}
- btn->putFontHover((_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover);
- btn->putFontPress(btn->getFontHover());
+ btn->setFontHover((_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover);
+ btn->setFontPress(btn->getFontHover());
btn->setTextAlign(_align);
if (_gameRef->_touchInterface) {
- btn->putFontHover(btn->getFont());
+ btn->setFontHover(btn->getFont());
}
if (_responses[i]->getFont()) {
- btn->putFont(_responses[i]->getFont());
+ btn->setFont(_responses[i]->getFont());
}
int width = _responseArea.right - _responseArea.left;
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index a299603..a3f0069 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -1206,7 +1206,7 @@ bool UIButton::persist(BasePersistenceManager *persistMgr) {
return STATUS_OK;
}
-void UIButton::putFontHover(BaseFont *font) {
+void UIButton::setFontHover(BaseFont *font) {
_fontHover = font;
}
@@ -1214,15 +1214,15 @@ BaseFont *UIButton::getFontHover() {
return _fontHover;
}
-void UIButton::putFontPress(BaseFont *font) {
+void UIButton::setFontPress(BaseFont *font) {
_fontPress = font;
}
-void UIButton::putImageHover(BaseSprite *sprite) {
+void UIButton::setImageHover(BaseSprite *sprite) {
_imageHover = sprite;
}
-void UIButton::putImagePress(BaseSprite *sprite) {
+void UIButton::setImagePress(BaseSprite *sprite) {
_imagePress = sprite;
}
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h
index ea41435..e5dc25b 100644
--- a/engines/wintermute/ui/ui_button.h
+++ b/engines/wintermute/ui/ui_button.h
@@ -58,14 +58,14 @@ public:
virtual const char *scToString() override;
- void putFontHover(BaseFont *font);
+ void setFontHover(BaseFont *font);
BaseFont *getFontHover();
- void putFontPress(BaseFont *font);
+ void setFontPress(BaseFont *font);
void setTextAlign(TTextAlign align);
- void putImageHover(BaseSprite *sprite);
- void putImagePress(BaseSprite *sprite);
+ void setImageHover(BaseSprite *sprite);
+ void setImagePress(BaseSprite *sprite);
private:
bool _pixelPerfect;
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index 0824f1f..73d7d0f 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -702,7 +702,7 @@ BaseSprite *UIObject::getImage() {
return _image;
}
-void UIObject::putImage(BaseSprite *image) {
+void UIObject::setImage(BaseSprite *image) {
_image = image;
}
@@ -710,7 +710,7 @@ bool UIObject::canFocus() {
return _canFocus;
}
-void UIObject::putFont(BaseFont *font) {
+void UIObject::setFont(BaseFont *font) {
_font = font;
}
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index 6eaade4..8451479 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -81,8 +81,8 @@ public:
bool hasSharedImages();
void setSharedImages(bool shared);
BaseSprite *getImage();
- void putImage(BaseSprite *image);
- void putFont(BaseFont *font);
+ void setImage(BaseSprite *image);
+ void setFont(BaseFont *font);
BaseFont *getFont();
bool canFocus();
Commit: 1023ac4b33158905b900585c27dfa1f2e368d4f3
https://github.com/scummvm/scummvm/commit/1023ac4b33158905b900585c27dfa1f2e368d4f3
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:48-07:00
Commit Message:
WINTERMUTE: const'ify getters
Changed paths:
engines/wintermute/ui/ui_object.cpp
engines/wintermute/ui/ui_object.h
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index 73d7d0f..224e68a 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -648,11 +648,11 @@ bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) {
return STATUS_FAILED;
}
-int32 UIObject::getWidth() {
+int32 UIObject::getWidth() const {
return _width;
}
-int32 UIObject::getHeight() {
+int32 UIObject::getHeight() const {
return _height;
}
@@ -698,7 +698,7 @@ void UIObject::setSharedImages(bool shared) {
_sharedImages = shared;
}
-BaseSprite *UIObject::getImage() {
+BaseSprite *UIObject::getImage() const {
return _image;
}
@@ -714,11 +714,11 @@ void UIObject::setFont(BaseFont *font) {
_font = font;
}
-BaseFont *UIObject::getFont() {
+BaseFont *UIObject::getFont() const {
return _font;
}
-BaseScriptHolder *UIObject::getListener() {
+BaseScriptHolder *UIObject::getListener() const {
return _listenerObject;
}
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index 8451479..d9be29b 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -56,7 +56,7 @@ public:
UIObject(BaseGame *inGame = nullptr);
virtual ~UIObject();
void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
- BaseScriptHolder *getListener();
+ BaseScriptHolder *getListener() const;
UIObject *_focusedWidget;
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
@@ -68,8 +68,8 @@ public:
virtual const char *scToString() override;
TUIObjectType _type;
- int32 getWidth();
- int32 getHeight();
+ int32 getWidth() const;
+ int32 getHeight() const;
void setHeight(int32 height);
void setWidth(int32 width);
bool isDisabled();
@@ -80,10 +80,10 @@ public:
void setSharedFonts(bool shared);
bool hasSharedImages();
void setSharedImages(bool shared);
- BaseSprite *getImage();
+ BaseSprite *getImage() const;
void setImage(BaseSprite *image);
void setFont(BaseFont *font);
- BaseFont *getFont();
+ BaseFont *getFont() const;
bool canFocus();
protected:
Commit: f7a9e921aee9371a9defe5acaf4a685ada76fcfb
https://github.com/scummvm/scummvm/commit/f7a9e921aee9371a9defe5acaf4a685ada76fcfb
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2013-09-21T14:22:50-07:00
Commit Message:
WINTERMUTE: Formatting
Changed paths:
engines/wintermute/ui/ui_button.cpp
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index a3f0069..cc4f76c 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -1230,6 +1230,4 @@ void UIButton::setTextAlign(TTextAlign align) {
_align = align;
}
-
-
} // End of namespace Wintermute
Commit: 5afb297e396fa3ad40559e552008741c6cd6ba66
https://github.com/scummvm/scummvm/commit/5afb297e396fa3ad40559e552008741c6cd6ba66
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-09-30T02:12:25-07:00
Commit Message:
WINTERMUTE: Constify some getters in TransparentSurface, UIObject and UIWindow
Changed paths:
engines/wintermute/graphics/transparent_surface.cpp
engines/wintermute/graphics/transparent_surface.h
engines/wintermute/ui/ui_object.cpp
engines/wintermute/ui/ui_object.h
engines/wintermute/ui/ui_window.cpp
engines/wintermute/ui/ui_window.h
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index 200cffb..ca6f297 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -612,7 +612,7 @@ void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool
}
}
-TransparentSurface::AlphaType TransparentSurface::getAlphaMode() {
+TransparentSurface::AlphaType TransparentSurface::getAlphaMode() const {
return _alphaMode;
}
diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h
index fe5dc08..5a9c16d 100644
--- a/engines/wintermute/graphics/transparent_surface.h
+++ b/engines/wintermute/graphics/transparent_surface.h
@@ -118,7 +118,7 @@ struct TransparentSurface : public Graphics::Surface {
TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const;
TransparentSurface *rotoscale(const TransformStruct &transform) const;
- AlphaType getAlphaMode();
+ AlphaType getAlphaMode() const;
void setAlphaMode(AlphaType);
private:
AlphaType _alphaMode;
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index 224e68a..0962d83 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -666,11 +666,11 @@ void UIObject::setHeight(int32 height) {
_height = height;
}
-bool UIObject::isDisabled() {
+bool UIObject::isDisabled() const {
return _disable;
}
-bool UIObject::isVisible() {
+bool UIObject::isVisible() const {
return _visible;
}
@@ -682,7 +682,7 @@ void UIObject::setDisabled(bool disable) {
_disable = disable;
}
-bool UIObject::hasSharedFonts() {
+bool UIObject::hasSharedFonts() const {
return _sharedFonts;
}
@@ -690,7 +690,7 @@ void UIObject::setSharedFonts(bool shared) {
_sharedFonts = shared;
}
-bool UIObject::hasSharedImages() {
+bool UIObject::hasSharedImages() const {
return _sharedImages;
}
@@ -706,7 +706,7 @@ void UIObject::setImage(BaseSprite *image) {
_image = image;
}
-bool UIObject::canFocus() {
+bool UIObject::canFocus() const {
return _canFocus;
}
@@ -714,7 +714,7 @@ void UIObject::setFont(BaseFont *font) {
_font = font;
}
-BaseFont *UIObject::getFont() const {
+BaseFont *UIObject::getFont() {
return _font;
}
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index d9be29b..56d22a0 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -72,19 +72,19 @@ public:
int32 getHeight() const;
void setHeight(int32 height);
void setWidth(int32 width);
- bool isDisabled();
+ bool isDisabled() const;
void setDisabled(bool disable);
- bool isVisible();
+ bool isVisible() const;
void setVisible(bool visible);
- bool hasSharedFonts();
+ bool hasSharedFonts() const;
void setSharedFonts(bool shared);
- bool hasSharedImages();
+ bool hasSharedImages() const;
void setSharedImages(bool shared);
BaseSprite *getImage() const;
void setImage(BaseSprite *image);
void setFont(BaseFont *font);
- BaseFont *getFont() const;
- bool canFocus();
+ BaseFont *getFont();
+ bool canFocus() const;
protected:
BaseScriptHolder *_listenerParamObject;
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
index c098415..a54f7c5 100644
--- a/engines/wintermute/ui/ui_window.cpp
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -1442,11 +1442,11 @@ bool UIWindow::getWindowObjects(BaseArray<UIObject *> &objects, bool interactive
return STATUS_OK;
}
-bool UIWindow::getInGame() {
+bool UIWindow::getInGame() const {
return _inGame;
}
-TWindowMode UIWindow::getMode() {
+TWindowMode UIWindow::getMode() const {
return _mode;
}
diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h
index 9175e3c..d8dae8c 100644
--- a/engines/wintermute/ui/ui_window.h
+++ b/engines/wintermute/ui/ui_window.h
@@ -73,8 +73,8 @@ public:
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString();
- bool getInGame();
- TWindowMode getMode();
+ bool getInGame() const;
+ TWindowMode getMode() const;
private:
bool _pauseMusic;
Commit: 15d98724d85b33d9918125999d6f654736ef10af
https://github.com/scummvm/scummvm/commit/15d98724d85b33d9918125999d6f654736ef10af
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-09-30T02:13:29-07:00
Commit Message:
WINTERMUTE: Formatting (Clean up extra whitespace in UIObject).
Changed paths:
engines/wintermute/ui/ui_object.cpp
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index 0962d83..72a601a 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -657,12 +657,12 @@ int32 UIObject::getHeight() const {
}
void UIObject::setWidth(int32 width) {
- assert (width >= 0);
+ assert(width >= 0);
_width = width;
}
void UIObject::setHeight(int32 height) {
- assert (height >= 0);
+ assert(height >= 0);
_height = height;
}
Commit: 12e7cb401f80d8e1dee1af67817333d897508dfb
https://github.com/scummvm/scummvm/commit/12e7cb401f80d8e1dee1af67817333d897508dfb
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-09-30T02:18:54-07:00
Commit Message:
WINTERMUTE: Formatting with Astyle (UIButton, UIEdit, UIObject, UIWindow, TransparentSurface)
Changed paths:
engines/wintermute/graphics/transparent_surface.cpp
engines/wintermute/ui/ui_button.cpp
engines/wintermute/ui/ui_button.h
engines/wintermute/ui/ui_edit.cpp
engines/wintermute/ui/ui_object.cpp
engines/wintermute/ui/ui_object.h
engines/wintermute/ui/ui_window.h
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index ca6f297..470e2cc 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -181,7 +181,7 @@ void doBlitOpaque(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pit
void doBlitBinary(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
byte *in, *out;
-
+
#ifdef SCUMM_LITTLE_ENDIAN
const int aIndex = 0;
#else
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index cc4f76c..66cee8a 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -660,7 +660,7 @@ bool UIButton::display(int offsetX, int offsetY) {
_hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN));
if ((_press && _hover && !_gameRef->_mouseLeftDown) ||
- (_oneTimePress && g_system->getMillis() - _oneTimePressTime >= 100)) {
+ (_oneTimePress && g_system->getMillis() - _oneTimePressTime >= 100)) {
press();
}
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h
index e5dc25b..542a50d 100644
--- a/engines/wintermute/ui/ui_button.h
+++ b/engines/wintermute/ui/ui_button.h
@@ -57,11 +57,11 @@ public:
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString() override;
-
+
void setFontHover(BaseFont *font);
BaseFont *getFontHover();
void setFontPress(BaseFont *font);
-
+
void setTextAlign(TTextAlign align);
void setImageHover(BaseSprite *sprite);
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp
index caed157..502685f 100644
--- a/engines/wintermute/ui/ui_edit.cpp
+++ b/engines/wintermute/ui/ui_edit.cpp
@@ -627,9 +627,9 @@ bool UIEdit::display(int offsetX, int offsetY) {
curFirst = true;
} else {
while (font->getTextWidth((byte *)_text + _scrollOffset, MAX<int32>(0, _selStart - _scrollOffset)) +
- sfont->getTextWidth((byte *)(_text + MAX<int32>(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart))
+ sfont->getTextWidth((byte *)(_text + MAX<int32>(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart))
- > _width - cursorWidth - 2 * _frameWidth) {
+ > _width - cursorWidth - 2 * _frameWidth) {
_scrollOffset++;
if (_scrollOffset >= (int)strlen(_text)) {
break;
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index 72a601a..a8da89b 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -668,7 +668,7 @@ void UIObject::setHeight(int32 height) {
bool UIObject::isDisabled() const {
return _disable;
-}
+}
bool UIObject::isVisible() const {
return _visible;
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index 56d22a0..8d14d8a 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -89,7 +89,7 @@ public:
protected:
BaseScriptHolder *_listenerParamObject;
uint32 _listenerParamDWORD;
- BaseScriptHolder *_listenerObject;
+ BaseScriptHolder *_listenerObject;
BaseSprite *_image;
BaseFont *_font;
bool _sharedFonts;
diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h
index d8dae8c..a603e0f 100644
--- a/engines/wintermute/ui/ui_window.h
+++ b/engines/wintermute/ui/ui_window.h
@@ -72,7 +72,7 @@ public:
virtual bool scSetProperty(const char *name, ScValue *value) override;
virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
virtual const char *scToString();
-
+
bool getInGame() const;
TWindowMode getMode() const;
Commit: ccd3258bdccaf7290137aea5b98889a9568547db
https://github.com/scummvm/scummvm/commit/ccd3258bdccaf7290137aea5b98889a9568547db
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-09-30T02:19:54-07:00
Commit Message:
WINTERMUTE: Use ; and not , to separate delete and new.
Changed paths:
engines/wintermute/ui/ui_window.cpp
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
index a54f7c5..da681b9 100644
--- a/engines/wintermute/ui/ui_window.cpp
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -400,8 +400,8 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) {
break;
case TOKEN_IMAGE_INACTIVE:
- delete _imageInactive,
- _imageInactive = new BaseSprite(_gameRef);
+ delete _imageInactive;
+ _imageInactive = new BaseSprite(_gameRef);
if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) {
delete _imageInactive;
_imageInactive = nullptr;
Commit: 48ad18d2664f83271613191351b7b92d06fd5cf0
https://github.com/scummvm/scummvm/commit/48ad18d2664f83271613191351b7b92d06fd5cf0
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-09-30T02:23:57-07:00
Commit Message:
Merge branch 'refac'
Conflicts:
engines/wintermute/graphics/transparent_surface.cpp
engines/wintermute/graphics/transparent_surface.h
Changed paths:
engines/wintermute/ad/ad_inventory_box.cpp
engines/wintermute/ad/ad_response_box.cpp
engines/wintermute/ad/ad_scene.cpp
engines/wintermute/base/base_game.cpp
engines/wintermute/base/gfx/osystem/render_ticket.cpp
engines/wintermute/graphics/transparent_surface.cpp
engines/wintermute/graphics/transparent_surface.h
engines/wintermute/ui/ui_button.cpp
engines/wintermute/ui/ui_button.h
engines/wintermute/ui/ui_edit.cpp
engines/wintermute/ui/ui_edit.h
engines/wintermute/ui/ui_entity.h
engines/wintermute/ui/ui_object.cpp
engines/wintermute/ui/ui_object.h
engines/wintermute/ui/ui_text.h
engines/wintermute/ui/ui_window.cpp
engines/wintermute/ui/ui_window.h
diff --cc engines/wintermute/base/gfx/osystem/render_ticket.cpp
index d79d5ba,a1538e9..94512eb
--- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp
+++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
@@@ -127,12 -127,12 +127,12 @@@ void RenderTicket::drawToSurface(Graphi
if (_owner) {
if (_transform._alphaDisable) {
- src._alphaMode = TransparentSurface::ALPHA_OPAQUE;
+ src.setAlphaMode(TransparentSurface::ALPHA_OPAQUE);
} else {
- src._alphaMode = _owner->getAlphaType();
+ src.setAlphaMode(_owner->getAlphaType());
}
}
- src.blit(*_targetSurface, dstRect->left, dstRect->top, _transform._flip, clipRect, _transform._rgbaMod, clipRect->width(), clipRect->height());
+ src.blit(*_targetSurface, dstRect->left, dstRect->top, _transform._flip, clipRect, _transform._rgbaMod, clipRect->width(), clipRect->height(), _transform._blendMode);
if (doDelete) {
delete clipRect;
}
diff --cc engines/wintermute/graphics/transparent_surface.h
index 821b5c5,5a9c16d..5f44cf0
--- a/engines/wintermute/graphics/transparent_surface.h
+++ b/engines/wintermute/graphics/transparent_surface.h
@@@ -96,37 -76,11 +96,35 @@@ struct TransparentSurface : public Grap
};
enum AlphaType {
- ALPHA_OPAQUE = 0,
- ALPHA_BINARY = 1,
- ALPHA_FULL = 2
+ ALPHA_OPAQUE = 0,
+ ALPHA_BINARY = 1,
+ ALPHA_FULL = 2
};
- AlphaType _alphaMode;
-
+ #ifdef SCUMM_LITTLE_ENDIAN
+ static const int kAIndex = 0;
+ static const int kBIndex = 1;
+ static const int kGIndex = 2;
+ static const int kRIndex = 3;
+ #else
+ static const int kAIndex = 3;
+ static const int kBIndex = 2;
+ static const int kGIndex = 1;
+ static const int kRIndex = 0;
+ #endif
+
+ static const int kBShift = 8;//img->format.bShift;
+ static const int kGShift = 16;//img->format.gShift;
+ static const int kRShift = 24;//img->format.rShift;
+ static const int kAShift = 0;//img->format.aShift;
+
+
+ static const int kBModShift = 0;//img->format.bShift;
+ static const int kGModShift = 8;//img->format.gShift;
+ static const int kRModShift = 16;//img->format.rShift;
+ static const int kAModShift = 24;//img->format.aShift;
+
+
/**
@brief renders the surface to another surface
@param pDest a pointer to the target image. In most cases this is the framebuffer.
@@@ -159,27 -113,16 +157,32 @@@
int flipping = FLIP_NONE,
Common::Rect *pPartRect = nullptr,
uint color = BS_ARGB(255, 255, 255, 255),
- int width = -1, int height = -1);
+ int width = -1, int height = -1,
+ TSpriteBlendMode blend = BLEND_NORMAL);
void applyColorKey(uint8 r, uint8 g, uint8 b, bool overwriteAlpha = false);
-
+
+ /**
+ * @brief Scale function; this returns a transformed version of this surface after rotation and
+ * scaling. Please do not use this if angle != 0, use rotoscale.
+ *
+ * @param transform a TransformStruct wrapping the required info. @see TransformStruct
+ *
+ */
TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const;
+
+ /**
+ * @brief Rotoscale function; this returns a transformed version of this surface after rotation and
+ * scaling. Please do not use this if angle == 0, use plain old scaling function.
+ *
+ * @param transform a TransformStruct wrapping the required info. @see TransformStruct
+ *
+ */
TransparentSurface *rotoscale(const TransformStruct &transform) const;
+ AlphaType getAlphaMode() const;
+ void setAlphaMode(AlphaType);
+ private:
+ AlphaType _alphaMode;
+
};
/**
More information about the Scummvm-git-logs
mailing list