diff --git a/art/splash_textures/splash_bg.png b/art/splash_textures/splash_bg.png index dcba81c2..7628338b 100644 Binary files a/art/splash_textures/splash_bg.png and b/art/splash_textures/splash_bg.png differ diff --git a/assets/splash/splash.atlas b/assets/splash/splash.atlas index efc99f91..fd8aea81 100644 --- a/assets/splash/splash.atlas +++ b/assets/splash/splash.atlas @@ -6,7 +6,7 @@ filter: Nearest,Nearest repeat: none bg_color rotate: false - xy: 471, 480 + xy: 471, 444 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -14,8 +14,8 @@ bg_color splash_bg rotate: false xy: 2, 122 - size: 467, 366 - orig: 467, 366 + size: 467, 330 + orig: 467, 330 offset: 0, 0 index: -1 splash_logo diff --git a/assets/splash/splash.png b/assets/splash/splash.png index 8c1e5722..3d1feaa0 100644 Binary files a/assets/splash/splash.png and b/assets/splash/splash.png differ diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/MsgAPI.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/MsgAPI.java index a7d44159..6390ff73 100644 --- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/MsgAPI.java +++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/MsgAPI.java @@ -100,6 +100,7 @@ public class MsgAPI { public static final String ACTION_RELEASE_SELECTION = SANDBOX_PREFIX + "ACTION_RELEASE_SELECTION"; public static final String ACTION_Z_INDEX_CHANGED = SANDBOX_PREFIX + "ACTION_Z_INDEX_CHANGED"; + public static final String ACTION_UPDATE_SCENE_DATA = SANDBOX_PREFIX + "ACTION_UPDATE_SCENE_DATA"; public static final String ACTION_UPDATE_IMAGE_ITEM_DATA = SANDBOX_PREFIX + "ACTION_UPDATE_IMAGE_ITEM_DATA"; public static final String ACTION_UPDATE_ITEM_DATA = SANDBOX_PREFIX + "ACTION_UPDATE_ITEM_DATA"; public static final String ACTION_UPDATE_LABEL_DATA = SANDBOX_PREFIX + "ACTION_UPDATE_LABEL_DATA"; diff --git a/src/main/java/games/rednblack/editor/HyperLap2DApp.java b/src/main/java/games/rednblack/editor/HyperLap2DApp.java index f3aee5ec..7d84194d 100644 --- a/src/main/java/games/rednblack/editor/HyperLap2DApp.java +++ b/src/main/java/games/rednblack/editor/HyperLap2DApp.java @@ -5,15 +5,10 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window; -import com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowListener; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.editor.utils.AppConfig; -import games.rednblack.h2d.common.MsgAPI; import org.apache.commons.lang3.SystemUtils; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - public class HyperLap2DApp extends ApplicationAdapter { private static HyperLap2DApp sInstance = null; @@ -42,7 +37,7 @@ public class HyperLap2DApp extends ApplicationAdapter { Lwjgl3Application app = (Lwjgl3Application) Gdx.app; Lwjgl3ApplicationConfiguration config2 = new Lwjgl3ApplicationConfiguration(); - config2.setWindowedMode(467, 415); + config2.setWindowedMode(467, 385); config2.setTitle("HyperLap2D"); config2.setResizable(false); config2.setDecorated(false); diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java index 30adb1f9..207695e2 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java @@ -69,6 +69,7 @@ public class BootstrapCommand extends SimpleCommand { facade.registerCommand(MsgAPI.ACTION_UPDATE_RULER_POSITION, ChangeRulerPositionCommand.class); // DATA MODIFY by components + facade.registerCommand(MsgAPI.ACTION_UPDATE_SCENE_DATA, UpdateSceneDataCommand.class); facade.registerCommand(MsgAPI.ACTION_UPDATE_ITEM_DATA, UpdateEntityComponentsCommand.class); facade.registerCommand(MsgAPI.ACTION_UPDATE_LABEL_DATA, UpdateLabelDataCommand.class); facade.registerCommand(MsgAPI.ACTION_UPDATE_LIGHT_DATA, UpdateLightDataCommand.class); diff --git a/src/main/java/games/rednblack/editor/controller/commands/UpdateSceneDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/UpdateSceneDataCommand.java new file mode 100644 index 00000000..ae9cfcaa --- /dev/null +++ b/src/main/java/games/rednblack/editor/controller/commands/UpdateSceneDataCommand.java @@ -0,0 +1,89 @@ +package games.rednblack.editor.controller.commands; + +import games.rednblack.editor.renderer.data.LightsPropertiesVO; +import games.rednblack.editor.renderer.data.PhysicsPropertiesVO; +import games.rednblack.editor.renderer.data.SceneVO; +import games.rednblack.editor.view.stage.Sandbox; +import games.rednblack.h2d.common.MsgAPI; + +public class UpdateSceneDataCommand extends EntityModifyRevertibleCommand { + + private SceneVO sceneVO; + private PhysicsPropertiesVO physicsBackup; + private LightsPropertiesVO lightsBackup; + + @Override + public void doAction() { + Object[] payload = getNotification().getBody(); + sceneVO = (SceneVO) payload[0]; + PhysicsPropertiesVO physicsPropertiesVO = (PhysicsPropertiesVO) payload[1]; + LightsPropertiesVO lightsPropertiesVO = (LightsPropertiesVO) payload[2]; + + physicsBackup = new PhysicsPropertiesVO(sceneVO.physicsPropertiesVO); + lightsBackup = new LightsPropertiesVO(sceneVO.lightsPropertiesVO); + + PhysicsPropertiesVO physicsVO = sceneVO.physicsPropertiesVO; + physicsVO.gravityX = physicsPropertiesVO.gravityX; + physicsVO.gravityY = physicsPropertiesVO.gravityY; + physicsVO.sleepVelocity = physicsPropertiesVO.sleepVelocity; + physicsVO.enabled = physicsPropertiesVO.enabled; + + LightsPropertiesVO lightsVO = sceneVO.lightsPropertiesVO; + lightsVO.ambientColor[0] = lightsPropertiesVO.ambientColor[0]; + lightsVO.ambientColor[1] = lightsPropertiesVO.ambientColor[1]; + lightsVO.ambientColor[2] = lightsPropertiesVO.ambientColor[2]; + lightsVO.ambientColor[3] = lightsPropertiesVO.ambientColor[3]; + lightsVO.blurNum = lightsPropertiesVO.blurNum; + lightsVO.lightType = lightsPropertiesVO.lightType; + lightsVO.directionalDegree = lightsPropertiesVO.directionalDegree; + lightsVO.directionalRays = lightsPropertiesVO.directionalRays; + lightsVO.directionalColor[0] = lightsPropertiesVO.directionalColor[0]; + lightsVO.directionalColor[1] = lightsPropertiesVO.directionalColor[1]; + lightsVO.directionalColor[2] = lightsPropertiesVO.directionalColor[2]; + lightsVO.directionalColor[3] = lightsPropertiesVO.directionalColor[3]; + + lightsVO.enabled = lightsPropertiesVO.enabled; + + Sandbox.getInstance().sceneControl.updateAmbientLights(); + + facade.sendNotification(MsgAPI.ITEM_DATA_UPDATED); + } + + @Override + public void undoAction() { + PhysicsPropertiesVO physicsVO = sceneVO.physicsPropertiesVO; + physicsVO.gravityX = physicsBackup.gravityX; + physicsVO.gravityY = physicsBackup.gravityY; + physicsVO.sleepVelocity = physicsBackup.sleepVelocity; + physicsVO.enabled = physicsBackup.enabled; + + LightsPropertiesVO lightsVO = sceneVO.lightsPropertiesVO; + lightsVO.ambientColor[0] = lightsBackup.ambientColor[0]; + lightsVO.ambientColor[1] = lightsBackup.ambientColor[1]; + lightsVO.ambientColor[2] = lightsBackup.ambientColor[2]; + lightsVO.ambientColor[3] = lightsBackup.ambientColor[3]; + lightsVO.blurNum = lightsBackup.blurNum; + lightsVO.lightType = lightsBackup.lightType; + lightsVO.directionalDegree = lightsBackup.directionalDegree; + lightsVO.directionalRays = lightsBackup.directionalRays; + lightsVO.directionalColor[0] = lightsBackup.directionalColor[0]; + lightsVO.directionalColor[1] = lightsBackup.directionalColor[1]; + lightsVO.directionalColor[2] = lightsBackup.directionalColor[2]; + lightsVO.directionalColor[3] = lightsBackup.directionalColor[3]; + + lightsVO.enabled = lightsBackup.enabled; + + Sandbox.getInstance().sceneControl.updateAmbientLights(); + + facade.sendNotification(MsgAPI.ITEM_DATA_UPDATED); + } + + public static Object payload(SceneVO scene, PhysicsPropertiesVO physicsPropertiesVO, LightsPropertiesVO lightsPropertiesVO) { + Object[] payload = new Object[3]; + payload[0] = scene; + payload[1] = physicsPropertiesVO; + payload[2] = lightsPropertiesVO; + + return payload; + } +} diff --git a/src/main/java/games/rednblack/editor/splash/SplashStage.java b/src/main/java/games/rednblack/editor/splash/SplashStage.java index 1b53394f..6fb04058 100644 --- a/src/main/java/games/rednblack/editor/splash/SplashStage.java +++ b/src/main/java/games/rednblack/editor/splash/SplashStage.java @@ -19,9 +19,11 @@ public class SplashStage extends Stage { public SplashStage() { atlas = new TextureAtlas(Gdx.files.internal("splash/splash.atlas")); BitmapFont robotFont = new BitmapFont(Gdx.files.internal("splash/myriad.fnt")); - Label.LabelStyle labelStyle = new Label.LabelStyle(robotFont, new Color(0, 0, 0, 1f)); + Label.LabelStyle whiteLabelStyle = new Label.LabelStyle(robotFont, new Color(1, 1, 1, 1f)); + Label.LabelStyle blackLabelStyle = new Label.LabelStyle(robotFont, new Color(0, 0, 0, 1f)); Image bg = new Image(atlas.findRegion("bg_color")); + bg.setColor(0, 0, 0, 1); bg.setX(0); bg.setY(0); bg.setWidth(getWidth()); @@ -43,22 +45,22 @@ public class SplashStage extends Stage { logoText.setY(logo.getY() + 30); addActor(logoText); - progress = new Label("Loading fonts", labelStyle); + progress = new Label("Loading fonts", blackLabelStyle); progress.setX(logoText.getX() + ((logoText.getWidth() - progress.getWidth() )/ 2)); progress.setY(logo.getY() + 5); addActor(progress); - Label companyName = new Label("Red & Black Games", labelStyle); + Label companyName = new Label("Red & Black Games", whiteLabelStyle); companyName.setX(13); companyName.setY(55 - companyName.getHeight() - 7); addActor(companyName); - Label copyright = new Label("Copyright (c) 2020. All rights reserved.", labelStyle); + Label copyright = new Label("Copyright (c) 2020, All rights reserved.", whiteLabelStyle); copyright.setX(13); copyright.setY(companyName.getY() - 20); addActor(copyright); - Label version = new Label(AppConfig.getInstance().version, labelStyle); + Label version = new Label("v" + AppConfig.getInstance().version, whiteLabelStyle); version.setX(getWidth() - 13 - version.getWidth()); version.setY(companyName.getY()); addActor(version); diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java b/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java index 89ab7a68..20f6dce8 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java @@ -65,7 +65,7 @@ public abstract class UIAbstractPropertiesMediator