libgdx

Ambiguous results with Frame Buffers in libgdx

廉价感情. 提交于 2020-01-04 09:25:30
问题 I am getting the following weird results with the FrameBuffer class in libgdx. Here is the code that is producing this result: // This is the rendering code @Override public void render(float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); stage.act(); stage.draw(); fbo.begin(); batch.begin(); batch.draw(heart, 0, 0); batch.end(); fbo.end(); test = new Image(fbo.getColorBufferTexture()); test.setPosition(256, 256); stage.addActor(test); } //This is the

Ambiguous results with Frame Buffers in libgdx

橙三吉。 提交于 2020-01-04 09:25:14
问题 I am getting the following weird results with the FrameBuffer class in libgdx. Here is the code that is producing this result: // This is the rendering code @Override public void render(float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); stage.act(); stage.draw(); fbo.begin(); batch.begin(); batch.draw(heart, 0, 0); batch.end(); fbo.end(); test = new Image(fbo.getColorBufferTexture()); test.setPosition(256, 256); stage.addActor(test); } //This is the

LibGDX: How to draw in the area of the black bars of a FitViewport?

烈酒焚心 提交于 2020-01-04 05:35:08
问题 I got a FitViewport with a virtual width and virtual height. When the screen got another aspect ratio than my virtual resolution black bars are added. I want to draw something inside these letterboxes. I tried to do it that way, but only objects "inside" my virtual resolution are drawn, objects "outside" are just not visible: viewport = new FitViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, cam); viewport.apply(); batch.setProjectionMatrix(cam.combined); batch.begin(); batch.draw(texture, viewport

How to handle resume for libGDX Image with Pixmap texture

断了今生、忘了曾经 提交于 2020-01-04 04:57:06
问题 I have a com.badlogic.gdx.scenes.scene2d.ui.Image that is built from a Pixmap. The Pixmap is only one pixel because I'm using it to build an Image that functions as a background that can fade in and out. Pixmap pmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888); pmap.setColor(1.0f, 1.0f, 1.0f, 1.0f); pmap.drawPixel(0, 0); bgImage = new Image(new Texture(pmap)); pmap.dispose(); bgImage.setSize(MyGame.VIRUAL_WIDTH, MyGame.VIRUAL_HEIGHT); bgImage.getColor().a = 0.0f; bgImage.addAction(Actions

How to use SQLite with libgdx

China☆狼群 提交于 2020-01-04 03:51:22
问题 I was wondering if anyone knows a good tutorial that explains how to use SQLite with libgdx. All the ones I have found don't explain it well and I'm having trouble figuring out how to use it. So if you know of one that explains everything decently please give me the link to it. Thanks in advance. 回答1: Notice that the extensions available won't work for multi-platform, at max you'll be able to support Android and Desktop. My advise is for you to create your own classes for methods for

LibGDX textfield input causes crash

最后都变了- 提交于 2020-01-04 03:15:43
问题 So i'm trying to make a login screen, now the problem is, when I input text in the textfield, my game just crashes, this is my mainmenu class: import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com

LibGDX textfield input causes crash

江枫思渺然 提交于 2020-01-04 03:15:15
问题 So i'm trying to make a login screen, now the problem is, when I input text in the textfield, my game just crashes, this is my mainmenu class: import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com

libgdx position window outside of stage

北慕城南 提交于 2020-01-04 02:47:07
问题 I am wondering how to use MoveToAction (or any method) for positioning a scene2d Window outside of the stage. I want the menu to slide in and out. My Stage and my Skin are stored in my world class. These methods work fine for now, while not at all animating it: Window window = new Window("NoteBook", world.skin); ... public void closeBook() { window.remove(); } public void openBook() { world.stage.addActor(window); } This is how I am trying to update these functions to allow animation. Here

Change sprite color into white

瘦欲@ 提交于 2020-01-04 02:22:45
问题 I'm trying to change the color of a sprite (wich is red and gray), in white color. sprite.setColor(1, 1, 1, 1); But nothing is happening. How can I change all the sprite colors in white ? please, thanks you 回答1: If you want to change the color of all the shapes in the sprite to white then the only way you can do this is to use a pixel shader and set all the fragments that they are not black(i assume black renders as transperant in your game) to white. Something like that: varying vec4 v_color

Libgdx : setting another screen, but still buttons from old screen active

只愿长相守 提交于 2020-01-03 11:15:11
问题 In my libgdx game , I have 2 screens, menu and list . When I click on a label in the menu screen, I do a setscreen(list) . The new screen shows up, and the menu screen alongwith its labels disappears. But when I click on the same positions (from menu screen where the labels were, but of course those labels are not showing as I have changed screens) the click event responds. Why? note:My list screen currently has not event handlers for any widget. When switching screens do I need to do