libgdx

AdMob libGDX with Google Play services

老子叫甜甜 提交于 2019-12-06 05:08:53
Within the past few days google is forcing the use of the Google Play Services Mobile ads as the next version of android adMob. Im completely new to admob and am trying to test ads in my libGDX android game, but cant figure out how to do it because I get a rediculous amount of errors no matter what i do. I HAVE LOOKED AT OTHER EXAMPLES, but they are all for adMob 6.4.1(or earlier) which is now considered legacy. I just want an ad banner at the bottom of the screen but cant figure out how to do it. Could someone please post what my android MainActivity would need to be as well as anything I

Box2D - Can't destroy multiple fixtures

爷,独闯天下 提交于 2019-12-06 04:17:34
I'm using box2d along with libgdx on a project I'm working on. I'm having a slight problem destroying a body/the fixtures of a body. Essentially, I want to completely destroy the body, which I do by destroying the fixtures of said body. Everything works perfectly fine with a body with one fixture, but when I use two fixtures, only one fixture get's destroyed, leaving the body intact with the other fixture. Here's two pictures to demonstrate what I mean: With both fixtures: With only one fixture: Here is how I create the body: BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyType.DynamicBody

how can i get soft keyboard height on android?

时光怂恿深爱的人放手 提交于 2019-12-06 04:11:29
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 ? Yes you can, with the help of Viewtree Observer and global layout listener, just try below mentioned steps Get the root view of your layout get the Viewtree observer for this root, and add a global layout listener on top of this. now whenever

Libgdx rendering floor for 3D game

流过昼夜 提交于 2019-12-06 04:08:01
问题 In my first 3D game i now want to render the floor, which is actually a plane (not a libgdx Plane ) on y = 0 . I want to add a Texture to it, so i can have different floors in each level. Now my question is: What is the best way to create and render this textured floor? I thought about using basic Block Models made with ModelBuilder and then added a Texture , but as i can only see 1 of 6 faces a 2d Texture would be enough, so i thought about a Plane . Can i add a Texture to a Plane , as it is

How do I support OpenGL ES GL10, GL11, and GL20 in Libgdx?

主宰稳场 提交于 2019-12-06 03:41:40
问题 I am writing a 3d game that is using GL10, but I'd like the application to support GL11 or GL20 if available. What is the best design for supporting all 3? Or is this a fool's errand and I should just focus on supporting one version? My current idea is to split my render() function into renderGL10, renderGL11, renderGL20 and call the appropriate render function based on the available GL instance. Inside each render function is the proper way to render for the GL version; there will likely be

Changing font size in skin

南楼画角 提交于 2019-12-06 03:26:59
I am writing a game using libgdx, and I borrowed the skin.json (and related files) from a tutorial. The font being used (default) was scaling in an ugly manner on denser screens, so I generated by own very large font - and in the game itself, I scale it to a reasonable size (basically I use BitmapFont.scale ). The font I'm now using is 3 times as large as the previous one. I changed the reference to which font to use in the skin.json file, and as a result, all my buttons, titles and other things have a massive font being shown. Is there a way of scaling the font in the .json file? Or anywhere

Is there any way to ignore libgdx images Limitation? (images must be power of two)

…衆ロ難τιáo~ 提交于 2019-12-06 03:14:47
In libgdx framework we can only use images power of two ( 64x256 , 128x32 , etc) Because OpenGL requires it. Is there any good way to "pass" this limitation? For example: Use images 800x480 . Do set Texture.setEnforcePotImages(false); and you do not have the limitation anymore. So it's not true that you just can use pictures with the size power of two. It's just a "can have" not a "must have". Regards You can use non pot textures, e.g. by using opengl es2.0. But it is good practice to at least try to use pot textures. For example by packing multiple images into a single texture. This also

Adding multiple windows in LibGDX?

元气小坏坏 提交于 2019-12-06 02:52:17
I want to create multiple game windows from my DekstopLauncher.java . The second one should be able to interact with the first one, for example asking for a string. Is it possible to do so? And how? This is what I tried in the DeskopLauncher class: This is creating the first window: LwjglApplicationConfiguration configForTiles = new LwjglApplicationConfiguration(); TilePresets tilesWindow = new TilePresets(); LwjglApplication tiles = new LwjglApplication(tilesWindow, configForTiles); And this the second LwjglApplicationConfiguration configForMap = new LwjglApplicationConfiguration(); MapMaker

How to render an emoji with libgdx

佐手、 提交于 2019-12-06 02:49:46
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 renderFont(SpriteBatch sb, BitmapFont font, String msg, float x, float y, Color c) { font.setColor(c); font

Android Emulator does not launch LibGDX project?

本秂侑毒 提交于 2019-12-06 02:46:46
问题 Whenever i try to execute the application on the emulator, the emulator displays an error saying "Unfortunately, My libGDX Game has stopped." The application runs fine in the desktop version though. I have the latest nightly version, ADT version 18, latest GWT, and latest version of eclipse. My Android SDK tools is version 19, while my android SDK platform-tools is version 11. Any ideas on how to fix this? I was following along this tutorial: LibGDX tutorial Here is a screenshot of what i see