libgdx

libgdx - how to add background image in stage?

隐身守侯 提交于 2019-12-05 01:23:15
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? 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 an Image (subclass of Actor ) to the Stage and use the z-index to make sure it is drawn as a background. -

How to reload libgdx unmanaged Texture after OpenGL context loss

六月ゝ 毕业季﹏ 提交于 2019-12-05 00:47:16
问题 I'm downloading images over the network and add them to my libgdx UI as Image actors using this: Pixmap pm = new Pixmap(data, 0, data.length); Texture t = new Texture(pm); TextureRegion tr = new TextureRegion(t,200,300); TextureRegionDrawable trd = new TextureRegionDrawable(tr); Image icon = new Image(); icon.setDrawable(trd); Given this I need some way of reloading the texture data since it is lost when the OpenGL context is lost (e.g. because the screen goes to sleep). I've tried making my

libgdx game crashes on some devices

廉价感情. 提交于 2019-12-04 23:54:16
Right after start of app, my app crushes without error message on a device. This only happens on Samsung Note 1(at least, can't test on all devices), but not on Motorola Moto G or Galaxy s4mini. The only hint I get is in the debugger. I pasted it below. What exactly is happening and why it crashes only on some devices? Edit: it crashes also on return to the app from "running apps" menu. Note 1 has CyanogenMod installed. Maybe this has something to do with the crashing. Edit2:Another observation: note 1 allocates only a half of the memory as the other two devices. Has this anything to do with

Loading texture in libgdx android using file in res?

自闭症网瘾萝莉.ら 提交于 2019-12-04 23:54:09
问题 In LibGdx, texture image is stored in asset folder and loaded using following code. Texture texture = new Texture(Gdx.files.internal("image/someImage.jpg")); I have different texture for different screen resolution, so I want to use Android "res/" directory for saving texture image, which helps to load appropriate image file for appropriate resolution. Is there any way to load image file from Android "res/" directory? 回答1: You should look into libgdx's ResolutionFileResolver, and also use

libgdx and android application. Image as background

走远了吗. 提交于 2019-12-04 23:08:34
问题 I am new and I just start my journey with libgdx. I would like to know how I can do image.png in resolution 960x640 as background in my game? This is possible? Thx for advices and forbearance. Maybe you hava a simply tutorial? This is my render class: public void render() { texture = new Texture(Gdx.files.internal("E:/background.png")); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(texture, 0, 0); batch.end(); } Second question. I need to insert two active images, active

Efficient 3D block rendering with Libgdx

穿精又带淫゛_ 提交于 2019-12-04 22:41:11
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 Viewfrustum culling . However, if I look in a direction, where many blocks are in my viewfrustum the FPS go

java and libGDX / LWJGL game fullscreen wrong size for multiple monitors on Ubuntu

时光怂恿深爱的人放手 提交于 2019-12-04 22:13:56
I'm working on a libGDX (library on top of LWJGL) game project, and use the Intellij IDEA IDE from several different workstations: Windows 7 x64 laptop with two displays (1920x1080 and 1600x1200), nVidia GT540M. Ubuntu 12.04 LTS on a laptop with a single display (1366x768), Intel integrated graphics. Ubuntu 12.04 LTS on a desktop with two displays (1920x1080 and 1280x1024), nVidia GTS 450. I'm using the OpenJDK for Java 6 on the Ubuntu boxes, and Sun/Oracle Java 6 on the Windows box (I heard Java 6 was the one to use for Android compatibility). When running on full-screen: Windows 7 laptop:

How to implement Admob in my Game in libGDX? [closed]

本小妞迷上赌 提交于 2019-12-04 22:10:34
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am start working with libGDX and I want to use the AdMob in my Game. If someone have already worked on it, Give me the way to make this thing happen in the Game ? layout = new RelativeLayout(this); adView = new AdView(this, AdSize.BANNER, adMObid ); View gameView=initializeForView(new TalkingFriendApp(this), cfg); RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout

Build failed in Android Studio 3.1, gradle 4.4 class signer information does not match signer information of other classes in the same package

流过昼夜 提交于 2019-12-04 21:45:35
I'm making a project in Android Studio 3.1 with libgdx and i can't build my project because it says: class "org.bouncycastle.jcajce.provider.symmetric.IDEA$Mappings"'s signer information does not match signer information of other classes in the same package But i don't use "bouncycastle" or something I checked a lot pages and topics about this problem but i didn't find any solutions for this. Also i haven't any jar files and i never tried to sign something, i'm only trying to build my project Please help me guys, i really stuck at it Update: Java 10.0.2 was having issues with GDX 1.9.8 so I

Can I have Android Views overlayed on top of the libgdx GL surface?

空扰寡人 提交于 2019-12-04 20:52:38
I would like to display some custom views ( e.g. TextViews with Arabic/Asian text) on top of everything that happens in libgdx's OpenGL Surface (<--I assume it's a surface view). Is this possible? How? The motivation is that I have a proven component for displaying text in my existing code and I would like to keep using this. I have used other GLSurfaceViews with View hierarchies before. Just wondering how/if this can be done in libgdx. Performance doesn't matter all to much because the "game" in libgdx is a simple puzzle game, and when the text views are shown, the game is pretty much paused.