libgdx

LibGDX mesh heightmap normals and lights

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to get mesh normals and lights working in LibGDX project. I already have textured mesh generated from heightmap texture pixels. The problem is I cannot get normals lighted up correctly. Also Im not 100% sure I have normal vertices correctly set up in TerrainChunk class. Heres the main class code: package com.me.terrain; import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics

Java LibGDX BitmapFont setScale method not working

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am currently trying to scale a font but I am receiving the error "the method setScale(float, float) is undefined for the type BitmapFont" This is the code section where I am getting the error, specifically in lines 2 and 4. font = new BitmapFont(Gdx.files.internal("text.fnt")); font.setScale (.25f, -.25f); shadow = new BitmapFont(Gdx.files.internal("shadow.fnt")); shadow.setScale (.25f -.25f); I created the variables here public static BitmapFont font; public static BitmapFont shadow; When I check other examples of using the setScale

Libgdx 1.3.0 doesn't build eclipse files

匿名 (未验证) 提交于 2019-12-03 02:41:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I saw that version 1.3.0 of libgdx was available so I got it and when I use the project setup to setup a project I check advanced > build for eclipse and hit generate but when I try to import it into eclipse it says no projects found. Version 1.2.0 worked perfectly for me before 1.3.0 was released now I can't even get that version to build eclipse files. Any fixes and I don't use gradle. 回答1: Try importing the projects as Gradle projects. To do that, do the following: Opening LibGDX project in Eclipse (ADT Bundle) The new ADT 23.0.2 does not

LibGDX and ScrollPane with multiple widgets

时光怂恿深爱的人放手 提交于 2019-12-03 02:40:33
Trying to add multiple items to a scrollpane I quickly found that all "addActor" functions are Unsupported. So, I went with adding a table with all the items I wanted (this code misses a image that I still want to add) to make a scrollable credits screen... but this approach (currently) doesn't allow for overflow, rendering the ScrollPane useless. (My text is only shown up to what the screen's height allows, and isn't scrollable). What's the way to make a scrollable pane with multiple widgets in LibGDX? (I only care about Android and Win/Lin/Mac platforms at the moment. pane = new ScrollPane

Libgdx: Is there an easy way to center text on each axis on a button?

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been trying to figure out a way to center text on a button, but can't find an easy, multi-purpose way to. I can do it, but it will only work for a certain string, not for any string. i would like to know if there is a way to center any string on a button. My button in this case is 185x50. I have been able to center this button on the screen, like so: buttonX = WIDTH / 2 - (screen.getRegionWidth() / 2); buttonY = HEIGHT / 2 - (screen.getRegionHeight() / 2); Any help would be much appreciated. :) 回答1: Updated the answer to libgdx

LibGDX: Filtering a scaled TextureRegion

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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.setFilter(TextureFilter.Linear, TextureFilter

LibGdx - Transition between Screens

与世无争的帅哥 提交于 2019-12-03 01:46:17
I'm trying to change the animation between Libgdx Screens. I want to write my custom animation (fade in, fade out, etc). Can someone give me a clue? I can't seem to find the implementation of the transition in the Libgdx code. I've implemented some sliding transitions using Scene2D and the universal tween engine. You can find example code here. http://www.netthreads.co.uk/2012/02/09/libgdx-scene2d-demo-with-scene-transitions/ Update: This article illustrates the approach I took to implement sliding transitions. There is a link at the bottom which takes you to a set of demos here https://github

Actions of Actors in libgdx

匿名 (未验证) 提交于 2019-12-03 01:44:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have made my Actor , but I am unclear on how to take advantage of the action and act methods. Outside of the basic Javadoc, I have not found a good tutorials on these methods. Can anyone provide an example with comments for actions on actors? 回答1: This answer is being rendered obsolete because of changes in LibGDX. For up to date documentation see scene2d wiki page . There are various available actions in LibGDX ready for you. They are in com.badlogic.gdx.scenes.scene2d.actions package. I would say that there are 3 kinds of

libgdx open gles 2.0 stencil alpha masking

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm looking for a solution to implement alpha masking with stencil buffer in libgdx with open gles 2.0. I have managed to implement simple alpha masking with stencil buffer and shaders, where if alpha channel of fragment is greater then some specified value it gets discarted. That works fine. The problem is when I want to use some gradient image mask, or fethered png mask, I don't get what I wanned (I get "filled" rectangle mask with no alpha channel), instead I want smooth fade out mask. I know that the problem is that in stencil

How to pause and resume in LibGDX using the back key?

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm creating a game using LibGDX. Now I have two problems. First, I'm trying to catch back key so that the game will pause. I'm already calling the Gdx.input.setCatchBackKey(true) method in my Game class. Here is the code : public class CvSGame extends Game { public Preferences prefs; @Override public void create() { Gdx.input.setCatchBackKey(true); prefs = Gdx.app.getPreferences("game_pref"); //setScreen(new SplashScreen(this)); //setScreen(new HomeScreen(this)); //setScreen(new GameScreen(this)); GamePlay.initialized(this); } } GamePlay