libgdx

LibGdx too much FPS. How to limit?

好久不见. 提交于 2021-02-05 04:52:02
问题 I'm doing a game and I have a problem on some (strange) low end android devices (Galaxy S mini, Galaxy ACE ), with actually bad hardware. The FPS is on both devices 85+, and on other devices (HTC Desire, Sony Xperia Arc S, Samsung Galaxy S, HTC Wildfire ) the FPS is "normal" (around 60FPS). Also 60 FPS is showing on computer too. Obviously 85+ FPS is too much, because the game experience is different and it may cause unfair advantage to those players who are playing on 85FPS+. I want to limit

How to fix error reading JSON file in libGDX?

。_饼干妹妹 提交于 2021-01-28 21:50:00
问题 I am trying to implement Dialog from libGDX When reading json file for Skin I get an error. Caused by: com.badlogic.gdx.utils.GdxRuntimeException: No Drawable, NinePatch, TextureRegion, Texture, or Sprite registered with name: white I added uiskin.atlas, default.fnt, uiskin.png to the project Code uiskin.json { BitmapFont: { default-font: { file: default.fnt } }, Color: { green: { a: 1, b: 0, g: 1, r: 0 }, white: { a: 1, b: 1, g: 1, r: 1 }, red: { a: 1, b: 0, g: 0, r: 1 }, black: { a: 1, b: 0

libGDX change tilemap

半腔热情 提交于 2021-01-28 12:10:41
问题 I am making an 2d rpg game with box2d. So, I've got a problem. When one of my bodies(the character) collides with another(a door) the map needs to change, should I just create new screens for maps and change them? Or is there a more simple solution? 回答1: You can change your current map on the same screen only. What you have to do is, Let's say your map variable name is testMap . Now let's say your player just collided with a door. Now let's say you will call a method called changeMap() . Here

How do I read this Generics correctly from JSON?

我们两清 提交于 2021-01-28 03:51:35
问题 I'm reasonably confident in my first generics container, but stuck on how to word the casting on the client side. This is what was working before I got involved in learning <T> stuff: CommonNounContainer typeContainer = new Json().fromJson(CommonNounContainer.class, result); I was looking at having to create a different container for each class, and that doesn't seem like good design. Below is my updated, non-working attempt to read in my new generics container: JSONContainer<CommonNoun>

LibGDX JSON parsing from an API

依然范特西╮ 提交于 2021-01-28 00:36:46
问题 I'm trying to parse a JSON returned by OpenWeatherMap API, specifically this. I'm using the approach suggested in this post, that is create classes with class variables with names same as parameters in the returned JSON. It works for all parameters except the "3h" one in "rain" and "snow". Obviously, I can't create a variable named 3h in Java and the class variable has to have the same name. Is there a way how to parse it all (including the "3h") properly? 回答1: So, there were few solutions:

java Threads in libGDX

安稳与你 提交于 2021-01-21 05:08:34
问题 I am working on making a game with libGDX and I really want to thread the game so I am running a paint loop and a logic loop on separate threads much like you would making a simple java swing game with the paintcomponent loop and the runnable run loop. I am experienced with threading in c but not so much in java. The only way I was able to make a thread was by making a class that extends threads and then creating the run loop in there. But the point of making the run loop was to allow each

Android创建LibGdx项目

天大地大妈咪最大 提交于 2020-11-20 16:02:14
Android创建LibGdx项目 1.简介 2.libgdx开发语言 3.跨平台特性 4.创建项目 5.项目目录 6.结语 1.简介 LibGDX 是非常优秀的一款 跨平台 的 2D / 3D 游戏开发框架,开发使用 Java 语言 ,基于 Apache License, Version 2.0 协议,代码托管在 Github 上,对商业使用和非商业使用均 免费。 官方网站: 点这 Github仓库: 点这 官方Wiki: 点这 官方DocsApi: 点这 2.libgdx开发语言 LibGDX 框架本身使用 Java/C/C++ 开发而成,所有相关的 C/C++ 代码都封装了 Java 调用接口,对于我们使用者来说只需要使用 Java 语言 来开发游戏即可,对于像小编这样的对 Java 比较熟悉的程序员来说,如果想快速学习和开发跨平台游戏,LibGDX 是非常不错的选择。 3.跨平台特性 LibGDX 目前支持 Desktop(标准 JavaSE 实现,包括 Windows、MAC OS X、Linux)、Android、BlackBerry、iOS 和 HTML5(WebGL) 平台。LibGDX 对所有平台统一使用一套 Java API 编程接口,开发者只需要在把游戏开发当成是开发普通的 JavaSE 桌面应用直接在桌面环境下开发、运行查看显示效果和调试代码逻辑