Skip to content

Commit

Permalink
Version 0.6.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
crykn committed Jul 22, 2020
1 parent 8fe1e4c commit a7006b4
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## What is libgdx-screenmanager?

[![Release](https://jitpack.io/v/crykn/libgdx-screenmanager.svg)](https://jitpack.io/#crykn/libgdx-screenmanager) [![Build Status](https://travis-ci.com/crykn/libgdx-screenmanager.svg?branch=master)](https://travis-ci.com/crykn/libgdx-screenmanager)
[![Release](https://jitpack.io/v/crykn/libgdx-screenmanager.svg)](https://jitpack.io/#crykn/libgdx-screenmanager) [![Build Status](https://travis-ci.com/crykn/libgdx-screenmanager.svg?branch=master)](https://travis-ci.com/crykn/libgdx-screenmanager) [![GWT Compatible](https://img.shields.io/badge/GWT-compatible-informational)](https://github.com/crykn/libgdx-screenmanager/wiki/How-to-get-it-working-with-GWT)

This library is a screen manager for libGDX games. It allows comfortably changing the rendered screen while using transition effects. The library's easy to use nature makes it possible to integrate libgdx-screenmanager into any project without much effort.

## Features

* Allows easily **changing the rendered screen** (`game.getScreenManager().pushScreen("screen_name", "transition_name")`)
* Allows easily **changing the rendered screen**: `game.getScreenManager().pushScreen("screen_name", "transition_name")`
* Adds **screen transition effects** for when a screen is changed. The included transitions can be found [here](https://github.com/crykn/libgdx-screenmanager/wiki/Available-transitions). Furthermore, transition shaders are supported as well (see the [GL Transitions](https://gl-transitions.com/gallery) project for a collection of some very well made ones).
* **Automatically registers/unregisters** the screen's **input processors** whenever the screen is shown/hidden
* There are `create()` methods for screens and transitions that are called _once_ before a screen/transition is shown. This allows easily initializing them when everything else has already been loaded
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: "idea"
apply plugin: "jacoco"
apply plugin: "maven"

version '0.6.0'
version '0.6.1'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -54,8 +54,8 @@ install {

// DEPENDENCIES
ext {
gdxVersion = "1.9.10"
guacamoleVersion = "38cfa12bca" // = 0.2.0
gdxVersion = "1.9.11"
guacamoleVersion = "v0.2.0" // "0.2.0" doesn't seem to work as a tag
junitVersion = "5.6.0"
mockitoVersion = "3.2.4"
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/eskalon/commons/core/ManagedGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void create() {
super.create();

Gdx.input.setInputProcessor(inputProcessor);
screenManager.initialize(getInputMultiplexer(), getWidth(),
screenManager.initialize(inputProcessor, getWidth(),
getHeight(), false);
}

Expand Down
16 changes: 7 additions & 9 deletions src/main/java/de/eskalon/commons/screen/ScreenManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class ScreenManager<S extends ManagedScreen, T extends ScreenTransition>

private boolean initialized = false;

private boolean hasDepth;
private boolean hasDepth; // needed, when the framebuffers are (re)created

public void initialize(BasicInputMultiplexer gameInputMultiplexer,
int width, int height, boolean hasDepth) {
Expand Down Expand Up @@ -298,7 +298,7 @@ public void render(float delta) {
if (transition == null) {
if (!transitionQueue.isEmpty()) {
/*
* Start the queued transition
* START THE NEXT QUEUED TRANSITION
*/
Triple<T, S, Object[]> nextTransition = transitionQueue.poll();

Expand Down Expand Up @@ -327,11 +327,10 @@ public void render(float delta) {
this.gameInputMultiplexer.addProcessors(currentProcessors);
}

// render again so no frame is skipped
render(delta);
render(delta); // render again so no frame is skipped
} else {
/*
* Render current screen; no transition is going on
* RENDER THE CURRENT SCREEN; no transition is going on
*/
Gdx.gl.glClearColor(currScreen.getClearColor().r,
currScreen.getClearColor().g,
Expand All @@ -343,7 +342,7 @@ public void render(float delta) {
} else {
if (!this.transition.isDone()) {
/*
* render the current transition
* RENDER THE CURRENT TRANSITION
*/
TextureRegion lastTextureRegion = screenToTexture(
this.lastScreen, this.lastFBO, delta);
Expand All @@ -354,16 +353,15 @@ public void render(float delta) {
currTextureRegion);
} else {
/*
* the current transition is finished; remove it
* THE CURRENT TRANSITION IS FINISHED; remove it
*/
this.transition = null;
this.lastScreen.hide();
this.currentProcessors = new Array<>(
this.currScreen.getInputProcessors());
this.gameInputMultiplexer.addProcessors(currentProcessors);

// render again so no frame is skipped
render(delta);
render(delta); // render again so no frame is skipped
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* Transitions are intended as objects that are created only once when the game
* is started and are then reused.
* <p>
* The {@link #create()} method is called when the transition is first used. It
* can also be initialized manually by calling
* The {@link #create()} method is called when the transition is first used. The
* transition can also be initialized manually by calling
* {@link #initializeScreenTransition()}, which should normally be done by a
* loading screen after the assets have been loaded.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class HorizontalSlicingTransition extends BlankTimedTransition {

private SpriteBatch batch;
private int sliceCount = 5;
private int sliceCount;

/**
* @param batch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected void create() {
public void render(float delta, TextureRegion lastScreen,
TextureRegion currScreen, float progress) {
this.renderContext.begin();
this.program.begin();
this.program.bind();

// Set uniforms
this.program.setUniformMatrix(this.projTransLoc, camera.combined);
Expand All @@ -157,7 +157,6 @@ public void render(float delta, TextureRegion lastScreen,
// Render the screens using the shader
this.screenQuad.render(this.program, GL20.GL_TRIANGLE_STRIP);

this.program.end();
this.renderContext.end();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class VerticalSlicingTransition extends BlankTimedTransition {

private SpriteBatch batch;
private int sliceCount = 5;
private int sliceCount;

/**
* @param batch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* {@code true}, which indicates that the event was handled.
* <p>
* This class adds some convenience methods for quickly changing all of the
* registered input processors.
* added input processors.
*
* @author damios
*/
Expand Down

0 comments on commit a7006b4

Please sign in to comment.