libgdx

LibGDX assigning a specific shader to a ModelInstance

旧巷老猫 提交于 2019-12-22 13:59:46
问题 I have recently been learning an implementing my own shaders in libgdx. So far I did this with a custom shader provider, which chooses between a few shaders based on the userdata value of the object; public class MyShaderProvider extends DefaultShaderProvider { public final DefaultShader.Config config; final static String logstag = "ME.MyShaderProvider"; //known shaders static public enum shadertypes { prettynoise, invert, standardlibgdx, noise, distancefield, conceptbeam } public

Libgdx, Alpha Text using Shader not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 13:58:13
问题 I have some trouble applying alpha in Text (with shaders) using Stage action. I'm using Group that add Window actor and Window add Label actor. My other actor in group working fine applying Actions alpha but my label (draw using shaders) not working, the different with other widget is my text label are applying shaders. font.frag uniform sampler2D u_texture; varying vec4 v_color; varying vec2 v_texCoord; const float smoothing = 0.2; void main() { float distance = texture2D(u_texture, v

how do I drag an object in libgdx using box2d?

爱⌒轻易说出口 提交于 2019-12-22 12:05:19
问题 I have added objects to a box2d world in libgdx . I am wondering if it was possible to drag objects with the mouse? If so, how? thanks! 回答1: There are a couple of options here. You can use a mouse joint or you can use a kinematic body and set it's position manually. A good example of how to use a mouse joint check this out: http://code.google.com/p/libgdx-backend-android-livewallpaper/source/browse/gdx-backend-android-livewallpaper-example/src/com/badlogic/gdx/tests/box2d/Box2DTest.java?r

How to render an emoji with libgdx

柔情痞子 提交于 2019-12-22 10:49:57
问题 I have loaded a font with emoji support and I am trying to render a string with emoji's with libgdx. However, it renders the text, but not the emojis. Code Load Font FileHandle fontFile = Gdx.files.internal("path/to/file.ttf"); FreeTypeFontGenerator g = new FreeTypeFontGenerator(fontFile); FreeTypeFontGenerator.FreeTypeFontParameter p = new FreeTypeFontGenerator.FreeTypeFontParameter(); // Some config here with p BitmapFont emojiFont= g.generateFont(p); Render Font public static void

how can i get soft keyboard height on android?

心不动则不痛 提交于 2019-12-22 10:49:04
问题 i have been developing an android project using libgdx for these days . A question occurred during the period. when soft keyboard' appear , some views will be covered,so i want to get the height for solving this bug. i know there is a soft input mode can be set to solve this issue when using android api to develop project ,does libgdx provide any way ? 回答1: Yes you can, with the help of Viewtree Observer and global layout listener, just try below mentioned steps Get the root view of your

Changing the certificate fingerprint for an existing application

两盒软妹~` 提交于 2019-12-22 09:36:29
问题 I have an existing application that i published in to google play. All was fine, until I have changed a computer and my sha1 fingerprint changed. Is there a possible way to change the sha1 for an existing application in google play developer console? if not, how can I deal with it? Thank you! 回答1: If you remember, when you publish the app first time on your older computer, you generate a key.keystore in order to sign the apk file and publish to google play. You need to have the same file.

LibGdx How to program an HP Bar?

你。 提交于 2019-12-22 09:24:01
问题 I am currently trying to program a game using LibGdx. I have a lot of the structure part of my game and I am now seeking to have the game return information to the player. The simplest concept for my UI I can think of are HP bars and ammo counters (for bullets, arrows, etc.). Would this be done through a stage and actors in my GameScreen class? Perhaps in the Rendering class? Or is this a second camera (loaded-in after the background)? I use a GameScreen class supported by a Map and

Android. How to move object in the direction it is facing (using Vector3 and Quaternion)

隐身守侯 提交于 2019-12-22 08:34:48
问题 I'm using libGDX (quite new to it in fact) and Android. And I want to move 3d object in the direction it is facing (using some speed). I thinks it's a basic question but can't find a straight nswer for it. I have a Quaternion representing object rotation(direction) and I have a Vector3 representing the object position. The question is how to update the position Vector3 using info from Quaternion in order to move object in the direction represented by Quaternion. (An alternative to this is

Programmatically perform click on Actor libgdx

痞子三分冷 提交于 2019-12-22 05:58:08
问题 My question is straightforward. I have some ClickListener s added to an Actor. I want to execute a click event on them programmatically. Something like myActor.performClick() ; 回答1: You can also use: InputEvent event1 = new InputEvent(); event1.setType(InputEvent.Type.touchDown); button.fire(event1); InputEvent event2 = new InputEvent(); event2.setType(InputEvent.Type.touchUp); button.fire(event2); This will also show any pressed image change which can be helpful. 回答2: I figured out a

Programmatically perform click on Actor libgdx

那年仲夏 提交于 2019-12-22 05:58:01
问题 My question is straightforward. I have some ClickListener s added to an Actor. I want to execute a click event on them programmatically. Something like myActor.performClick() ; 回答1: You can also use: InputEvent event1 = new InputEvent(); event1.setType(InputEvent.Type.touchDown); button.fire(event1); InputEvent event2 = new InputEvent(); event2.setType(InputEvent.Type.touchUp); button.fire(event2); This will also show any pressed image change which can be helpful. 回答2: I figured out a