libgdx

No Sound in Android Application with Libgdx

左心房为你撑大大i 提交于 2019-12-18 05:13:11
问题 I am creating an Android App with Libgdx. The sound works pretty well, if I run the program in the desktop-version and on the emulator as well. When I am testing the application on my android phone (Galaxy S3) there is no sound. Everything else works pretty fine on my device except the sound which is completely is missing. Do anyone know what the issue here could be? Ask me for code or logs I’d like to post it for you! Regards The following example shows the way i play the sound: import com

Loading nine-patch image as a Libgdx Scene2d Button background looks awful

落花浮王杯 提交于 2019-12-18 05:11:08
问题 I'm trying to use a Nine Patch as a background for a Libgdx Scene2d UI button. It is loading, buts it is really ugly. I can see the "meta-data" pixels, and its being stretched as if it were just a regular image (the text on the button is "Continue"): I'm loading the .9.png files directly into a (libgdx) NinePatchDrawable via a (libgdx) NinePatch like this: this.dialogButtonUp = new NinePatchDrawable( new NinePatch(new Texture(Gdx.files.internal("data/button-round.9.png")))); this

How to get a Label with wrapped text?

爱⌒轻易说出口 提交于 2019-12-18 04:43:08
问题 I ave tried the following code: Label label = new Label(reallyLongString, skin); label.setWrap(true); label.setWidth(100); // or even as low as 10 table.add(label); ... and yet all I get is a very wide line that draws off the screen. How to get a Label with wrapped text? 回答1: This is the same issue as seen in slider always has default width or "Slider always has default width". You need to put that label into a table and add the right size to the cell of the table where the label is. UI

Android libgdx swipe left and right detection using gesture listener

余生长醉 提交于 2019-12-18 04:21:56
问题 I have displayed a image at the center of the screen with libgdx. If i swipe left the image should move left and if i swipe right image should move right . Subsequent swipes to the left should move the image left. The same should happen for right. I used GestureListener . It works to some extent in the sense if i swipe left first image moves left. But after that if i try to swipe right the image still moves left. So how do i overcome this in libgdx?? class MyGestureListener implements

How to render a circular/radial progress bar in Libgdx?

旧时模样 提交于 2019-12-18 04:09:12
问题 For a game we develop with libgdx, we need to show the user the remaining time for making a move. How can we render a circular progress bar which shows the remaining seconds? In the following answer there is a javascript solution : Circular / radial progress bar Thanks. 回答1: First create a texture (region) with the full circular progress bar. Next deform a shape (mesh) made up of one or more triangles to fit the actual area which should be shown. For this, think of a line from the center of

GdxRuntimeException on Android: couldn't load shared library 'gdx' for target

谁说胖子不能爱 提交于 2019-12-18 04:03:44
问题 I've developed a Libgdx application and tested it on my Samsung Galaxy S3(4.1.2) where it is working great. I tried to test it on a Galaxy Grand(4.1.2) but it failed. In the logcat, I found the following: caused by com.badlogic.gdx.utils.GdxRuntimeException couldn't load shared library 'gdx' for target: Linux, 32-bit This happened when changing the device only so any idea what is the cause?! The complete logcat: 05-22 20:25:01.745: E/AndroidRuntime(12725): FATAL EXCEPTION: main 05-22 20:25:01

LibGDX - Mapping Individual Textures to each face of a box using Modelbuilder.createBox

此生再无相见时 提交于 2019-12-18 03:38:50
问题 I have the following code snippet that generates a 3D cube: ModelBuilder modelBuilder = new ModelBuilder(); box = modelBuilder.createBox(2f, 2f, 2f, new Material(TextureAttribute.createDiffuse(AssetLoader.tr[0])), VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates ); So far so good. The problem is that all faces of the cube uses the same texture, whereas what I want is Assetloader.tr[], which is an array with 6 individual textures to

Libgdx setup UI gives 2 unexpected errors in new GWT project

廉价感情. 提交于 2019-12-18 01:33:31
问题 I have run the setup ui, however, I get two different errors in the -html project than what is described in the tutorial: libgdx tutorial The tutorial error stated is as follows (which is an error I do not see): To fix the error of the HTML5/GWT project, go to the "Problems" view, right click the error message "The GWT SDK JAR gwt-servlet.jar is missing in the WEB-INF/lib directory" and select "Quick Fix". Click "Finish". The errors I have are: The project was not built since its build path

Actions of Actors in libgdx

≯℡__Kan透↙ 提交于 2019-12-17 22:32:26
问题 I have made my Actor, but I am unclear on how to take advantage of the action and act methods. Outside of the basic Javadoc, I have not found a good tutorials on these methods. Can anyone provide an example with comments for actions on actors? 回答1: This answer is being rendered obsolete because of changes in LibGDX. For up to date documentation see scene2d wiki page. There are various available actions in LibGDX ready for you. They are in com.badlogic.gdx.scenes.scene2d.actions package. I

Add Actions.scaleTo() to a Label in LibGDX

喜夏-厌秋 提交于 2019-12-17 20:29:25
问题 In LibGDX, I want to make a text animation for my game. Therefore, I want that my labels gets larger with time. But if I use the scaleTo() method, nothing happens whereas other Actions like moveTo() work fine. label1 = new Label("Test text", new Label.LabelStyle(font, Color.BLACK)); label2.addAction(Actions.parallel(Actions.moveTo(500, 300, 2.0f),Actions.scaleTo(0.1f, 0.1f,2.0f))); label2 = new Label("Test text 2", new Label.LabelStyle(font, Color.BLACK)); label2.addAction(Actions.parallel