Move Editor to Artemis-based runtime:
* Epic artemis switch! * Update to 0.0.8-SNAPSHOT
This commit is contained in:
@@ -3,7 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'games.rednblack'
|
||||
version '0.0.7'
|
||||
version '0.0.8'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -12,8 +12,8 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||
implementation "com.badlogicgames.ashley:ashley:$ashleyVersion"
|
||||
implementation "com.kotcrab.vis:vis-ui:$visuiVersion"
|
||||
implementation "net.onedaybeard.artemis:artemis-odb:$artemisVersion"
|
||||
|
||||
implementation 'net.mountainblade:modular:1.0'
|
||||
|
||||
|
||||
+8
-10
@@ -1,6 +1,5 @@
|
||||
package games.rednblack.editor.plugin.ninepatch;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.g2d.NinePatch;
|
||||
@@ -56,8 +55,8 @@ public class MainPanelMediator extends Mediator<MainPanel> {
|
||||
convertImageToNinePatch();
|
||||
break;
|
||||
case MainPanel.SAVE_CLICKED:
|
||||
Entity entity = plugin.currEditingEntity;
|
||||
NinePatchComponent ninePatchComponent = ComponentRetriever.get(entity, NinePatchComponent.class);
|
||||
int entity = plugin.currEditingEntity;
|
||||
NinePatchComponent ninePatchComponent = ComponentRetriever.get(entity, NinePatchComponent.class, plugin.getAPI().getEngine());
|
||||
applyNewSplits(ninePatchComponent.textureRegionName, viewComponent.getSplits());
|
||||
viewComponent.hide();
|
||||
break;
|
||||
@@ -65,12 +64,12 @@ public class MainPanelMediator extends Mediator<MainPanel> {
|
||||
}
|
||||
|
||||
private void convertImageToNinePatch() {
|
||||
Entity entity = plugin.currEditingEntity;
|
||||
MainItemComponent mainItemComponent = ComponentRetriever.get(entity, MainItemComponent.class);
|
||||
int entity = plugin.currEditingEntity;
|
||||
MainItemComponent mainItemComponent = ComponentRetriever.get(entity, MainItemComponent.class, plugin.getAPI().getEngine());
|
||||
mainItemComponent.entityType = EntityFactory.NINE_PATCH;
|
||||
TextureRegionComponent textureRegionComponent = ComponentRetriever.get(entity, TextureRegionComponent.class);
|
||||
TextureRegionComponent textureRegionComponent = ComponentRetriever.get(entity, TextureRegionComponent.class, plugin.getAPI().getEngine());
|
||||
String regionName = textureRegionComponent.regionName;
|
||||
NinePatchComponent ninePatchComponent = plugin.getAPI().getEngine().createComponent(NinePatchComponent.class);
|
||||
NinePatchComponent ninePatchComponent = plugin.getAPI().getEngine().edit(entity).create(NinePatchComponent.class);
|
||||
ninePatchComponent.textureRegionName = regionName;
|
||||
TextureAtlas.AtlasRegion newRegion = (TextureAtlas.AtlasRegion) textureRegionComponent.region;
|
||||
int[] splits = {0, 0, 0, 0};
|
||||
@@ -78,7 +77,6 @@ public class MainPanelMediator extends Mediator<MainPanel> {
|
||||
newRegion.names = new String[] {"split", "pad"};
|
||||
newRegion.values = new int[][] {splits, pad};
|
||||
ninePatchComponent.ninePatch = new NinePatch(textureRegionComponent.region, 0, 0, 0, 0);
|
||||
entity.add(ninePatchComponent);
|
||||
|
||||
//remove original image
|
||||
File originalImg = new File(plugin.getAPI().getProjectPath() + "/assets/orig/images/"+regionName+".png");
|
||||
@@ -93,8 +91,8 @@ public class MainPanelMediator extends Mediator<MainPanel> {
|
||||
}
|
||||
|
||||
private void loadNinePatch() {
|
||||
Entity entity = plugin.currEditingEntity;
|
||||
NinePatchComponent ninePatchComponent = ComponentRetriever.get(entity, NinePatchComponent.class);
|
||||
int entity = plugin.currEditingEntity;
|
||||
NinePatchComponent ninePatchComponent = ComponentRetriever.get(entity, NinePatchComponent.class, plugin.getAPI().getEngine());
|
||||
loadRegion(ninePatchComponent.textureRegionName);
|
||||
viewComponent.show(plugin.getAPI().getUIStage());
|
||||
}
|
||||
|
||||
+4
-5
@@ -1,6 +1,5 @@
|
||||
package games.rednblack.editor.plugin.ninepatch;
|
||||
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import games.rednblack.editor.renderer.components.MainItemComponent;
|
||||
import games.rednblack.editor.renderer.factory.EntityFactory;
|
||||
@@ -23,7 +22,7 @@ public class NinePatchPlugin extends H2DPluginAdapter {
|
||||
|
||||
private MainPanelMediator performancePanelMediator;
|
||||
|
||||
public Entity currEditingEntity;
|
||||
public int currEditingEntity;
|
||||
|
||||
public NinePatchPlugin() {
|
||||
super(CLASS_NAME);
|
||||
@@ -38,10 +37,10 @@ public class NinePatchPlugin extends H2DPluginAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDropDownOpen(Set<Entity> selectedEntities, Array<String> actionsSet) {
|
||||
public void onDropDownOpen(Set<Integer> selectedEntities, Array<String> actionsSet) {
|
||||
if(selectedEntities.size() == 1) {
|
||||
Entity entity = selectedEntities.stream().findFirst().get();
|
||||
MainItemComponent mainItemComponent = ComponentRetriever.get(entity, MainItemComponent.class);
|
||||
int entity = selectedEntities.stream().findFirst().get();
|
||||
MainItemComponent mainItemComponent = ComponentRetriever.get(entity, MainItemComponent.class, getAPI().getEngine());
|
||||
|
||||
if(mainItemComponent.entityType == EntityFactory.NINE_PATCH) {
|
||||
// it's our guy
|
||||
|
||||
Reference in New Issue
Block a user