libgdx

“Tainted canvases may not be loaded” Cross domain issue with WebGL textures

一世执手 提交于 2019-12-28 04:21:07
问题 I've learnt a lot in the last 48 hours about cross domain policies, but apparently not enough. Following on from this question. My HTML5 game supports Facebook login. I'm trying to download profile pictures of people's friends. In the HTML5 version of my game I get the following error in Chrome. detailMessage: "com.google.gwt.core.client.JavaScriptException: (SecurityError) ↵ stack: Error: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Tainted canvases may not be loaded. As I

Extreme Zoom with gamecam - Libgdx

左心房为你撑大大i 提交于 2019-12-26 03:14:10
问题 Hi guys i'm quite new to libgdx I tried to make the camera follow the player. Trying to do so i read online that i had to add this line of code. game.getBatch().setProjectionMatrix(gamecam.combined); By doing so i noticed that my game was really zoomed i tried to dezoom it but i was not able to make it work. Do you guys have any suggestion? This is my GameScreen where i render the player. `public class GameScreen implements Screen { private Logang game; //basic playscreen variables private

Cannot render .tmx map using OrthogonalTiledMapRenderer (Android)

冷暖自知 提交于 2019-12-25 18:51:39
问题 I am having a hard time getting a map to display correctly on my android app using LibGdx. First up here is my code: public class PlayState extends State { private LittleMan littleMan; private TiledMap map; OrthogonalTiledMapRenderer tiledMapRenderer; OrthographicCamera camera; public PlayState(GameStateManager gsm) { super(gsm); littleMan = new LittleMan(50,100); float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); camera = new OrthographicCamera(); camera.setToOrtho(false,

Libgdx Array<> how to get last item?

孤街浪徒 提交于 2019-12-25 16:56:40
问题 I want to change Y position of "bucket", when camera Y position is higher than "last created bucket" Y position: There is my code in "create()" method buckets = new Array<Bucket>(); for(int i=1;i<BUCKET_COUNT;i++){ buckets.add(new Bucket(world,(rand.nextInt((int)W)-45)/PPM,BUCKET_MARGIN*i/PPM)); } And I am doing like this in "render()" method: for(Bucket bucket : buckets){ if(cam.position.y > buckets.peek().getBody().getPosition().y){ bucket.repos(rand.nextInt((int)W)/PPM,buckets.size+BUCKET

How do I add a timer in libgdx java?

佐手、 提交于 2019-12-25 16:53:37
问题 I am trying to add a timer for power ups in my game. What I am trying to do is change a parameter (like jump height for example) after the player has collided with the power up box but it should only apply for 4 seconds. I have already written the collision coding and have added a random element to choose which power up is activated. I have also added a power up that will not use the timer (adding 1 to the score). Searching google I found code using various methods like Gdx.graphics

libgdx TiledMap Rendering Performance Issue

你说的曾经没有我的故事 提交于 2019-12-25 16:52:08
问题 So I had performance issues with my libgdx project and I tracked it down to the map rendering. I isolated the issue by creating an empty project and do as little as possible, just the map rendering. This is the code I came up with: The Desktop start up project class: package com.me.test; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; public class Main { public static void main(String[] args) {

LibGDX and the GoogleApiClient setup/integration (first time)

孤街浪徒 提交于 2019-12-25 16:20:30
问题 I'm majorly stuck trying to add Google Play and then release my app on the Play Store. Thing is i made it in LibGDX by implementing the Screen class and now all of a sudden the Google guides are trying to make me create layout.xml and add loads of new stuff into my app simply to get a silly "sign-in" button. I've read/research everywhere for like 40+ hours STRAIGHT now!! and I not really any flippin closer! I now HATE google with a passion (i was a supporter until the other day!) Their ...

LibGDX and the GoogleApiClient setup/integration (first time)

試著忘記壹切 提交于 2019-12-25 16:20:28
问题 I'm majorly stuck trying to add Google Play and then release my app on the Play Store. Thing is i made it in LibGDX by implementing the Screen class and now all of a sudden the Google guides are trying to make me create layout.xml and add loads of new stuff into my app simply to get a silly "sign-in" button. I've read/research everywhere for like 40+ hours STRAIGHT now!! and I not really any flippin closer! I now HATE google with a passion (i was a supporter until the other day!) Their ...

How to load a TrueTypeFont with different parameters? LibGDX

允我心安 提交于 2019-12-25 14:44:13
问题 The way I have been doing it so far is copying the same font, saving under another name and loading it with different parameters. I am trying to develop an app in LibGDX and by saving the font as different files takes more memory than necessary. Isn't there a way of loading 1 font multiple times, each time with different parameters? 回答1: Take a look of this example, I am creating a list of BitmapFont object having different size by simply changing attributes of FreeTypeFontGenerator

Why doesn't my approach work to continuously repeat an action till a libgdx scene2d button is pressed and stop it when the button is released?

不打扰是莪最后的温柔 提交于 2019-12-25 14:01:46
问题 I know many questions have been asked to solve similar problem but i could not find an answer to it. Problem : I have made a screen for my libgdx game which looks like the following screenshot. I want the input through touch only.When i press and hold the button labeled 'lower' it decrements the number in the middle once. I want it to keep decrementing until i release the 'lower' button. I have placed the button in a table, which in turn is added on a stage. To achieve what i want i used the