Closed alyrow closed 4 years ago
Can you post a complete copy of your project (or a minimal example) so I can reproduce the problem?
Sure :
testScreen.java
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.uwsoft.editor.renderer.SceneLoader;
import io.anuke.gif.GifRecorder;
import org.libsdl.SDL;
import org.libsdl.SDL_Error;
import uk.co.electronstudio.sdl2gdx.RumbleController;
import uk.co.electronstudio.sdl2gdx.SDL2Controller;
import uk.co.electronstudio.sdl2gdx.SDL2ControllerManager;
public class testScreen implements Screen {
private final GifRecorder recorder;
private final RumbleController controller;
//private final SDL2ControllerManager manager;
private Game ConstructRushGAME;
private FitViewport viewport;
private SceneLoader sl;
private TiledMap map;
private OrthogonalTiledMapRenderer renderer;
private OrthographicCamera camera;
private static Controller recent;
public testScreen(String nameOfScene) {
// load the map, set the unit scale to 1/16 (1 unit == 16 pixels)
map = new TmxMapLoader().load(nameOfScene);
System.out.println(map.getProperties());
renderer = new OrthogonalTiledMapRenderer(map, 1 / 16f);
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, 148, 164);
camera.update();
recorder = new GifRecorder(renderer.getBatch());
controller = (RumbleController) Controllers.getControllers().get(0);
if(Gdx.app.getType() == Application.ApplicationType.Desktop){
controller.rumble(0.4f,0.4f,1500);
//System.out.println(controller.getPlayerIndex());
}
}
@Override
public void show() {
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
//sl.getEngine().update(Gdx.graphics.getDeltaTime()); // getting the ashley engine and updating it (it will render things with it's own render system)
//camera.translate(1,1);
camera.update();
// set the TiledMapRenderer view based on what the
// camera sees, and render the map
renderer.setView(camera);
renderer.render();
recorder.update();
}
@Override
public void resize(int width, int height) {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
// METHODES DE TEST
@Override
public void hide() {
}
@Override
public void dispose() {
}
}
I need something I can build, including the gradle scripts. Probaby easier if you zip the whole project folder and post the zip file.
Controller flashing screen.zip
Well, you need to run Lwjgl3Launcher
Ouha that strange I don't have the issue with the .zip
When I run it I get no flickering
Yes it'is strange the zip version works correctly. Well, the problem comes from me... Thanks and sorry for the inconvenience.
No worries. If sdl2gdx 1.0.4 is doing something differntly than 1.0.3 even you can work around I would still like to know.
Off topic but a couple of other suggestions. I see you are using LibGDX 1.9.10 with tmx map files. When I did this I got crashes with certain files. I reported it but they didn't seem interested in fixing it. I had to go back to 1.9.9.
Also you might want to try LWJGL2 backend rather than LWJGL3. I'm using 3 because I had a depenency that needed it, but it doesn't seem to have ever been finished to production quality like LWJGL2 was, so if I have problems I switch back.
OK, I replaced my project by the zip project and now it seems to work correctly. Strange ! Maybe it's due to the config of the project that was not exported in the zip... But now it works !
Oh thank you so much for the advice with tmx map files. If there was a problem i probably wouldn't find the cause because it's the first time I use Tiled.
And for LWJGL2, I just have to uncomment and comment a few lines.
Thanks again for your help !
PS : I think we can close this issue now.
Hello, I decided to use sdl2gdx 1.0.4 for my project but when I add a RumbleController or SDL2Controller, my window flashes (disappears next appears next disappears next appears...). But when I retrograde to 1.0.3, this problem disappears.