libgdx

LibGDX - Conditionally use java or android classes

别来无恙 提交于 2019-12-31 07:02:21
问题 I'm using bezier curves in my libgdx project. I was testing the desktop version using java.awt.geom with GeneralPath but when I went to test on android, it raised an error saying that I can't import java.awt . Android have corresponding classes for GeneralPath , Point2D etc so my question is how can I use those classes in their respective environments? 回答1: Android does not have an AWT implementation, so references to those classes won't work on Android. (On the desktop you're getting those

Box2d libgdx, a bit confused about the pixels to meters stuff

浪子不回头ぞ 提交于 2019-12-31 05:33:08
问题 So I understand the concept. The idea is that box2d more or less works in meters, so you need to do a conversion from pixels to it. Makes sense. I was following the tutorial/intro to box2d here. It mentions to do the conversion and gives you some example amounts to use. Now, that's all well and good, but I find when I'm using such techniques, the debugger box doesn't seem to render where they should. The collision does work as expected however. In my GameScreen class, here's how I initialize

LibGDX - how do I make my menu screen switch to the Game screen?

谁都会走 提交于 2019-12-31 05:33:06
问题 When I run the application my menu screen shows, but when I click the screen to begin playing the game the game begins playing but the menu screen is still their overlaying the game. I know this because the game has music playing. I'm also going to add a splash screen in the future but I'm not concerned about that right now. I'm new at this so please explain things as best as you can. Below are the 3 classes used to make this happen. public class SlingshotSteve extends Game { public

How to set map size on Android using LibGdx

大兔子大兔子 提交于 2019-12-31 05:22:30
问题 I'm working on a simple game and I have problem with setting the map size. I am using OrthographicCamera . I want the map to be visible. How should I set the proper size of viewport new OrthographicCamera(viewport_width, viewport_height) ? Currently I'm passing some value and when I'm drawing elements on the map I don't see them because they are out of bound, if I make the width and height enormous I can see them. I want to have the whole map visible and draw everything on the sight of the

Couldn't load shared library 'gdx' for target

家住魔仙堡 提交于 2019-12-30 21:38:13
问题 I'm having the same issue as in this question, but the answers there doesn't solve my problem. I didn't create project by gdxsetup.jar, I just included gdx.jar and gdx-backend-android.jar. I added the libgdx.so to libs/x86, but it stills throws an exception. How should I solve this? Logcat: 02-16 11:59:45.604: E/AndroidRuntime(14788): FATAL EXCEPTION: main 02-16 11:59:45.604: E/AndroidRuntime(14788): java.lang.ExceptionInInitializerError 02-16 11:59:45.604: E/AndroidRuntime(14788): at java

Fantastic Tank using libgdx (坦克大战变种版)

坚强是说给别人听的谎言 提交于 2019-12-30 12:10:09
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 在开源中国来了很久,但是没怎么写博客,自己技术糊口饭还是可以的, 写技术博客其实对个人是很有帮助的,以后多多写技术博客和上github开源,为开源贡献点绵薄之力。 这次把我之前写的一个小游戏(坦克大战的变种)放出来。 希望和大伙一起交流进步。 当然这个游戏其实很有一些想法没完成呢,只能算是一个半成品。 注释还是挺全的,刚学游戏引擎的朋友可以clone下来看看哈。 坦克大战我都写过几个版本了,从最初的javase 到 android canvan 到 opengl 再到 Libgdx游戏引擎. 一步一步的感受到了设计游戏的魅力。 个人以前也玩过不少游戏,所以对游戏也是有些想法。可惜啊,不会美术有木有。 到处反编译什么的,你懂的。代码已经放在了github上。链接 https://github.com/LightSun/FantasticTank . clone地址: https://github.com/LightSun/FantasticTank.git 最后希望结交一些志同道合的朋友,一起设计游戏,写游戏。 享受游戏设计的魅力! QQ群: 389960698 欢迎程序、ui or 美工、策划等加入。 来源: oschina 链接: https://my.oschina.net/u/1269564/blog

How to change the alpha of a bitmap font in libgdx

扶醉桌前 提交于 2019-12-30 09:32:23
问题 I want to make a message box that fade when you accept but I don't know how to change the alpha of a font, here is how I do my font: white = new BitmapFont(Gdx.files.internal("data/font/whitefont.fnt"),false); white.setUseIntegerPositions(false); white.setScale(0.025f); white.draw(batchHUD, message.nom+":", 1000*0.1f+(1000*0.8f*0.3f), 625*0.1f+(1000*0.8f*0.625f*0.5f*0.1f)+1000*0.2f); Can anyone help me ? :) I'm sorry for my english, it's not my native language. 回答1: white.setColor(1, 1, 1,

LibGDX: Filtering a scaled TextureRegion

北城余情 提交于 2019-12-30 08:25:36
问题 I have several objects with different textures for different states, so I am using a TextureAtlas made with TexturePacker, and resizing the TextureRegion where I need it. I have to resize because not only am I trying to support both 720p and 1080p, but some of my objects are tiles or cursors which resize based on the width and height of the board, as that can change in my game whereas the board will always occupy the same percentage of the screen. With a Texture , I can just do this: texture

Libgdx ModelBuilder.createRect only visible from one side

痞子三分冷 提交于 2019-12-30 07:55:07
问题 In my first libgdx 3D game i now switched from createBox to createRect , to create only the visible faces (if a wall is on the left side of another wall, its right face is not visible...). I am creating 4 models: frontFace backFace rightFace leftFace They are almost drawn how they actually should. But there is one big issue: The side faces are only visible if i look in the positive z-Direction . If i look the other side (negative z-Direction ), they don't draw. The front and back faces only

Libgdx for iOS with RoboVM - Unsatisfied link error at IOSGLES20.init

眉间皱痕 提交于 2019-12-30 06:10:09
问题 Trying to port my LibGDX game to iOS using RoboVM. When running the app for the emulator I get this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: at com.badlogic.gdx.backends.iosrobovm.IOSGLES20.init(Native Method) at com.badlogic.gdx.backends.iosrobovm.IOSGLES20.<init>(IOSGLES20.java) at com.badlogic.gdx.backends.iosrobovm.IOSApplication.didFinishLaunching(IOSApplication.java) at com.badlogic.gdx.backends.iosrobovm.IOSApplication$Delegate.didFinishLaunching(IOSApplication