libgdx

I can't import or use AdView for android

荒凉一梦 提交于 2020-06-29 05:30:17
问题 I'm making an android game using libgdx and I want to add ad banners so I followed some instructions online. // I added this code on build.gradle in the dependencies: compile "com.google.android.gms:play-services-ads:8.3.0" then set the minimum sdk to 9, It didn't ask me to sync so I did it manually(btw I'm using intellij) then when I tried to add codes on AndroidLauncher I was not able to use AdView(I can't even import it cause it doesn't appear). UPDATE my project structure is different

libgdx setUserObject() not setting Object

只谈情不闲聊 提交于 2020-06-28 03:44:49
问题 I need to resort a SnapShotArray so I may render my actors in the correct order. Ordering should be an absolute distance from a center, though I want to hold on to sign for later in the rendering process to determine whether it put to the left or right of center. I determined distance from center for each actor in the first for loop, and tried using setUserObject(). When I later tried to retrieve this in the sort Comparator I was told it was a null value. SnapshotArray<Actor> children =

difference between Viewport and camera in Libgdx?

☆樱花仙子☆ 提交于 2020-05-10 10:16:12
问题 I am new to LibGdx framework and having trouble working with viewport and camera. Can anyone give a simple difference between each and use of both? 回答1: The camera defines the vantage point and how much of the world is seen on screen. Everything in your game is seen through a camera that defines a view of the world. In the case of 2D games, you use an OrthographicCamera that defines a rectangle of the world that is currently visible. OpenGL works with matrices to calculate what is seen, so to

java.lang.NoClassDefFoundError: org.apache.batik.dom.svg.SVGDOMImplementation

倖福魔咒の 提交于 2020-04-14 08:14:32
问题 I'm having weird trouble with Apache Batik library linked to my Android&LibGDX project. But let's start from beginning, in IntelliJ Idea I have a project which contains three modules: Main, Android and Desktop. "batik" library which I highlighted contains: And there is some code in "Main" module which is used in Android&Desktop modules: String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); Following code is used to

LibGDX Saving progress when switching screen

拈花ヽ惹草 提交于 2020-04-11 18:04:44
问题 How can I switch the screen and still save the progress of the current game? For example I have an additional screen, when you press tab key, that shows some information about the player (attributes, stats, etc.), but when you switch the screen again to resume your game the show method is called again and you lose everything... The only method I know is that before you hide the screen to save the game in some format and load it in show but I highly doubt that this is the proper way to do it,

LibGDX Saving progress when switching screen

强颜欢笑 提交于 2020-04-11 18:04:32
问题 How can I switch the screen and still save the progress of the current game? For example I have an additional screen, when you press tab key, that shows some information about the player (attributes, stats, etc.), but when you switch the screen again to resume your game the show method is called again and you lose everything... The only method I know is that before you hide the screen to save the game in some format and load it in show but I highly doubt that this is the proper way to do it,