SAGA2: Remove global constructors in floating.cpp

This commit is contained in:
a/ 2021-06-30 00:15:24 +09:00 committed by Eugene Sandulenko
parent e4ca5a7864
commit deb8ee29a4
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
3 changed files with 20 additions and 6 deletions

View File

@ -245,8 +245,8 @@ void BackWindow::toFront(void) {}
DragBar class member functions
* ===================================================================== */
Point16 DragBar::dragOffset,
DragBar::dragPos;
StaticPoint16 DragBar::dragOffset = {0, 0};
StaticPoint16 DragBar::dragPos = {0, 0};
bool DragBar::update;
FloatingWindow *DragBar::dragWindow;
@ -267,7 +267,7 @@ bool DragBar::pointerHit(gPanelMessage &msg) {
dragPos.x = wExtent.x;
dragPos.y = wExtent.y;
dragOffset = msg.pickAbsPos;
dragOffset.set(msg.pickAbsPos.x, msg.pickAbsPos.y);
return true;
}
@ -287,7 +287,7 @@ void DragBar::pointerDrag(gPanelMessage &msg) {
// If window position has changed, then signal the drawing loop
if (pos != dragPos) {
dragPos = pos;
dragPos.set(pos.x, pos.y);
update = true;
dragWindow = (FloatingWindow *)&window;
}

View File

@ -87,8 +87,8 @@ class FloatingWindow;
class DragBar : public gControl {
public:
static Point16 dragOffset, // mouse offset
dragPos; // new position of window
static StaticPoint16 dragOffset, // mouse offset
dragPos; // new position of window
static bool update; // true = update window pos
static FloatingWindow *dragWindow; // which window to update

View File

@ -29,6 +29,15 @@
namespace Saga2 {
struct StaticPoint16 {
int16 x, y;
void set(int16 nx, int16 ny) {
x = nx;
y = ny;
}
};
class Point16 {
public:
int16 x, y;
@ -58,6 +67,11 @@ public:
}
#endif
Point16(StaticPoint16 p) {
x = p.x;
y = p.y;
}
void load(Common::SeekableReadStream *stream);
// Point16 operators