libgdx

Click through an Actor in libGDX

微笑、不失礼 提交于 2019-12-06 22:23:21
问题 I have an overlay in my game that consists of an image of a screen, and a set of buttons that are "on" the screen. Screenshot: My Screen has one Stage . The Stage has a set of Group objects, which I think of as layers. The first group has the backgrounds, the groups in the middle has the game elements, and the frontmost group has the screen overlay. The overlay layer consists of one Image , the screen itself, and four TextButton (one in each corner). This would work great, if it weren't for

libgdx - how to add background image in stage?

纵饮孤独 提交于 2019-12-06 21:27:04
问题 I am learning libgdx but i am stuck at a point.. I have added a button in my stage , now i want to add a image in the stage so that the image looks as the background image to the button.i mean to say that the button should lie on the image. I have been looking tutorials but not been able to do that. How can it be done? any help? 回答1: The only thing you need to do is to draw the background, before drawing the Button s. There are a few possible ways to do that: - You can add the background as

LibGDX . draw multiline text

你说的曾经没有我的故事 提交于 2019-12-06 19:58:21
问题 I am trying to write a big text using BitmapFont in libGDX . But it shows on one line and the user can see only the first part of the text . How can I make that bitmapFont made new line automatically and show whole text on the screen ? 回答1: Either use \n for manual new lines and render the font via font.drawMultiLine(...). Or use font.drawWrapped(...) with a wrap width to let libgdx wrap it automatically (manually added \n are still supported). Update: With libGDX 1.6 the draw methods were

Difference between libgdx Stage and Screen

断了今生、忘了曾经 提交于 2019-12-06 18:43:10
问题 I'm making a game, and I see in tutorials some people using Stage class, and others using the Screen class, but I can't figure out the diference. 回答1: A Stage holds Actor instances and updates/animates them and manages hit-detection among them. Its the root of the scene2d "scene graph" API. The Stage is one way of managing the list of objects to draw, their state on the screen (textures, animation state, size, etc), and their interactions with the user. The provided Stage code in Libgdx is

Efficient 3D block rendering with Libgdx

余生颓废 提交于 2019-12-06 16:10:45
问题 To start with,I am pretty new to 3D programming and libgdx. I looked at a few tutorials and I already render the scene I want. I have some 1x1x1 blocks, created with ModelBuilder.createRect() for every visible face, so if another block covers a face of this block, there is no rect created for this block. Also the top and bottom rect is not needed, as I can never see them (except for the floor). So I thought, that this is pretty efficient. I also have Backface culling enabled and I do

libgdx issue - unfortunately, my-gdx-game has stopped

亡梦爱人 提交于 2019-12-06 15:17:15
I can get the my-gdx-game-desktop java application running no problems but can't seem to get my-gdx-game-android to work. I receive the message 'unfortunately, my-gdx-game has stopped' on my AVD. Logcat: 07-21 10:00:59.509: D/dalvikvm(791): Not late-enabling CheckJNI (already on) 07-21 10:01:00.289: D/dalvikvm(791): Trying to load lib /data/app-lib/com.mygdx.game.android-2/libgdx.so 0x416e54c0 07-21 10:01:00.310: D/dalvikvm(791): Added shared lib /data/app-lib/com.mygdx.game.android-2/libgdx.so 0x416e54c0 07-21 10:01:00.319: D/dalvikvm(791): No JNI_OnLoad found in /data/app-lib/com.mygdx.game

Setting boundaries to world in libgdx

那年仲夏 提交于 2019-12-06 14:51:30
Hi I am developing a game using libgdx framework, in that i am unable to set boundaries to the world in order to limit the actors. When ever a fixture crossed the screen(world) edge it should revert back or stop there itself. I know by calculating x,y co-ordinates we can do it, if there any other way please help in this regard. got resolved.. by setting edges to shapes 来源: https://stackoverflow.com/questions/6730981/setting-boundaries-to-world-in-libgdx

Libgdx - Get Intersection Rectangle from Rectangle.overlap(Rectangle)

喜欢而已 提交于 2019-12-06 14:40:20
Is there any way to know the intersection Rectangle area between two Rectangles in libgdx like the Rectangle in c# http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.rectangle.intersect.aspx ? I need to get the intersection rectangle area between that two rectangles but the overlap method in libgdx only return boolean value whether two rectangles are intersect or not. I have read Intersector class but it provides nothing to do that. Indeed, LibGDX does not have this functionality built in, so I would do something like this: /** Determines whether the supplied rectangles intersect

Why do textures flicker when camera moves?

♀尐吖头ヾ 提交于 2019-12-06 14:39:41
I implemented a top view camera which moves with the player, only a bit slower using camera.position.lerp . The problem is that the textures are flashing (flickering) a little because i have scaled my textures. If I use normal size of textures the flickering stops. Does anyone have any ideas on how to move the camera with zoom (or textures scaled - same thing) without getting the textures to flicker (or flash)? I use linear filtering and load every asset from an atlas. I saw this problem on multiple forums, but no answer. I wanted to load higher resolution textures and resize them in code,

runTime error in libGDX

匆匆过客 提交于 2019-12-06 13:38:30
in past i worked with my projects and everything was good. but recently, i have this errors: 06-02 04:52:27.954: W/dalvikvm(344): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/badlogic/gdx/backends/android/AndroidApplication; 06-02 04:52:27.954: W/dalvikvm(344): Class init failed in newInstance call (Lcom/Jumper/ProjectAndroidActivity;) 06-02 04:52:27.963: D/AndroidRuntime(344): Shutting down VM 06-02 04:52:27.963: W/dalvikvm(344): threadid=1: thread exiting with uncaught exception (group=0x40015560) 06-02 04:52:27.993: E/AndroidRuntime(344): FATAL EXCEPTION: main