Android Open Source - CircleWorldGDX Avatar Edit Control Screen






From Project

Back to project page CircleWorldGDX.

License

The source code is released under:

MIT License

If you think the Android project CircleWorldGDX listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.fdangelo.circleworld.gui;
/*w w  w.  ja va  2 s .  c om*/
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.esotericsoftware.tablelayout.Value;
import com.fdangelo.circleworld.gui.core.Screen;
import com.fdangelo.circleworld.universeview.objects.AvatarInputEditTool;
import com.fdangelo.circleworld.universeview.objects.AvatarInputMode;
import com.fdangelo.circleworld.universeview.objects.AvatarViewInput;

public class AvatarEditControlScreen extends Screen {
  
  private Label tooltip;
  
  @Override
  protected void initScreen() {
    
    Table bottom = new Table();
    
    Button toolNone = new TextButton("None", getDefaultSkin());
    Button toolAddTiles = new TextButton("Add Tiles", getDefaultSkin());
    Button toolRemoveTiles = new TextButton("Remove Tiles", getDefaultSkin());
    Button toolMoveCamera = new TextButton("Move Camera", getDefaultSkin());
    
    toolNone.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        onToolNoneClicked();
      }
    });
    
    toolAddTiles.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        onToolAddTilesClicked();
      }
    });
    
    toolRemoveTiles.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        onToolRemoveTilesClicked();
      }
    });
    
    toolMoveCamera.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        onToolMoveCameraClicked();
      }
    });
        
    bottom.add(toolNone).width(Value.percentWidth(0.25f)).height(Value.percentHeight(1));
    bottom.add(toolAddTiles).width(Value.percentWidth(0.25f)).height(Value.percentHeight(1));
    bottom.add(toolRemoveTiles).width(Value.percentWidth(0.25f)).height(Value.percentHeight(1));
    bottom.add(toolMoveCamera).width(Value.percentWidth(0.25f)).height(Value.percentHeight(1));
    
    tooltip = new Label("Select a tool", getDefaultSkin());
    
    getScreenTable().add(tooltip).expandY().bottom();
    getScreenTable().row();
    getScreenTable().add(bottom).width(Value.percentWidth(1.0f)).height(Value.percentHeight(0.25f)).bottom();
  }
  
  public final void setTool(AvatarInputEditTool tool) {
    AvatarViewInput.mode = AvatarInputMode.Edit;
    AvatarViewInput.editTool = tool;
    
    switch(tool) {
      case None:
        tooltip.setText("Select a tool");
        break;
      case Add:
        tooltip.setText("[Add Tiles] -> Tap to add tiles");
        break;
      case Remove:
        tooltip.setText("[Remove Tiles] -> Tap to remove tiles");
        break;
      case MoveCamera:
        tooltip.setText("[Move Camera] -> Pan to move camera");
        break;
    }
  }
  
  private final void onToolNoneClicked() {
    setTool(AvatarInputEditTool.None);
  }
  
  private final void onToolAddTilesClicked() {
    setTool(AvatarInputEditTool.Add);
  }

  private final void onToolRemoveTilesClicked() {
    setTool(AvatarInputEditTool.Remove);
  }

  private final void onToolMoveCameraClicked() {
    setTool(AvatarInputEditTool.MoveCamera);
  }
}




Java Source Code List

.AssetsUpdater.java
com.fdangelo.circleworld.GameLogicState.java
com.fdangelo.circleworld.GameLogic.java
com.fdangelo.circleworld.MainActivity.java
com.fdangelo.circleworld.Main.java
com.fdangelo.circleworld.MyGdxGame.java
com.fdangelo.circleworld.RobovmLauncher.java
com.fdangelo.circleworld.client.GwtLauncher.java
com.fdangelo.circleworld.gui.AvatarEditControlScreen.java
com.fdangelo.circleworld.gui.AvatarMoveControlScreen.java
com.fdangelo.circleworld.gui.HudScreen.java
com.fdangelo.circleworld.gui.core.Gui.java
com.fdangelo.circleworld.gui.core.ScreenTable.java
com.fdangelo.circleworld.gui.core.Screen.java
com.fdangelo.circleworld.universeengine.IUniverseListener.java
com.fdangelo.circleworld.universeengine.ThingPosition.java
com.fdangelo.circleworld.universeengine.ThingType.java
com.fdangelo.circleworld.universeengine.Thing.java
com.fdangelo.circleworld.universeengine.UniverseFactory.java
com.fdangelo.circleworld.universeengine.UniverseGeneratorDefault.java
com.fdangelo.circleworld.universeengine.UniverseGenerator.java
com.fdangelo.circleworld.universeengine.Universe.java
com.fdangelo.circleworld.universeengine.objects.AvatarInput.java
com.fdangelo.circleworld.universeengine.objects.Avatar.java
com.fdangelo.circleworld.universeengine.objects.FollowParentParameters.java
com.fdangelo.circleworld.universeengine.objects.IUniverseObjectListener.java
com.fdangelo.circleworld.universeengine.objects.ShipInput.java
com.fdangelo.circleworld.universeengine.objects.Ship.java
com.fdangelo.circleworld.universeengine.objects.UniverseObject.java
com.fdangelo.circleworld.universeengine.tilemap.ITilemapCircleListener.java
com.fdangelo.circleworld.universeengine.tilemap.PlanetType.java
com.fdangelo.circleworld.universeengine.tilemap.PlanetTypes.java
com.fdangelo.circleworld.universeengine.tilemap.Planet.java
com.fdangelo.circleworld.universeengine.tilemap.TileDirection.java
com.fdangelo.circleworld.universeengine.tilemap.TileHitFlags.java
com.fdangelo.circleworld.universeengine.tilemap.TileHitInfo.java
com.fdangelo.circleworld.universeengine.tilemap.TileSubtype.java
com.fdangelo.circleworld.universeengine.tilemap.TileType.java
com.fdangelo.circleworld.universeengine.tilemap.TileTypes.java
com.fdangelo.circleworld.universeengine.tilemap.TilemapCircle.java
com.fdangelo.circleworld.universeengine.utils.DataPools.java
com.fdangelo.circleworld.universeengine.utils.PoolByte.java
com.fdangelo.circleworld.universeengine.utils.PoolColor.java
com.fdangelo.circleworld.universeengine.utils.PoolFloat.java
com.fdangelo.circleworld.universeengine.utils.PoolInt.java
com.fdangelo.circleworld.universeengine.utils.PoolVector2.java
com.fdangelo.circleworld.universeengine.utils.PoolVector3.java
com.fdangelo.circleworld.universeengine.utils.UEProfilerSample.java
com.fdangelo.circleworld.universeengine.utils.UEProfiler.java
com.fdangelo.circleworld.universeview.FollowCameraParameters.java
com.fdangelo.circleworld.universeview.UniverseViewCamera.java
com.fdangelo.circleworld.universeview.UniverseViewFactory.java
com.fdangelo.circleworld.universeview.UniverseView.java
com.fdangelo.circleworld.universeview.objects.AvatarInputEditTool.java
com.fdangelo.circleworld.universeview.objects.AvatarInputMode.java
com.fdangelo.circleworld.universeview.objects.AvatarViewInput.java
com.fdangelo.circleworld.universeview.objects.AvatarView.java
com.fdangelo.circleworld.universeview.objects.InputAreas.java
com.fdangelo.circleworld.universeview.objects.ShipInputMode.java
com.fdangelo.circleworld.universeview.objects.ShipViewInput.java
com.fdangelo.circleworld.universeview.objects.ShipView.java
com.fdangelo.circleworld.universeview.objects.UniverseObjectView.java
com.fdangelo.circleworld.universeview.tilemap.PlanetView.java
com.fdangelo.circleworld.universeview.tilemap.TilemapCircleViewBackgroundRenderer.java
com.fdangelo.circleworld.universeview.tilemap.TilemapCircleViewRenderer.java
com.fdangelo.circleworld.universeview.tilemap.TilemapCircleView.java
com.fdangelo.circleworld.utils.Mathf.java
com.fdangelo.circleworld.utils.Vector2I.java