Show splash screen by double click logo
This commit is contained in:
@@ -71,4 +71,22 @@ public class HyperLap2DApp extends ApplicationAdapter {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showUISplashWindow() {
|
||||
Lwjgl3Application app = (Lwjgl3Application) Gdx.app;
|
||||
|
||||
Lwjgl3ApplicationConfiguration config2 = new Lwjgl3ApplicationConfiguration();
|
||||
config2.setWindowedMode(467, 385);
|
||||
config2.setTitle("HyperLap2D");
|
||||
config2.setResizable(false);
|
||||
config2.setDecorated(false);
|
||||
config2.useVsync(false);
|
||||
config2.setIdleFPS(60);
|
||||
config2.setWindowIcon("hyperlap_icon_96.png");
|
||||
|
||||
SplashScreenAdapter adapter = new SplashScreenAdapter();
|
||||
adapter.setLoading(false);
|
||||
|
||||
splashWindow = app.newWindow(adapter, config2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package games.rednblack.editor.splash;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.InputMultiplexer;
|
||||
import com.badlogic.gdx.ScreenAdapter;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
|
||||
@@ -8,8 +9,9 @@ public class SplashScreen extends ScreenAdapter {
|
||||
|
||||
private SplashStage stage;
|
||||
|
||||
public SplashScreen() {
|
||||
stage = new SplashStage();
|
||||
public SplashScreen(boolean loading) {
|
||||
stage = new SplashStage(loading);
|
||||
Gdx.input.setInputProcessor(stage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,13 +27,18 @@ public class SplashScreenAdapter extends Game {
|
||||
public static final String CLOSE_SPLASH = prefix + ".CLOSE";
|
||||
|
||||
private SplashScreen screen;
|
||||
private boolean isLoading = true;
|
||||
|
||||
@Override
|
||||
public void create () {
|
||||
screen = new SplashScreen();
|
||||
screen = new SplashScreen(isLoading);
|
||||
setScreen(screen);
|
||||
}
|
||||
|
||||
public void setLoading(boolean loading) {
|
||||
isLoading = loading;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package games.rednblack.editor.splash;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
@@ -15,8 +17,10 @@ public class SplashStage extends Stage {
|
||||
private TextureAtlas atlas;
|
||||
private Image logoText;
|
||||
private Label progress;
|
||||
private boolean isLoading = true;
|
||||
|
||||
public SplashStage() {
|
||||
public SplashStage(boolean isLoading) {
|
||||
this.isLoading = isLoading;
|
||||
atlas = new TextureAtlas(Gdx.files.internal("splash/splash.atlas"));
|
||||
BitmapFont robotFont = new BitmapFont(Gdx.files.internal("splash/myriad.fnt"));
|
||||
Label.LabelStyle whiteLabelStyle = new Label.LabelStyle(robotFont, new Color(1, 1, 1, 1f));
|
||||
@@ -48,7 +52,8 @@ public class SplashStage extends Stage {
|
||||
progress = new Label("Loading fonts", blackLabelStyle);
|
||||
progress.setX(logoText.getX() + ((logoText.getWidth() - progress.getWidth() )/ 2));
|
||||
progress.setY(logo.getY() + 5);
|
||||
addActor(progress);
|
||||
if (isLoading)
|
||||
addActor(progress);
|
||||
|
||||
Label companyName = new Label("Red & Black Games", whiteLabelStyle);
|
||||
companyName.setX(13);
|
||||
@@ -68,6 +73,15 @@ public class SplashStage extends Stage {
|
||||
setProgressStatus("Initializing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
super.touchUp(screenX, screenY, pointer, button);
|
||||
if (!isLoading) {
|
||||
HyperLap2DApp.getInstance().splashWindow.closeWindow();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setProgressStatus(String status) {
|
||||
progress.setText(status);
|
||||
progress.setX(logoText.getX() + ((logoText.getWidth() - progress.getWidth()) / 2));
|
||||
|
||||
-26
@@ -161,31 +161,5 @@ public class UIScenePropertiesMediator extends UIAbstractPropertiesMediator<Scen
|
||||
|
||||
Object payload = UpdateSceneDataCommand.payload(observableReference, physicsVO, lightsVO);
|
||||
facade.sendNotification(MsgAPI.ACTION_UPDATE_SCENE_DATA, payload);
|
||||
|
||||
/*PhysicsPropertiesVO physicsVO = observableReference.physicsPropertiesVO;
|
||||
physicsVO.gravityX = NumberUtils.toFloat(viewComponent.getGravityXValue(), physicsVO.gravityX);
|
||||
physicsVO.gravityY = NumberUtils.toFloat(viewComponent.getGravityYValue(), physicsVO.gravityY);
|
||||
physicsVO.sleepVelocity = NumberUtils.toFloat(viewComponent.getSleepVelocityValue(), physicsVO.sleepVelocity);
|
||||
physicsVO.enabled = viewComponent.isPhysicsEnabled();
|
||||
|
||||
LightsPropertiesVO lightsVO = observableReference.lightsPropertiesVO;
|
||||
Color color = viewComponent.getAmbientColor();
|
||||
lightsVO.ambientColor[0] = color.r;
|
||||
lightsVO.ambientColor[1] = color.g;
|
||||
lightsVO.ambientColor[2] = color.b;
|
||||
lightsVO.ambientColor[3] = color.a;
|
||||
lightsVO.blurNum = NumberUtils.toInt(viewComponent.getBlurNumValue(), lightsVO.blurNum);
|
||||
lightsVO.lightType = viewComponent.getLightType();
|
||||
lightsVO.directionalDegree = NumberUtils.toFloat(viewComponent.getDirectionalDegree(), lightsVO.directionalDegree);
|
||||
lightsVO.directionalRays = NumberUtils.toInt(viewComponent.getDirectionalRays(), lightsVO.directionalRays);
|
||||
color = viewComponent.getDirectionalColor();
|
||||
lightsVO.directionalColor[0] = color.r;
|
||||
lightsVO.directionalColor[1] = color.g;
|
||||
lightsVO.directionalColor[2] = color.b;
|
||||
lightsVO.directionalColor[3] = color.a;
|
||||
|
||||
lightsVO.enabled = viewComponent.isLightsEnabled();
|
||||
|
||||
Sandbox.getInstance().sceneControl.updateAmbientLights();*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,19 +18,27 @@
|
||||
|
||||
package games.rednblack.editor.view.ui.widget;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.kotcrab.vis.ui.VisUI;
|
||||
import com.kotcrab.vis.ui.widget.VisImage;
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
import games.rednblack.editor.HyperLap2DApp;
|
||||
|
||||
/**
|
||||
* Created by sargis on 4/23/15.
|
||||
*/
|
||||
public class H2DLogo extends VisTable {
|
||||
public H2DLogo() {
|
||||
Skin skin = VisUI.getSkin();
|
||||
setBackground(skin.getDrawable("menu-bg"));
|
||||
VisImage logo = new VisImage(VisUI.getSkin().getDrawable("logo"));
|
||||
add(logo).width(logo.getWidth()).height(logo.getHeight()).padLeft(7);
|
||||
logo.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
super.clicked(event, x, y);
|
||||
if (getTapCount() == 2)
|
||||
HyperLap2DApp.getInstance().showUISplashWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user