Rotation and Selection
This commit is contained in:
25
main.cpp
25
main.cpp
@@ -285,6 +285,27 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RotateButtonListener : public ButtonListener {
|
||||||
|
public:
|
||||||
|
void onButton1MouseClick(BaseButtonInstance*);
|
||||||
|
};
|
||||||
|
|
||||||
|
void RotateButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
|
{
|
||||||
|
if(selectedInstance != NULL)
|
||||||
|
{
|
||||||
|
if(selectedInstance->className == "Part")
|
||||||
|
{
|
||||||
|
PhysicalInstance* part = (PhysicalInstance*) selectedInstance;
|
||||||
|
if(button->name == "Tilt")
|
||||||
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(toRadians(90),0,0));
|
||||||
|
else if(button->name == "Rotate")
|
||||||
|
part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,toRadians(90),0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void deleteInstance()
|
void deleteInstance()
|
||||||
{
|
{
|
||||||
@@ -566,6 +587,8 @@ void initGUI()
|
|||||||
instance->size = Vector2(30,30);
|
instance->size = Vector2(30,30);
|
||||||
instance->position = Vector2(10, 175);
|
instance->position = Vector2(10, 175);
|
||||||
instance->parent = dataModel;
|
instance->parent = dataModel;
|
||||||
|
instance->name = "Rotate";
|
||||||
|
instance->setButtonListener(new RotateButtonListener());
|
||||||
|
|
||||||
instance = makeImageButton(
|
instance = makeImageButton(
|
||||||
Texture::fromFile(GetFileInPath("/content/images/SelectionTilt.png")),
|
Texture::fromFile(GetFileInPath("/content/images/SelectionTilt.png")),
|
||||||
@@ -575,6 +598,8 @@ void initGUI()
|
|||||||
instance->size = Vector2(30,30);
|
instance->size = Vector2(30,30);
|
||||||
instance->position = Vector2(40, 175);
|
instance->position = Vector2(40, 175);
|
||||||
instance->parent = dataModel;
|
instance->parent = dataModel;
|
||||||
|
instance->name = "Tilt";
|
||||||
|
instance->setButtonListener(new RotateButtonListener());
|
||||||
|
|
||||||
|
|
||||||
instance = makeImageButton(
|
instance = makeImageButton(
|
||||||
|
|||||||
Reference in New Issue
Block a user