libgdx

Why am I getting a blank screen when using shader?

折月煮酒 提交于 2019-12-22 01:30:53
问题 I'm using this tutorial to create and draw an outline for my game Sprite s. However, all I get is a blank red screen. I'm very new to Shader s so I'm not sure if I'm missing something very trivial. My vertex and fragment shaders were copy-pasted from the above tutorial. (Commenting on the tutorial doesn't seem to work so I was unable to seek help there.) My code: float x = 0, y = 0, height = 256, width = 256, angle = 0, outlineSize = 1f; @Override public void create() { batch = new

java and libGDX / LWJGL game fullscreen wrong size for multiple monitors on Ubuntu

十年热恋 提交于 2019-12-22 01:12:34
问题 I'm working on a libGDX (library on top of LWJGL) game project, and use the Intellij IDEA IDE from several different workstations: Windows 7 x64 laptop with two displays (1920x1080 and 1600x1200), nVidia GT540M. Ubuntu 12.04 LTS on a laptop with a single display (1366x768), Intel integrated graphics. Ubuntu 12.04 LTS on a desktop with two displays (1920x1080 and 1280x1024), nVidia GTS 450. I'm using the OpenJDK for Java 6 on the Ubuntu boxes, and Sun/Oracle Java 6 on the Windows box (I heard

Extract byte[] from Libgdx Texture

大兔子大兔子 提交于 2019-12-22 00:18:14
问题 I want to upload an internal png image to my backend, the API supplied with the backend only allows for byte[] data to be uploaded. But so far, I haven't found a way of extracting byte[] data from a texture. If it's an internal resource or not, I'm not sure matters? So what ways are there to achieve this using Libgdx framework? The image I want to use is loaded with the AssetManager. 回答1: Before trying to do this, make sure to understand the following: A Texture is an OpenGL resource which

Make a phone call programatically using Libgdx

若如初见. 提交于 2019-12-21 23:58:05
问题 I'm creating an app using libgdx. In the contact page I would like, as for the email ( Gdx.net.openURI("mailto:cippa@lippa.com"); ), give the chance to made a phone call by clicking on the phone number. Is this possible using libgdx? Or I have to do this twice, using first Android and then iOS? (Like in this question: How to make a phone call programmatically? ) Thank you! EDIT How is possible to make a phone callprogrammatically in JAVA for iOS? Because for Android is clear, simple and done,

Get vertice list of a polygon shape body

筅森魡賤 提交于 2019-12-21 23:52:49
问题 How do you get a list of vertices for a specific polygon body in libgdx? Like this : public Array<Vector2> getVerts(Body body){ Array<Vector2>verts = null; // can't find how to look them up properly anywhere return verts; } Thanks! 回答1: Based on @James Webster's code: Array<Vector2> verts = new Array<Vector2>(); Fixture f = body.getFixtureList().get(0); PolygonShape s = f.shape; // this is needed to temporarily keep the vertex, getVertex is a void method Vector2 tmp = new Vector2(); for (int

how to import Universal tween engine in IntelliJ with lib gdx

假装没事ソ 提交于 2019-12-21 23:39:40
问题 okay.. I'm trying to create a splash screen for my mobile game. im using lib gdx library to create my game. i have a problem with importing the universal tween engine for my sprite splash. what should I do. I've downloaded the universal tween engine and extracted it in the "libs" folder in the ios, android, core, and root of my project.. and i copied and paste these lines for each dependencies: project(":core") { fileTree(dir: 'D:/game/core/libs', include: 'tween-engine-api.jar') compile

Libgdx: Moving a rotated perspective camera

▼魔方 西西 提交于 2019-12-21 21:05:09
问题 I am developing an android app which visualize the map of an environment and currently i am using libgdx to draw the map, also like any map application the user should be capable of zoom, rotate and moving the map, I have developed a GestureHandler class which implements GestureListener interface and interacts with a PerspectiveCamera (since i will use 3d components in the future): @Override public boolean pan(float x, float y, float deltaX, float deltaY) { float tempX = (mapView.getCamera()

Libgdx Stencil & ShapeRenderer

落爺英雄遲暮 提交于 2019-12-21 20:06:50
问题 I am trying to accomplish something like this: sample image The whole screen will be black, then the insides of the triangle shape are the parts that will only appear. I tried using SCISSOR but it is rectangle in shape. *Original Image Source: https://www.html5rocks.com/static/images/screenshots/casestudies/onslaught/controls_tutorial.png 回答1: There are a few different ways that you can render a masked image. One possible way is to use the depth buffer. I've written a small method that shows

touch scrolling with libgdx

这一生的挚爱 提交于 2019-12-21 19:59:07
问题 I'm trying to implement touch scrolling in a libgdx game. I have a wide image that is a panorama of a room. I want to be able to scroll the image so the user can see around the room. I have it so that I can scroll a certain distance but when a new touchDragged event is registered the image is moved back to the original position. This is how I'm implementing it public class AttackGame implements ApplicationListener { AttackInputProcessor inputProcessor; Texture backgroundTexture; TextureRegion

Rotation of Orthographic Camera

随声附和 提交于 2019-12-21 18:36:50
问题 I am able to rotate camera with this code camera.zoom = 3//in constructor if(camera.zoom>1) { camera.zoom-=0.01f; camera.rotate(15); } this is done in render, Now zooming effect works properly but when zooming completes my screen is stay rotated with current angle. like below. I want that my screen stops after zooming at 0 degree. 回答1: In your code snippet **camera.zoom=3;** and in each iteration you are zooming camera by 0.01 till camera.zoom > 1 so you have total 20 iteration for zooming