Group group = new Group( "group" + i );\r
group.x = (float)Math.random() * (stage.width() - NUM_SPRITES * (32 + SPACING));\r
group.y = (float)Math.random() * (stage.height() - NUM_SPRITES * (32 + SPACING));\r
- group.refX = loc;\r
- group.refY = loc;\r
+ group.originX = loc;\r
+ group.originY = loc;\r
\r
fillGroup( group, texture );\r
stage.addActor( group );\r
{\r
renderer.color( 1, 0, 0, 1 );\r
Group group = stage.getRoot().getGroups().get(i);\r
- renderer.vertex( group.x + group.refX, group.y + group.refY, 0 );\r
+ renderer.vertex( group.x + group.originX, group.y + group.originY, 0 );\r
}\r
renderer.end();\r
Gdx.graphics.getGL10().glPointSize( 4 );\r
import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
import com.badlogic.gdx.math.Vector2;\r
import com.badlogic.gdx.scenes.scene2d.Actor;\r
+import com.badlogic.gdx.scenes.scene2d.Group;\r
import com.badlogic.gdx.scenes.scene2d.Stage;\r
import com.badlogic.gdx.scenes.scene2d.actions.Delay;\r
import com.badlogic.gdx.scenes.scene2d.actions.FadeIn;\r
import com.badlogic.gdx.scenes.scene2d.actions.Sequence;\r
import com.badlogic.gdx.scenes.scene2d.actors.Button;\r
import com.badlogic.gdx.scenes.scene2d.actors.Image;\r
+import com.badlogic.gdx.scenes.scene2d.actors.LinearGroup;\r
+import com.badlogic.gdx.scenes.scene2d.actors.LinearGroup.LinearGroupLayout;\r
\r
public class UITest implements RenderListener, InputListener\r
{\r
, 1 )\r
)\r
);\r
- ui.addActor( img1 );\r
+// ui.addActor( img1 );\r
\r
- Button button = new Button( "button", atlas.getRegion( "button" ), atlas.getRegion( "buttonDown" ) );\r
- button.x = 100;\r
- ui.addActor( button );\r
+ Group group = new Group( "group" );\r
+ group.rotation = 700; \r
+ group.width = 64; group.height = 32 * 3;\r
+ group.originX = group.width / 2; group.originY = group.height / 2;\r
+ group.x = 100;\r
+ group.y = 150;\r
+ Button button = new Button( "button", atlas.getRegion( "button" ), atlas.getRegion( "buttonDown" ) ); \r
+ group.addActor( button );\r
+ ui.addActor( group );\r
\r
+ LinearGroup linear = new LinearGroup( "linear", 64, 32 * 3, LinearGroupLayout.Vertical );\r
+ linear.x = 200; linear.y = 150; linear.scaleX = linear.scaleY = 1;\r
+ linear.addActor( new Button( "blend", atlas.getRegion( "blend" ) ) );\r
+ linear.addActor( new Button( "scale", atlas.getRegion( "scale" ) ) );\r
+ linear.addActor( new Button( "rotate", atlas.getRegion( "rotate" ) ) );\r
+// linear.rotation = 720;\r
+ linear.action( Parallel.$( RotateTo.$( 720, 2 ) ) ); \r
+ \r
+ ui.addActor( linear );\r
+// ui.getRoot().rotation = 720;\r
+ \r
+ Group.enableDebugging( "data/debug.png" );\r
}\r
}\r
\r
if( !ui.touchUp( x, y, pointer ) )\r
{\r
Actor actor = ui.findActor( "image1" );\r
- ui.toStageCoordinates( x, y, point );\r
- actor.clearActions();\r
- actor.action( MoveTo.$( point.x, point.y, 2 ) );\r
- actor.action( RotateTo.$( actor.rotation + 90, 2 ) );\r
- if( actor.scaleX == 1.0f )\r
- actor.action( ScaleTo.$( 0.5f, 0.5f, 2 ) );\r
- else\r
- actor.action( ScaleTo.$( 1f, 1f, 2 ) );\r
+ if( actor != null )\r
+ {\r
+ ui.toStageCoordinates( x, y, point );\r
+ actor.clearActions();\r
+ actor.action( MoveTo.$( point.x, point.y, 2 ) );\r
+ actor.action( RotateTo.$( actor.rotation + 90, 2 ) );\r
+ if( actor.scaleX == 1.0f )\r
+ actor.action( ScaleTo.$( 0.5f, 0.5f, 2 ) );\r
+ else\r
+ actor.action( ScaleTo.$( 1f, 1f, 2 ) );\r
+ }\r
}\r
return false;\r
}\r