Giter Site home page Giter Site logo

libgdx-screenmanager's People

Contributors

crykn avatar frosty-j avatar klez avatar lyze237 avatar sarroxxie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

libgdx-screenmanager's Issues

Inverted Y values

Firstly, great library. I do have a small issue with it though. It appears the Y values of everything is inverted. Meaning the bottom of the screen is 0, and the top is the height of the window.

Is this the default behavior and is there a way to change it? This totally throws out Mouse co-ordinates, as they are correct

resize() should be after show() in life cycle.

After I implement the libgdx-screenmanager system, I just found the resize() called before show(), which make some variable not initialize at the correct time. I understand when switching screen, you may want to resize it first to draw it on the screen to make transition animation, but it make me confused if I am familiar with the original screen life cycle. Maybe you can disable the show() in ManagedScreen class. Another feature request, I would like sliding transition or push transition has bouncing effect, could you provide bouncing option for those already made transitions?

The currently bound framebuffer (0) doesn't match this one

Hello! First of all, I love the library!! Congratulations on the work!
I have a small problem when implementing it. If I don't use the transitions, everything works correctly. If I use the transition when loading the game, the transition works very well. However, the problem comes when I try to initialize the game screen, it breaks. I use an intermediate screen to load the assets and different resources.
Example:
Initialize the game: Works
@OverRide
public void create () {
super.create();

batch = new SpriteBatch();
assetLoader = AssetLoader.getInstance();
this.screenManager.setAutoDispose(true, true);
//setScreen(new MainMenuScreen(this));
this.screenManager.pushScreen(new MainMenuScreen(this), new HorizontalSlicingTransition(batch, 5, 1F));
}

But when loading the game screen, it breaks and shows the following error:
It should be noted that I do not use any FrameBuffer.
Example: DONT WORK
@OverRide
public void render(float delta) {
batch.begin();
batch.draw(loadingTexture, Gdx.graphics.getWidth() / 2 - loadingTexture.getWidth() / 2, Gdx.graphics.getHeight() / 2 - loadingTexture.getHeight() / 2);
batch.end();
if(assetLoader.update()){
game.getScreenManager().pushScreen(new ForestLevel(game, level, map), new HorizontalSlicingTransition(batch, 5, 1F)); //
dispose();
}
}
Shows the following error:
java.lang.IllegalStateException: The currently bound framebuffer (0) doesn't match this one. Make sure the nested framebuffers are closed in the same order they were opened in!
at de.damios.guacamole.gdx.graphics.NestableFrameBuffer.end(NestableFrameBuffer.java:151)
at de.damios.guacamole.gdx.graphics.NestableFrameBuffer.end(NestableFrameBuffer.java:126)
at de.eskalon.commons.utils.ScreenFboUtils.screenToTexture(ScreenFboUtils.java:49)
at de.eskalon.commons.screen.ScreenManager.render(ScreenManager.java:309)
at de.eskalon.commons.screen.ScreenManager.render(ScreenManager.java:298)
at de.eskalon.commons.core.ManagedGame.render(ManagedGame.java:75)
at com.mygdx.la.ilustradora.LaIlustradora.render(LaIlustradora.java:44)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:387)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.(Lwjgl3Application.java:167)
at com.mygdx.la.ilustradora.DesktopLauncher.main(DesktopLauncher.java:15)

Thanks!!!

Inconsistencies between libgdxs implementation of setScreens() and screenmanager.

Hello!

Thanks for the awesome library, it's great so far.

I noticed a difference though (as far as I understand the code) between libgdx's game class and your ManagedGame class.

The only time screenmanager calls resize() on (initialized only) screens itself is when the window actually gets resized.

for (S s : screens.values()) {
	if (s.isInitialized()) {
		s.resize(width, height);
	}
}

This is problematic since the window could get resized before a screen could be initialized. Therefore the screen could render in a different resolution.

Obviously a simple fix is to override show() like this:

@Override
public void show() {
	super.show();

	resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}

However this means every show() needs to be overridden like that that and I think it'd be better to include that in the library itself similar to how libgdx does it:

When you call setScreen(Screen screen) in libgdx it calls resize() on the screen directly afterwards.

public void setScreen (Screen screen) {
	if (this.screen != null) this.screen.hide();
	this.screen = screen;
	if (this.screen != null) {
		this.screen.show();
		this.screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	}
}

Example:
we9G7Bdrol

What's your opinion on this?

crash on ios

Hi, I want to ask if this can used on iOS.

IDE: Android Studio Giraffe | 2022.3.1 Patch 3
LibGDX: 1.12.1
libgdx-screenmanager: 0.7.0
iOS: 17.2.1

first, I create a MyGame class and initial in create:

public class MyGame extends ManagedGame<ManagedScreen, ScreenTransition> {
    ...
   @Override
    public void create() {
        super.create();
        batch = new SpriteBatch();
        ...
        this.screenManager.pushScreen(new MainMenuScreen(this), new BlendingTransition(batch, 1F));
    }
}

then I create the MainMenuScreen class:

public class MainMenuScreen extends ManagedScreen {
    ...
}

this code works on Android but when I use RoboVM to create the ipa, it crashed on iOS.
Is there any special operations needed?
And if I don't use this lib, the whole app packed into ipa can work on iOS

Little ideas

1. It would be nice if de.eskalon.commons.screen.BlankScreen class would be a final Singleton, eg.:

final class BlankScreen extends ManagedScreen {

	static
	private class SingletonHelper {
        	static
        	private final BlankScreen INSTANCE = new BlankScreen();
	}

	private BlankScreen() {}

	static
	public BlankScreen get() {
		return BlankScreen.SingletonHelper.INSTANCE;
	}

	@Override
	protected void create() {
		// do nothing
	}

	@Override
	public void render(float delta) {
		// do nothing
	}

	@Override
	public void hide() {
		// do nothing
	}

	@Override
	public void resize(int width, int height) {
		// do nothing
	}

	@Override
	public void dispose() {
		// do nothing
	}
}

Then from the de.eskalon.commons.screen.ScreenManager<S, T> class, it would be possible to get rid of the private field: BlankScreen blankScreen, and in the methods: initialize(), getLastScreen(), getCurrentScreen() refer directly to: ScreenBlank.get().

2. In the de.eskalon.commons.screen.transition.impl.HorizontalSlicingTransition class, I also noticed a problem with the divisibility of the viewport height in line 77. So I would quickly suggest changing it to:

int sliceHeight = com.badlogic.gdx.math.MathUtils.ceil ((float) height / sliceCount);

BTW, a great job. Thanks!

crash when minimizing

I get a crash when I minimize the game, not when I resize it, with the following stack trace

Exception in thread "main" java.lang.IllegalStateException: Frame buffer couldn't be constructed: incomplete attachment
	at com.badlogic.gdx.graphics.glutils.GLFrameBuffer.build(GLFrameBuffer.java:256)
	at de.damios.guacamole.gdx.graphics.NestableFrameBuffer.build(NestableFrameBuffer.java:162)
	at com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:75)
	at de.damios.guacamole.gdx.graphics.NestableFrameBuffer.<init>(NestableFrameBuffer.java:58)
	at de.damios.guacamole.gdx.graphics.NestableFrameBuffer.<init>(NestableFrameBuffer.java:79)
	at de.eskalon.commons.screen.ScreenManager.initBuffers(ScreenManager.java:150)
	at de.eskalon.commons.screen.ScreenManager.resize(ScreenManager.java:399)
	at com.jelte.myGames.Ponko.resize(Ponko.java:76)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics$1$1.run(Lwjgl3Graphics.java:88)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:208)
	at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:166)
	at com.jelte.myGames.lwjgl3.Lwjgl3Launcher.createApplication(Lwjgl3Launcher.java:14)
	at com.jelte.myGames.lwjgl3.Lwjgl3Launcher.main(Lwjgl3Launcher.java:10)

gdxVersion=1.11.0
screenManagerVersion=0.6.8

Implement a FrameBuffer that can be nested

As the screen manager is using fbos internally and those can't be nested, currently no frame buffers can be used inside the render method of a screen or a transition. This leads to problem with custom render solutions (deferred rendering, etc.).

To fix this, a custom frame buffer has to be implemented that automatically rebinds the previous buffer. Furthermore, this behaviour should be documented in the wiki.

unable to get dependancies for 0.6.8

With 0.6.8, on build, I got this error

:core-game:test: Could not resolve com.github.crykn.guacamole:gdx:0.3.2.
Required by:
    project :core-game > project :core > com.github.crykn:libgdx-screenmanager:0.6.8

No error if I use 0.6.7

I setup like expected
...
maven { url 'https://jitpack.io' }
...
on core:
api "com.github.crykn:libgdx-screenmanager:0.6.8"
also tested with same error
implementation "com.github.crykn:libgdx-screenmanager:0.6.8"

test with LibGDX 1.10.0 and 1.11.0, on Android Studio

Screenmanager.push() isnt working

ScreenError.zip
I've been testing the Screenmanager for some time and the transitioning from my Main Screen to another Screen and back isn't working, even though I added the super.show() method in both of them,
Could you help me to solve this?
Amsi

BUG: Does not work on Android

When compiling the shaders on Android (API level 29) I get this error:

ERROR: 0:25: '=' : global variable initializers must be constant expressions
ERROR: 0:26: '=' : global variable initializers must be constant expressions

That makes sense as there are constands defined outside the main() method.

Consider making the shaders compatible with 2.0 ES specification by moving constants into the main() method of the shader(s).

Adapter classes?

In libGDX, we have the likes of public class InputAdapter implements InputProcessor. Would something like this be sensible for libgdx-screenmanager? I've added the following (with more whitespace than seen here) to my own project, as I've never used create() (don't see much advantage to it over a constructor) or dispose() and rarely use resize(), and hide() normally only makes sense in conjunction with show():

public class ManagedScreenAdapter extends ManagedScreen {
  @Override protected void create() { }
  @Override public void hide() { }
  @Override public void render(float delta) { }
  @Override public void resize(int width, int height) { }
  @Override public void dispose() { }
}

I'm conscious that this takes us one step further away from Screen. Maybe there's a better way to spare the game code from empty methods - I haven't given it a great deal of thought.

GWT build issue

I was getting following error when creating HTML build (library version 0.6.8):

> Task :html:compileGwt
Compiling module com.plebworks.snake.GdxDefinition
   Tracing compile failure path for type 'de.damios.guacamole.gdx.log.Logger'
      [ERROR] Errors in 'jar:file:/C:/Users/Jirka/.gradle/caches/modules-2/files-2.1/com.github.crykn.guacamole/gdx-gwt/0.3.2/63f54261a6c6dc4fb46bebe9b9916d9e80bb6b3d/gdx-gwt-0.3.2-sources.jar!/gwt/emu/de/damios/guacamole/gdx/log/Logger.java'
         [ERROR] Line 44: No source code is available for type text.formic.Stringf; did you forget to inherit a required module?
   [ERROR] Aborting compile due to errors in some input files

I was able to fix the problem by including following line into html dependencies of my project: api 'com.github.tommyettinger:formic:0.1.4:sources'

Cannot access ManagedGame

Trying to copy the example but get the error Cannot access ManagedGame when running the DesktopLauncher:

E:\Dropbox\AndroidDev\Test\desktop\src\com\therevillsgames\test\DesktopLauncher.java:16: error: cannot access ManagedGame new Lwjgl3Application(new MyGdxGame(), config); ^ class file for de.eskalon.commons.core.ManagedGame not found

Can I add screen to screenmanager when it is required?

Hi, I am glad I find this great screenmanager library in libgdx. I am wondering whether is possible to add screen to screenmanager when it is needed. In some cases, I have to initial new screen with parameter determined by user input. How can I make that rather than add screen before it is shown?

Can I use show() in ManagedScreen class or use create() only

I want to rewrite Libgdx screen system to this library managed screen system. In my original screen, I wrote a lot of code in show(), should I move those code to create() in ManagedScreen or just leave it? I have no idea why you import create() interface in ManagedScreen to rewrite show() interface which change a lot for the original Screen class.

Remove the libgdx-screenmanager-gwt extension

It'd be nice to remove the libgdx-screenmanager-gwt library and integrate it directly within libgdx-screenmanager.

  • Move the relevant dependencies and the libgdx_screenmanager_gwt.gwt.xml file to screenmanager itself
  • Adapt the documentation to reflect those changes; i.e. the libgdx-screenmanager-gwt dependency is no longer needed, guacamole-gdx-gwt may be needed, source dependencies need to be added manually by users etc.
  • Create a PR for gdx-liftoff
  • Archive the libgdx-screenmanager-gwt repo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.