mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 14:09:06 +00:00
animation editor: fixed widescreen bug that caused bones to jump a distance to the left when clicked. reposition mouse only if necessary. one additional output text.
This commit is contained in:
parent
25dfb44a93
commit
3b39173397
2 changed files with 32 additions and 11 deletions
|
@ -44,15 +44,20 @@ Bone *lastSelectedBone = 0;
|
|||
void AnimationEditor::constrainMouse()
|
||||
{
|
||||
Vector mp=core->mouse.position;
|
||||
if (mp.x < 200) mp.x = 200;
|
||||
if (mp.x > 600) mp.x = 600;
|
||||
if (mp.y < 100) mp.y = 100;
|
||||
if (mp.y > 500) mp.y = 500;
|
||||
core->setMousePosition(mp);
|
||||
bool doit = false;
|
||||
if (mp.x < 200) { mp.x = 200; doit = true; }
|
||||
if (mp.x > 600) { mp.x = 600; doit = true; }
|
||||
if (mp.y < 100) { mp.y = 100; doit = true; }
|
||||
if (mp.y > 500) { mp.y = 500; doit = true; }
|
||||
|
||||
std::ostringstream os;
|
||||
os << "mp(" << mp.x << ", " << mp.y << ")";
|
||||
debugLog(os.str());
|
||||
if(doit)
|
||||
{
|
||||
core->setMousePosition(mp);
|
||||
|
||||
std::ostringstream os;
|
||||
os << "mp(" << mp.x << ", " << mp.y << ")";
|
||||
debugLog(os.str());
|
||||
}
|
||||
}
|
||||
|
||||
KeyframeWidget::KeyframeWidget(int key) : Quad()
|
||||
|
@ -407,6 +412,11 @@ void AnimationEditor::applyState()
|
|||
text->setFontSize(6);
|
||||
addRenderObject(text, LR_HUD);
|
||||
|
||||
text2 = new DebugFont();
|
||||
text2->position = Vector(200,510);
|
||||
text2->setFontSize(6);
|
||||
addRenderObject(text2, LR_HUD);
|
||||
|
||||
editSprite->setSelectedBone(0);
|
||||
|
||||
dsq->overlay->alpha.interpolateTo(0, 0.5);
|
||||
|
@ -656,13 +666,24 @@ void AnimationEditor::update(float dt)
|
|||
os << " keyTime: " << k->t;
|
||||
}
|
||||
|
||||
Vector ebdata;
|
||||
|
||||
if (editingBone)
|
||||
{
|
||||
os << " bone: " << editingBone->name;
|
||||
|
||||
ebdata.x = editingBone->position.x;
|
||||
ebdata.y = editingBone->position.y;
|
||||
ebdata.z = editingBone->rotation.z;
|
||||
}
|
||||
text->setText(os.str());
|
||||
|
||||
char t2buf[256];
|
||||
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f, idx: %d", ebdata.x, ebdata.y,
|
||||
ebdata.z, editSprite->getSelectedBoneIdx());
|
||||
text2->setText(t2buf);
|
||||
|
||||
|
||||
|
||||
if (core->mouse.buttons.middle)
|
||||
{
|
||||
editSprite->position += core->mouse.change;
|
||||
|
@ -737,7 +758,7 @@ void AnimationEditor::update(float dt)
|
|||
}
|
||||
if (editingBone && boneEdit == 1)
|
||||
{
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset + core->getVirtualOffX();
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset;
|
||||
constrainMouse();
|
||||
}
|
||||
if (editingBone && boneEdit == 2)
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
SkeletalSprite *editSprite;
|
||||
Bone *editingBone;
|
||||
int boneEdit;
|
||||
DebugFont *text;
|
||||
DebugFont *text, *text2;
|
||||
int ignoreBone;
|
||||
|
||||
void ignoreBone0();
|
||||
|
|
Loading…
Reference in a new issue