|
@@ -134,7 +134,7 @@ namespace oxygine
|
|
|
btn->addEventListener(TouchEvent::CLICK, CLOSURE(this, &DebugActor::_btnClicked));
|
|
btn->addEventListener(TouchEvent::CLICK, CLOSURE(this, &DebugActor::_btnClicked));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- DebugActor::DebugActor(): _frames(0), _startTime(0), _showTexel2PixelErrors(false), _showTouchedActor(false)
|
|
|
|
|
|
|
+ DebugActor::DebugActor(): _frames(0), _startTime(0), _showTexel2PixelErrors(false), _showTouchedActor(false), _dragging(false)
|
|
|
{
|
|
{
|
|
|
DebugActor::initialize();
|
|
DebugActor::initialize();
|
|
|
|
|
|
|
@@ -208,7 +208,10 @@ namespace oxygine
|
|
|
|
|
|
|
|
void DebugActor::onAdded2Stage()
|
|
void DebugActor::onAdded2Stage()
|
|
|
{
|
|
{
|
|
|
|
|
+ _dragging = false;
|
|
|
_stage->addEventListener(TouchEvent::MOVE, CLOSURE(this, &DebugActor::onDAEvent));
|
|
_stage->addEventListener(TouchEvent::MOVE, CLOSURE(this, &DebugActor::onDAEvent));
|
|
|
|
|
+ _stage->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DebugActor::onDAEvent));
|
|
|
|
|
+ _stage->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &DebugActor::onDAEvent));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void DebugActor::onRemovedFromStage()
|
|
void DebugActor::onRemovedFromStage()
|
|
@@ -417,7 +420,7 @@ namespace oxygine
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- setPosition(pos);
|
|
|
|
|
|
|
+ //setPosition(pos);
|
|
|
setScale(1.0f / getStage()->getScaleX());
|
|
setScale(1.0f / getStage()->getScaleX());
|
|
|
|
|
|
|
|
|
|
|
|
@@ -478,7 +481,28 @@ namespace oxygine
|
|
|
{
|
|
{
|
|
|
TouchEvent* t = safeCast<TouchEvent*>(ev);
|
|
TouchEvent* t = safeCast<TouchEvent*>(ev);
|
|
|
Vector2 loc = stage2local(t->localPosition, _getStage());
|
|
Vector2 loc = stage2local(t->localPosition, _getStage());
|
|
|
- setAlpha(isOn(loc) ? 64 : 255);
|
|
|
|
|
|
|
+ if (t->type == TouchEvent::MOVE)
|
|
|
|
|
+ {
|
|
|
|
|
+ setAlpha(isOn(loc) ? 64 : 255);
|
|
|
|
|
+
|
|
|
|
|
+ if (_dragging)
|
|
|
|
|
+ {
|
|
|
|
|
+ setPosition(t->localPosition - _local);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (t->type == TouchEvent::TOUCH_DOWN)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (isOn(loc))
|
|
|
|
|
+ {
|
|
|
|
|
+ _local = loc;
|
|
|
|
|
+ _dragging = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (t->type == TouchEvent::TOUCH_UP)
|
|
|
|
|
+ {
|
|
|
|
|
+ _dragging = false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void DebugActor::onEvent(Event* ev)
|
|
void DebugActor::onEvent(Event* ev)
|