libgdx

slider always has default width

走远了吗. 提交于 2019-11-30 17:22:17
[UPDATE] I noticed that an invalidate() would be good but it didnt change something! So i put in the whole optionlayout with the creation of the table and the slider + labels. The backbutton is just a textbutton added to the end of the table. I know its a long code but i seems to be needed. I created a slider like this as i know that the min width of the background is used for the slider width: public OptionScreen(MainClass game) { super(game); preference = new PreferencesHelper(); font = this.getDefaultFont(25); this.table = new Table(); if (Config.DEBUG) this.table.debug(); // add

slider always has default width

送分小仙女□ 提交于 2019-11-30 16:38:24
问题 [UPDATE] I noticed that an invalidate() would be good but it didnt change something! So i put in the whole optionlayout with the creation of the table and the slider + labels. The backbutton is just a textbutton added to the end of the table. I know its a long code but i seems to be needed. I created a slider like this as i know that the min width of the background is used for the slider width: public OptionScreen(MainClass game) { super(game); preference = new PreferencesHelper(); font =

libgdx Json parsing

你。 提交于 2019-11-30 16:04:43
问题 hi I'm trying to get all 'id' value from my json into my 'results' array. I didn't really understood how the json class of libgdx works, but I know how json works itself. Here is the json : http://pastebin.com/qu71EnMx Here is my code : Array<Integer> results = new Array<Integer>(); Json jsonObject = new Json(OutputType.json); JsonReader jsonReader = new JsonReader(); JsonValue jv = null; JsonValue jv_array = null; // try { String str = jsonObject.toJson(jsonString); jv = jsonReader.parse(str

Limit FPS in Libgdx game with Thread.sleep() doesn't work

倖福魔咒の 提交于 2019-11-30 16:02:09
I am developing a little game for android with libgdx and want to limit the fps to 30 to save battery. The problem is that it doesn't work. The fps just drops from 60 to 56. Here is the part of the code: (it's at the end of the render part) System.out.print("\nFPS: " + Gdx.graphics.getFramesPerSecond() + "\n"); if(Gdx.graphics.getDeltaTime() < 1f/30f) { System.out.print("DeltaTime: " + Gdx.graphics.getDeltaTime() + " s\n"); float sleep = (1f/30f-Gdx.graphics.getDeltaTime())*1000; System.out.print("sleep: " + sleep + " ms\n"); try { Thread.sleep((long) sleep); } catch (InterruptedException e) {

What does “AL lib: alc_cleanup: 1 device not closed” mean?

喜夏-厌秋 提交于 2019-11-30 15:31:23
问题 I'm trying to engage myself into the Libgdx OpenGL framework. I've used LwjglApplication for creating some simple apps that render boxes, some meshes and some textures. I came across Aurelien Ribon's app that creates rigid Box2D bodies. He used the LwjglCanvas to integrate with Java's Swing. I tried making one myself, I created a JFrame then added the LwjglCanvas . Then set the JFrame 's default operation on close to EXIT_ON_CLOSE . However everytime I close the application, this logs to my

LibGDX's TexturePacker with gradle

ⅰ亾dé卋堺 提交于 2019-11-30 15:16:58
问题 I am attempting to create a gradle task which runs TexturePacker according to the instructions here. (Note that I am using Android Studio and its directory structure rather than Eclipse.) I first added the following to the Android Studio project's build.gradle : import com.badlogic.gdx.tools.texturepacker.TexturePacker task texturePacker << { if (project.ext.has('texturePacker')) { logger.info "Calling TexturePacker: "+texturePacker TexturePacker.process(texturePacker[0], texturePacker[1],

How do you sort Actors in a libgdx Stage?

﹥>﹥吖頭↗ 提交于 2019-11-30 15:11:04
问题 I'm having trouble sorting Actors in a LibGdx Stage object. When the Stage gets rendered the images are rendered in the order they are added. Stage uses an Array to hold the Actors. I've tried setting the ZIndex of each Actor, but it still didn't sort. Then I tried creating a comparator object like this: public class ActorComparator implements Comparator < Actor > { @Override public int compare(Actor arg0, Actor arg1) { if (arg0.getZIndex() < arg1.getZIndex()) { return -1; } else if (arg0

Libgdx could not determine java version 11.0.1

混江龙づ霸主 提交于 2019-11-30 15:00:28
I tried everything I installed every possible Java file a million times I installed the newest gradle version but it continues to show this error. I'm on Mac. Please help thanks IF you do not want to develop for Android Java 11 works fine libgdx. You have to change some things before everything builds and runs. Here's what I did to get my project working. My context Mac OSX 10.14 and openJDK 11.0.2 , new project, Desktop launcher and a bunch of Extensions (not important). The error you get about not being able to find java 11.0.x comes from gradle. Java 11 is only supported since gradle 5. In

Libgdx - How to draw filled rectangle in the right place in scene2d?

ε祈祈猫儿з 提交于 2019-11-30 14:49:00
问题 I am using scene2d. Here is my code: group.addActor(new Actor() { @Override public Actor hit(float arg0, float arg1) {return null;} @Override public void draw(SpriteBatch batch, float arg1) { batch.end(); shapeRenderer.begin(ShapeType.FilledRectangle); shapeRenderer.setColor(Color.RED); shapeRenderer.filledRect(0, 0, 300, 20); shapeRenderer.end(); batch.begin(); } }); The problem is that it draws this rectangular relative to screen (x = 0, y = 0), but I need it to be drawn relative to my

Use sqlite database for iOS (robovm) with libgdx

无人久伴 提交于 2019-11-30 14:39:19
I have a libgdx project (Android) where I use a sqlite database . I'm developing the same project in iOS version (robovm) and I can't find anything about sqlite or database for iOS version. Is it possible to use the same sqlite database ? Thanks. I know this is an old thread but this worked for me You dont have to do it EXACTLY like this of course, but this is how i did it First i made a helper class for SQLite called.. SQLiteHelper This would initialize things package com.hamzahrmalik.mitto.sqlite; import java.io.File; import java.sql.Connection; import java.sql.ResultSet; import java.sql