libgdx

Trouble batching cubes in libgdx

﹥>﹥吖頭↗ 提交于 2019-12-01 14:19:42
I am trying to develop a game where I am rendering up to 300 cubes on screen. The performance of modelBatch when creating new modelInstance for each cube is terrible. There is no 3d batch that batches all the cubes to one draw call as far as I know. So I am desperately trying to batch them somehow. This question is directly related to this one: LibGDX 3D increase perfomance The answer posted batches all the cubes successfully but when environment is added to get some lighting it appears that the cubes have missing sides or something else is wrong with them. Heres a picture: Here is my cube

Rendering box2d in libgdx

荒凉一梦 提交于 2019-12-01 14:16:27
I have a game world of size 800x480 using a FitViewport and was initally rendering box2d bodies + fixtures using pixels so all the physics appeared floating and slow. Looking at the documentation I realised box2d uses metrics units so I went through and converted the box2d positions and sizes by a factor of 32 so I end up with a box2d world of 25x15 metres. The issue I'm having is that now box2d objects are rendered incredibly small. How can I scale them back so they appear regular size on screen? You need to use conversions factor between world and box2. In your create() you'll have : private

Font size in textfield libgdx

▼魔方 西西 提交于 2019-12-01 14:13:44
How can I change the size of textfield font in libgdx? UserNameTextField = new TextField("", GlobalSKin); UserNameTextField. ??? Aiman Batul There are various builtin methods you can call to set size. If you just want to set the size of textfield you can call UserNameTextField.setWidth(float width) Or UserNameTextField.setHeight(float width) or UserNameTextField.setMaxLength(maxLength) And if you only want to set size of font then do it like ` TextField.TextFieldStyle textFieldStyle = skin.get(TextField.TextFieldStyle.class); textFieldStyle.font.scale(1.6f); ` You can check all methods , just

LibGDX logging not showing up in logcat

人走茶凉 提交于 2019-12-01 14:10:48
问题 I cannot get LibGDX logging to work in Android Studio. First i thought I had the same problem as my previous question but made sure my app updated on debug. playButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { Gdx.app.debug("BUTTON", "playButton Pressed"); optionButton.addAction(Actions.moveBy(-200, 0, 2)); } }); The test action on the option button is carried out but i cannot get the debug log to show up. 回答1: The default Log level is

How to completely disable MultiWindow support in LIBGDX game

南楼画角 提交于 2019-12-01 14:09:15
I'm getting alot of memory allocations in my render thread and I've traced the cause to MultiWindow support which is weird because I have this feature disabled on my phone . I've added to AndroidManifest the following (based on this ) code inside the application tag but with no luck, I still get unwanted memory allocations (only when I touch the screen): <meta-data android:name="com.sec.android.support.multiwindow" android:value="false" /> <meta-data android:name="com.samsung.android.sdk.multiwindow.multiinstance.enable" android:value="false" /> How can I completely disable the MultiWindow

android studio cannot resolve import org.json.JSONObject

橙三吉。 提交于 2019-12-01 14:07:28
问题 I used libgdx to build my project and I am having issues using the JSONObject class. When I add import org.json.JSONObject , it says it cannot resolve. How do I add that library to my project? Here is what I have tried without success: I downloaded the json-simple-1.1.jar and put it in core/build/libs folder. Could not use import.org.json.simple.JSONObject either. When browsing the tree in Android Studio as "Packages" dropdown, I can see the classes I want under "Core -> Libraries -> org ->

Rendering box2d in libgdx

南笙酒味 提交于 2019-12-01 14:00:41
问题 I have a game world of size 800x480 using a FitViewport and was initally rendering box2d bodies + fixtures using pixels so all the physics appeared floating and slow. Looking at the documentation I realised box2d uses metrics units so I went through and converted the box2d positions and sizes by a factor of 32 so I end up with a box2d world of 25x15 metres. The issue I'm having is that now box2d objects are rendered incredibly small. How can I scale them back so they appear regular size on

Black out everything outside a polygon

ぐ巨炮叔叔 提交于 2019-12-01 12:58:34
I have a map, for simplicity let's say it's just a single texture. On top of this map, I have a polygon which indicates the route that the user must follow. What I want is to draw everything outside the polygon black. Or, of course to only draw things inside the polygon. To explain it better I made a picture. The blue lines define the polygon, with each corner being a point in the polygon. The red with yellow lines is the part I want to black out of the picture, and only leave the red with the purple lines. The polygon starts from A and ends at B. The main challenge here is that you need to

Ads are not displaying after publishing final application

北城余情 提交于 2019-12-01 12:36:12
I had a game which I designed using libgdx. It was displaying ads before publishing it on Google Play as I tested it by this code: adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId(AD_UNIT_ID); AdRequest adRequest = new AdRequest.Builder().addTestDevice(TEST_DEVICE).build(); adView.loadAd(adRequest); Before publishing the game I changed some lines of my code to be like this: adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId(AD_UNIT_ID); AdRequest.Builder builder = new AdRequest.Builder(); adView.loadAd(builder.build()); but it shows no

LIBGDX speeding up a whole game (using box2d)

巧了我就是萌 提交于 2019-12-01 12:36:11
I was wondering how i can speed up whole game done with libgdx (for example after clicking a button). The way i have in my game is modify a timestep variable used in world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS); but im now sure if it's a good idea. If there a any better way to archive that? When using Box2D you can speed up your game by modifying the physics step. One problem is that you should use a constant steptime. I use the following code below in my games: private float accumulator = 0; private void doPhysicsStep(float deltaTime) { // fixed time step // max frame time to