libgdx

Android ndk + libgdx

杀马特。学长 韩版系。学妹 提交于 2019-12-11 07:54:36
问题 I have a project in libgdx. I want to add Native Support. When connecting libgdx folder libs are files \ armeabi \ libgdx.so \ armeabi \ libandroidgl20.so \ armeabi-v7a \ libgdx.so \ armeabi-v7a \ libandroidgl20.so When I build the libraries My.cpp , folders armeabi and armeabi-v7a overwritten armeabi folder contains only My.so , folder armeabi-v7a becomes empty. An error occurs. my file Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := My ### Add all source file

libGDX - Trying to implement collision between 2 sprites

断了今生、忘了曾经 提交于 2019-12-11 07:52:05
问题 what the title says basically Bit of background about the current game: Player is always moving from left to right, if the screen is tapped he jumps if it's dragged he dashes forward. I added a tile (Platform object) and am now trying to make my Player stop moving if he hits it. The Player starts on the bottom left of the screen, and the Platform is on the top right. What happens is that the Player stops when he reaches the middle of the screen, rather than the actual Platform. Can anyone

Using TextField with LibGDX

风格不统一 提交于 2019-12-11 07:33:16
问题 I am working on an Android game with LibGDX and would like to implement two TextField s to login to a server. As far as I know I need to use Stage to add a TextField as an Actor like this: this.stage = new Stage(); TextField txtf = new TextField("", mSkin); //... stage.addActor(txtf); // And then set the stage as InputProcessor Gdx.input.setInputProcessor(this.stage); But I already have a custom InputHandler which implements InputProcessor . I don't really know how I can handle a TextField

GameScreen shows Black Screen

僤鯓⒐⒋嵵緔 提交于 2019-12-11 07:25:34
问题 I'm currently programming a game where you have to avoid asteroids. I had to deal with some messed up coordinates and I had to guess the coordinates for sprites. I now have arbitrary units that describe my world. Unfortunately, my game screen does not work fully. When I want to render my asteroids the game screen shows a black screen. public class GameScreen extends Screen { private OrthographicCamera cam; private Spaceship spaceship; private Asteroids asteroids; private Background bg;

static variables, libgdx and android pause/resume memory usage

时光毁灭记忆、已成空白 提交于 2019-12-11 07:14:48
问题 Program example: public class main extends ApplicationAdapter { public static int a; public static int b; public static Player player; public void create() { resume(); } public void render() { } public void resize() { } //pause runs when home button is pressed public void pause() { player = null; } //resume runs when the program is re-opened public void resume() { a = 10; b = 20; player = new Player(); } } On android, when the home button is pressed, the program is kept in memory and static

OrthogonalTiledMapRenderer and normal Spritebatch renders a white box?

时间秒杀一切 提交于 2019-12-11 07:09:39
问题 I am using Libgdx to render a TileMap as a background of my game. I might render some different layers later on. Without the tilemap render and a single background picture it works correctly! Something strange happens when i use the TiledRender just take a look at it: The two white areas are normally a touchpad and a character. The touchpad and the character are rendered with: @Override public void draw(SpriteBatch batch, float parentAlpha) { sprite.draw(batch); } My Map where i render my

How to continue sequence / parallel actions from cachedActions Libgdx

笑着哭i 提交于 2019-12-11 06:28:57
问题 I have a clicklistener extended class which aims to cached any current actions of the actor during touchDown, and assigns it back when touchUp is triggered. However, it does not works for sequence or parallel actions. public class MyClickListener extends ClickListener { public Actor actor; private final Array<Action> cachedActions = new Array<Action>(); @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button);

Adding a Vertex to a libgdx Mesh

感情迁移 提交于 2019-12-11 06:24:16
问题 the title basically. You can reserve more than you need when creating a mesh mesh = new Mesh(false, 100, 0, new VertexAttribute(Usage.Position, 3, "a_position")); But there is no method for adding a vertex. You can get the FloatBuffer and add to that, but I get strange results. I also tried the mesh.setVertices with offset but that does not work either. I debugged with drawing points. Works until I try adding a vertex by any means (even if I tweak offsets to account for 3 floats in one vertex

Detect user input in render() or using InputProcessor in libgdx

梦想与她 提交于 2019-12-11 06:15:08
问题 I am new to libgdx and I wonder if you should use the render() method to get user input or if you should use the InputProcessor. 回答1: That depends on the use-case. Why do you need it and does that need to be done event driven or continuous? For example, if you want to move a sprite on the screen while a certain key is pressed, then that's a continuous action: @Override public void render() { if (Gdx.input.isKeyPressed(Input.Keys.SPACE)) sprite.translateX(speed * Gdx.graphics.getDeltaTime());

Black stripes in LIBGDX

我是研究僧i 提交于 2019-12-11 06:01:29
问题 I´m doing a mario bross game and I have problems i think with the rendering. I attached some photos to explain better the issue. I don´t have any idea why this happen. Vertical stripes appear sometimes. Thanks in advance. @Override public void render(float delta) { update(delta); Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); renderer.render(); b2dr.render(world, gamecam.combined); game.batch.setProjectionMatrix(gamecam.combined); game.batch.begin(); player.draw