libgdx

Libgdx and Google In-App-Purchase result

大兔子大兔子 提交于 2019-12-03 16:11:46
I followed these instructions to integrate both Libgdx and native android code using ActionResolver interface. I have no problem calling the Android method from the Libgdx part of my code. But I am hitting a dead end when I am trying to intergrate Google IAP with Libgdx. According to TrivialDrive example, it uses mPurchaseFinishedListener (outside of calling method). My question is: how do I pass this IAP resultcode back to Libgdx since the listener is outside the calling method? Currently, purchase process went through, but the libgdx part of my code is not being "informed" of the purchase

Scale a Bitmapfont in LibGDX

旧时模样 提交于 2019-12-03 15:22:47
问题 How can I scale a Bitmapfont object in LibGDX? It seems the method setScale is no longer available. 回答1: It is not recommended to scale Bitmap font, because it looks pixlated when enlarged(which I believe is ugly) It is recommended to use freetype generator for resizing your fonts If you still want use bitmapFont Tenfour04 is correct 回答2: Use bitmapFont.getData().setScale(float x, float y) . 回答3: As Fish mentioned, it is recommended to use freetype generator as following:

How to reload libgdx unmanaged Texture after OpenGL context loss

ぐ巨炮叔叔 提交于 2019-12-03 15:14:45
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 own manager class, adding DynamicTextureManager.register(t, pm); // Register texture together with the

How to get screen resolution of an android device using LIBGDX?

天大地大妈咪最大 提交于 2019-12-03 15:05:14
问题 I am working android game development and I am new in it. I want to develop a game which screen resolution free. It will be enough for me if i get to know that how to catch screen resolution of an android device using libgdx library. After some googling i read the following code on different sites, but it is not for libgdx. DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); height = displaymetrics.heightPixels; width =

Java LibGDX BitmapFont setScale method not working

十年热恋 提交于 2019-12-03 14:38:48
问题 I am currently trying to scale a font but I am receiving the error "the method setScale(float, float) is undefined for the type BitmapFont" This is the code section where I am getting the error, specifically in lines 2 and 4. font = new BitmapFont(Gdx.files.internal("text.fnt")); font.setScale (.25f, -.25f); shadow = new BitmapFont(Gdx.files.internal("shadow.fnt")); shadow.setScale (.25f -.25f); I created the variables here public static BitmapFont font; public static BitmapFont shadow; When

android gdx sound performance issue

孤街浪徒 提交于 2019-12-03 14:15:08
问题 I'm building a scrolling shooter with libgdx. in windows, everything runs just fine, but on android i get noticeable jitter and the framerate drops from 61 fps avg without sound to 48-56 fps avg with sound. it plays a lot of small sound effects concurrently as there are a lot of bullets to fire and enemies to hit at once. my sound routine: import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Sound; public class SoundFX { static final int BGDIE = 1, BGHIT = 2, BGLASER = 3, BGSPAWN = 4,

adding Admob to Libgdx game

倾然丶 夕夏残阳落幕 提交于 2019-12-03 14:15:02
I was fallowing this tutorial but when I tried to go to monetize page I wasn't able to monetize or add any banner because my game isn't in the store unlike the tutorial. My question is: do I need to upload my game without adding the code of admob then add it latter to my game or shall I add the code before uploading it then set the things from admob website? It might be a silly question but I'm just a newbie when it comes to admob There is a hole section in Libgdx official docs that explain how to use Admob : Admob in libgdx consider that : Android (6.4.1 and earlier SDKs) Deprecated. On

Proper way to dispose screens in Libgdx

ε祈祈猫儿з 提交于 2019-12-03 13:50:56
What is the proper way of completely disposing of a screen in Libgdx? Currently If I click where a button was on my previous screen the button still does what it would of done if I were on that screen. Should I be .dispose() -ing everything I can in the dispose() method? or is there a simpler way to dispose of everything on screen? Unfortunately there is no easier way. These classes do not share any kind of common " Disposable " interface, or anything like that, to do it automatically. Everything that has a dispose() method needs to be disposed manually when it's not needed anymore. This is

Android libgdx big screen resolution

眉间皱痕 提交于 2019-12-03 13:49:24
问题 How can I support (make an algorithm) for libgdx for supporting multiple screen resolution? I made my app work on HTC Tattoo using if statments with parameters like: if (Gdx.input.getX()==40) { What is a good algorithm for making this work on bigger screens? I tried this but without any result: publis static int translatex() { float p = (float)Gdx.graphics.getHeight()*340; return (int) p*Gdx.input.getX(); } 340 is the base x (the x resolution on my phone) used by me on the HTC Tattoo. So....

In-App simple tutorial [closed]

旧时模样 提交于 2019-12-03 13:35:54
I want to use Google In-App billing for my Android Apps using Libgdx. By default, it is a free apps for everyone. Some of the features will be unlocked once user paid a small fee (lets assume $1), and all features will be unlocked if user paid the full price (assuming $2). I have a read on official Google's Billing site but I have no idea how to link it to Libgdx. The Official Libgdx Site doesn't really provide any clear instruction and explanation. As at today, I still have no idea on how to link both Libgdx and In-App Billing. Furthermore, where is the information being stored (is it in the