libgdx

Rotate Image Clockwise using LibGDX

梦想与她 提交于 2019-12-17 20:24:54
问题 How can we rotate a Image Clockwise using LibGDX? what i am looking is when a image is loaded,suppose a star, i need to rotate it from beginning of screen to end of the screen horizontally, with star rotating,how can i do that in libgdx? 回答1: When you draw the Texture with your SpriteBatch, you can use one of the draw functions that includes rotation. This javadoc has all the draw functions: SpriteBatch You can keep a variable for position and rotation, and increase the rotation and x

Could not find class XXX referenced from method XXX.<YYY>

孤街浪徒 提交于 2019-12-17 16:31:46
问题 I'm working on a libGDX project and I have a class called CheerVArachnids that has another inline class which is an event listener. When I run this project on the desktop it works fine. BUT when I run on my Android device, it can't find that inline class and I get the following error: Could not find class 'com.bbj.cva.CheerVArachnids$PlaceUnitListener', referenced from method com.bbj.cva.CheerVArachnids.<init> Here are the important parts of my class: package com.bbj.cva; public class

Circle and Polygon Collision with Libgdx

你离开我真会死。 提交于 2019-12-17 15:58:26
问题 Is there a way in Libgdx to verify a collision between a Polygon and a Circle? I saw the Intersector class but only found collision test for Circle and Rectangle. What about any other Polygon? If I need to do it manually, what's the best way to do that using Libgdx? 回答1: So, I managed to create a collision test method between a Circle and a Polygon. At least, it works for me. Here's the code: public boolean overlaps(Polygon polygon, Circle circle) { float []vertices=polygon

How to put properly a libgdx application inside swing application?

烈酒焚心 提交于 2019-12-17 15:46:38
问题 I'm creating a level editor for my game, and I ave a problem using LwjglCanvas with a JFrame. I use a JFrame (not a LwjglFrame) to keep engine and level editor as independent as possible. I have two JARs: WorldEditor.jar, and GameEngine.jar. Inside WorldEditor, I have a button called "test", that is suppose to load GameEngine.jar (if not already loaded) and launch (resart it if already loaded) it into the application main frame. Actually, what I do is injecting the WorldEditor game container

Libgdx gl10.glLineWidth()

我们两清 提交于 2019-12-17 13:03:53
问题 I have this line: Gdx.gl10.glLineWidth(width); Now, I do intend to draw a pretty thick line, and, unfortunately when I type in small values like 1 or 5 the line is obviously small. But once I surpass soemthing like 10, it no longer gets larger. I am passing in direct values in these instances, and so, I am under the impression that GL has a limit or something.... Would I be correct? Here's my code: Gdx.gl.glClearColor(0,0,0,1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch

Libgdx gl10.glLineWidth()

我们两清 提交于 2019-12-17 13:01:08
问题 I have this line: Gdx.gl10.glLineWidth(width); Now, I do intend to draw a pretty thick line, and, unfortunately when I type in small values like 1 or 5 the line is obviously small. But once I surpass soemthing like 10, it no longer gets larger. I am passing in direct values in these instances, and so, I am under the impression that GL has a limit or something.... Would I be correct? Here's my code: Gdx.gl.glClearColor(0,0,0,1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch

Using scene2d.ui with libgdx: where does the skin come from?

我与影子孤独终老i 提交于 2019-12-17 12:36:10
问题 I've read about libgdx's scene2d features, including the UI elements, but I can't get them to work. They all seem to use a skin object, how do I create one? I've gone through the nice tutorial that creates a simple libgdx game catching raindrops in a bucket, and I've created a simple board game app by loading images with a texture atlas. However, scene2d sounds like a better way to control the moving pieces in a board game app, as well as any buttons and menus. 回答1: To load a skin, you can

How to draw smooth text in libgdx?

我是研究僧i 提交于 2019-12-17 08:25:23
问题 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); 回答1: 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

How to draw smooth text in libgdx?

。_饼干妹妹 提交于 2019-12-17 08:25:04
问题 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); 回答1: 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

Sprites array merges the when rendering sprites

浪子不回头ぞ 提交于 2019-12-14 04:09:04
问题 Sprite bucketImage, background, r1, r2, r5, r10, r20, r50, r100, r200, r500, k1, k2, k5, k10, k20, k50; I create objects in the method called spawnRaindrop(). I have an array of sprites and I want to sprites were changed in the cycle as it is now, it works, but the images are merged with each other. sprites = new Sprite[15]; r1 = new Sprite(atlas.findRegion("r1")); r1.flip(false, true); r2 = new Sprite(atlas.findRegion("r2")); r2.flip(false, true); r5 = new Sprite(atlas.findRegion("r5")); r5