-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #9
- Loading branch information
Showing
3 changed files
with
84 additions
and
17 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/com/blastedstudios/gdxworld/plugin/mode/joint/window/rope/RopePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.blastedstudios.gdxworld.plugin.mode.joint.window.rope; | ||
|
||
import net.xeoh.plugins.base.annotations.PluginImplementation; | ||
|
||
import com.badlogic.gdx.physics.box2d.JointDef.JointType; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Skin; | ||
import com.blastedstudios.gdxworld.plugin.mode.joint.BaseJointWindow; | ||
import com.blastedstudios.gdxworld.plugin.mode.joint.IJointWindow; | ||
import com.blastedstudios.gdxworld.plugin.mode.joint.JointMode; | ||
import com.blastedstudios.gdxworld.world.joint.RopeJoint; | ||
|
||
@PluginImplementation | ||
public class RopePlugin implements IJointWindow<RopeJoint>{ | ||
@Override public JointType getJointType() { | ||
return JointType.RopeJoint; | ||
} | ||
|
||
@Override public RopeJoint createJoint(RopeJoint joint) { | ||
return joint == null ? new RopeJoint() : joint; | ||
} | ||
|
||
@Override public BaseJointWindow createJointWindow(Skin skin, JointMode mode, RopeJoint joint) { | ||
return new RopeWindow(skin, mode, joint); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/com/blastedstudios/gdxworld/plugin/mode/joint/window/rope/RopeWindow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.blastedstudios.gdxworld.plugin.mode.joint.window.rope; | ||
|
||
import com.badlogic.gdx.math.Vector2; | ||
import com.badlogic.gdx.physics.box2d.JointDef.JointType; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Label; | ||
import com.badlogic.gdx.scenes.scene2d.ui.Skin; | ||
import com.blastedstudios.gdxworld.plugin.mode.joint.BaseJointWindow; | ||
import com.blastedstudios.gdxworld.plugin.mode.joint.JointMode; | ||
import com.blastedstudios.gdxworld.ui.leveleditor.VertexTable; | ||
import com.blastedstudios.gdxworld.world.joint.RopeJoint; | ||
|
||
class RopeWindow extends BaseJointWindow { | ||
private final VertexTable centerTable; | ||
private final RopeJoint joint; | ||
|
||
public RopeWindow(Skin skin, JointMode mode, RopeJoint joint) { | ||
super("Rope Editor", skin, JointType.RopeJoint, mode, joint); | ||
this.joint = joint; | ||
centerTable = new VertexTable(joint.getCenter(), skin); | ||
add(new Label("Anchor: ", skin)); | ||
add(centerTable); | ||
row(); | ||
add(createControlTable()).colspan(2); | ||
pack(); | ||
} | ||
|
||
@Override public void apply(){ | ||
super.apply(); | ||
joint.setCenter(centerTable.getVertex()); | ||
} | ||
|
||
@Override public boolean clicked(Vector2 pos) { | ||
if(!super.clicked(pos)) | ||
centerTable.setVertex(pos.x, pos.y); | ||
return true; | ||
} | ||
|
||
@Override public Vector2 getCenter() { | ||
return centerTable.getVertex(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters