libgdx

Button doesn´t rotate libGDX

柔情痞子 提交于 2019-12-13 15:15:52
问题 I want to rotate a button. Therefore I wrote the following code: public void show () { skin2 = new Skin (Gdx.files.internal("SettingsButton.json")); button2 = new Button(skin2); button2.setPosition(25,1440); button2.setSize(120,120); button2.setOrigin(button2.getWidth() / 2, button2.getHeight() / 2); button2.addAction(Actions.repeat(RepeatAction.FOREVER, Actions.sequence( Actions.rotateBy(360, 1), Actions.rotateTo(0)))); button2.addListener(new ClickListener(){ @Override public void clicked

Lots of allocations in Libgdx slow down game and cause sprite-jolts

旧巷老猫 提交于 2019-12-13 12:44:36
问题 I found out that LIBGDX allocates a lot of variables (not from any of my methods). I just ran the game for a few seconds and I've already got 32000 rows in DDMS->Allocation Tracker . The methods that allocate are getPalmRejection , createFromParcel and nativeReadString . Is it normal to have this many allocations in just a couple of seconds? I get 60FPS but sometimes it drops to 58-59 and that is important because I use framerate-independent movement in my game and I get alot of sprite-jolts

LibGDX AssetManager not loading anything

你离开我真会死。 提交于 2019-12-13 10:18:28
问题 I have recently added an AssetManager class to my LibGDX game, but I can't seem to get it to work. Here's my AssetManager class: public class AssetLoader { public AssetManager manager = new AssetManager(); public void loadAssets(){ manager.load("antoanimation.png", Texture.class); manager.load("antoButton.png", Texture.class); manager.load("bg2.png", Texture.class); manager.load("bottomtube2.png", Texture.class); manager.load("clickme.png", Texture.class); manager.load("diamtermopan.png",

FitViewport does not scale actor

时间秒杀一切 提交于 2019-12-13 10:15:16
问题 I have FitViewport with virtual screen size 1920x1080. viewport = new FitViewport(AssetLoader.VIRTUAL_WIDTH, AssetLoader.VIRTUAL_HEIGHT); stage = new Stage(viewport); Also, there is TimeBar class extended from Actor class. TimeBar listing: public class TimeBar extends Actor { private Color color; private ShapeRenderer renderer; private float time, current; public TimeBar() { color = Color.valueOf(AssetLoader.TIMEBAR_COLOR); renderer = new ShapeRenderer(); renderer.setColor(color.r, color.g,

how do i stop this “IndexOutOfBoundsException” issue?

六眼飞鱼酱① 提交于 2019-12-13 09:59:57
问题 So I the app lets a user place down blocks on a grid, if the user lines up 3 or more blocks with the same suit, or color, then something happens. When player places a block I call this method: blocks_.add(new Block(new Vector2(rect_mouse.x, rect_mouse.y), blocks_.get(0).blockID, blockCount)); When you place 3 or more together I call these methods: blocks_.removeValue(blocks_.get(left_bravo_indexNum), true); blocks_.removeValue(blocks_.get(center_charlie_indexNum), true); blocks_.removeValue

Error loading TTF file - Libgdx

淺唱寂寞╮ 提交于 2019-12-13 08:39:38
问题 I have created a android project with LibgdGdx where i create a AssetManager class, where I load all the assets I need, but when I run the project i have an error when a ttf file is loading. The code of the AssetManager: public AssetManager manager; public AssetsManager(){ manager = new AssetManager(); loadAssets(); } public void loadAssets(){ loadTtf("assets/Birds.TTF"); } void loadTtf(String path){ FileHandleResolver resolver = new InternalFileHandleResolver(); manager.setLoader

How to get the starting point of each bullet? Libgdx simple game

十年热恋 提交于 2019-12-13 07:57:27
问题 I want to get the starting point of the bullet but i can't make it final, and the bullet.x and bullet.y is always changing so i'm not sure how to save the starting co-ordinates of each bullet. It spawns in a random place and then moves. I've tried saving the bullet.x and bullet.y to a variable when it starts but that changes when the bullet moves as well Here is my code:- public class MyGame extends ApplicationAdapter { SpriteBatch batch; Texture ballImage, bulletImage; OrthographicCamera cam

LibGDX displays black screen while app is paused but still visible (e.g. during in-app purchase password dialog) on iOS

北城余情 提交于 2019-12-13 07:43:32
问题 I converted one of my apps over to LibGDX. In the earlier version, when I launch an in-app purchase and iOS shows the dialog to ask the user for their password, my app would stay visible and running (animations would update) in the background behind the dialog. After the switch to LibGDX (and no other changes regarding purchasing), the app now disappears and the background behind the password dialog is just black. Right before this happens, LibGDX reports [debug] IOSApplication: paused and

Libgdx file handle.. reading a single line

人走茶凉 提交于 2019-12-13 06:59:56
问题 I am trying to save and load files on a project that is coded on libgdx. Which means that i cant use a buffered reader because android wont read it.. and i cant move the project to android because it has to be in the core... after days and days or understanding all.. now i am trying File handing which should work right?? but i cant get it to read line by line.. it puts all the text in on string.. Help plzz.. also is my understanding correct and saving and loading is waaaay more complicated

Exit screen causing Java native memory to grow

孤人 提交于 2019-12-13 06:04:12
问题 With a LibGDX Game I have a Lobby Screen From the Lobby Screen I can go to Game 1 Game 2 Game 3 Game 4 When I exit Game 1 (for example) I return back to the Lobby Which allows me now to pick Game 3 (for example) What I'm noticing is the java native memory is growing When I do Lobby -> Game 1 -> Lobby -> Game 2 - > Lobby -> Game 3 -> Lobby - > Game 4 … From Lobby I have switch (selection) { case 1: NewStage = new Game1Screen(); break; case 2: NewStage = new Game2Screen(); break; case 3: