libgdx

Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

我是研究僧i 提交于 2019-11-27 11:11:10
I'm trying to add google play services to my libGDX project in IntelliJ Idea. I've followed the setup guide here: https://developers.google.com/android/guides/setup which looks pretty straightforward. I just added those lines to my build.gradle in the corresponding section, so things look now like: project(":android") { apply plugin: "android" apply plugin: 'com.android.application' configurations { natives } dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" natives

Adding Admob to libgdx

爱⌒轻易说出口 提交于 2019-11-27 09:39:06
RelativeLayout layout = new RelativeLayout(this); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); View gameView = initializeForView(new MainGame(), config); layout.addView(gameView); adView = new AdView(this); adView.setAdListener(new AdListener() { @Override public void onAdLoaded() { System.out.println("LOAD"); } }); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId("ca-app-xxx-xxxxxxxxxx/xxxxxxxxxx"); AdRequest.Builder builder = new AdRequest.Builder(); RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams

TrueType Fonts in libGDX

拜拜、爱过 提交于 2019-11-27 09:29:18
问题 Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release. EDIT: I found the StbTrueType font stuff, the jar file is located in the extensions directory. I've added it to my project. Now I just need to figure out how to use it. Any examples? 回答1: Yes you will definitely need to add the gdx-stb-truetype jars to your project as you stated in your edit. Here is how you will use it, pretty

How Camera works in Libgdx and together with Viewport

爱⌒轻易说出口 提交于 2019-11-27 08:46:05
问题 If you work with LibGdx it goes not long until you come to Camera and viewport. If you work the first time with camera and Viewport you get some questions about how it works and how to use it. So: How can I use a Camera in LibGdx? What's viewport width and height? What is a Viewport, how can I use it and how it works together with the Camera? 回答1: How can I use a Camera in LibGdx? What's viewport width and height? Firstly it's important that you know the Camera works with World units not with

How can I implement AdMob Ads in a LibGDX Android project?

▼魔方 西西 提交于 2019-11-27 08:44:14
问题 I found this Flappy Bird GIT project: https://github.com/barodapride/flappy-tutorial-barodapride How can I implement the BannerAd in this? There is no layout file. And how can I implement the InterstitialAd? If I try to write public InterstitialAd mInterstitialAd; Then it says "cannot resolve symbol InterstitialAd" I know how to do this in a normal Android Studio project, but this is the first time I'm working with libGDX and this is so complicated... 回答1: I answered here, how you integrate

Libgdx's World Units

杀马特。学长 韩版系。学妹 提交于 2019-11-27 08:16:58
问题 I've been trying to learn libgdx a little but now i'm kinda confused about world units there that i don't even know what exact question i should be asking. Anyway, i've been reading this example game code here and from what i understand, when there's no camera, SpriteBatch renders everything in relation to device resolution, so pixels, but when we make a camera, set it's "size", position and then use batch.setProjectionMatrix(camera.combined) , batch translates pixels to units and then it

LibGDX HelloWorld project crashes when run on Android emulator

时间秒杀一切 提交于 2019-11-27 07:50:59
问题 I've been trying to get the Hello-World project to run as part of learning LibGDX. Using the Nightly Build (libgdx-nightly-20140322). However, I have become quite frustrated because the hello-world-desktop project will work when run as a Java Application, the hello-world-html project will Run As a Web Application. But hello-world-android simple produces a not very descriptive error: I have checked on here looking for similar problems and found Android Emulator does not launch LibGDX project?,

LibGdx resolutionFileResolver + Assetmanager, file names?

半世苍凉 提交于 2019-11-27 07:23:02
问题 I want to use the resolution file resolver to select a correct texture atlas for my app, so I createa RFR with a couple of resolutions: Resolution _568x1136 = new Resolution(568, 1136, ".568x1136"); Resolution _1200x1920 = new Resolution(568, 1136, ".1200x1920"); ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), _568x1136, _1200x1920); manager = new AssetManager(); manager.setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver)); Now I'm

LibGdx doesn't working after updating Gradle (Android Studio 3.0)

▼魔方 西西 提交于 2019-11-27 07:01:00
问题 I have recently updated android studio and gradle to the version 3.0.0 following instructions in this link https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html After doing this libgdx desktop project doesn't work. It give me this error java.lang.NoClassDefFoundError: com/badlogic/gdx/ApplicationListener at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class

How to draw smooth text in libgdx?

你离开我真会死。 提交于 2019-11-27 06:37:52
I try to draw simple text in my android game on libgdx , but it's look sharp. How to make text look smooth in different resolutions? My Code: private BitmapFont font; font = new BitmapFont(); font.scale((ppuX*0.02f)); font.draw(spb, "Score:", width/2-ppuX*2f, height-0.5f*ppuY); One solution is to use the FreeType extension to libgdx, as described here . This allows you to generate a bitmap font on the fly from a .ttf font. Typically you would do this at startup time once you know the target resolution. Here's an example: int viewportHeight; BitmapFont titleFont; BitmapFont textFont; private