libgdx

How I deploy my libgdx project to HTML/JS using TeaVM

半世苍凉 提交于 2020-02-08 10:31:10
问题 I recently created a libGDX project using vis-runtime version 0.3.4 . As due to long build times and requirement for separate runtime-gwt project, GWT support was dropped in 0.3.3 version of vis-runtime. Maybe TeaVM can be used as web backend, so I am looking for integration of TeaVM with vis-runtime library ? Take a look of this project (integration of libgdx with teaVM) that uses Maven as build system not Gradle. Any help would be greatly appreciated. 回答1: I created TeaVM backend for libGDX

is there way access specific line in file (without looping) java - libgdx

ⅰ亾dé卋堺 提交于 2020-02-06 08:08:17
问题 Hi i am using LibGDX to program android. Is there some way to sraightforward access specific line on the file without going through all the lines and reading them until i reach desired line? (Can I just say I want to read line number so-and-so?) I know there are such methods: FileHandle file = Gdx.files.internal("list.txt"); BufferedReader reader = new BufferedReader(file.reader()); reader.readLine(); <--- but it reads only first line ! //// or using scanner scanner1 = new Scanner(new File(

LibGDX problems rotating sprite

一个人想着一个人 提交于 2020-02-05 07:31:21
问题 OK so I'm really confused I've rotated sprites before and had no problem such as rotating a boat as it moves through an ocean, but for some reason I'm having a really big problem this time. So I create a texture in an assets file, but not static textures. I load the texture using the following: class Assets{ Texture img; public Assets(){ img = new Texture(Gdx.files.internal("images/PNG.png") And then I call the assets in the main class by calling: Assets assets = new Assets() And then I have

libgdx 学习笔记四 MyFirstTriangle

那年仲夏 提交于 2020-02-03 14:08:20
Introduction(序言) 上节 HelloWorld 教程证明了如何从导入一个已有的项目构造一个libgdx应用程序。让我们进一步从上一节的基础上创建项目。本教程会更详细 假使读者是一个Eclipse的初学者。以后会有更简洁的教程。 本节的 源文件包含在 MyFirstTriangle_<data>.zip 下载地址: Downloads Creating the Desktop Project 下载最新的 nightly zip 然后 解压缩 到一个名为 libgdx-nightly 临时 目录。 大部分代码包含所有的游戏逻辑,将放在一个常规的JAVA工程。在Eclipse中 点击File -> New -> Java Project。工程名为 my-first-triangle 。 在JRE选项卡中,选择 JavaSE-1.6或者类似的,然后点击 Finish 让我们复制包含所有必要的 libgdx 类和方法的库文件到我们的工作区。右键 my-first-triangle工程 选择New -> Folder,从 libgdx-nightly 目录中 复制一下文件到libs中: gdx-backend-jogl.jar gdx-backend-jogl-natives.jar gdx-sources.jar gdx-natives.jar gdx.jar

How to create libgdx main menu screen [closed]

别等时光非礼了梦想. 提交于 2020-01-31 04:00:29
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I'm new to java and libgdx and I want to create a main menu screen, Can someone give me a simple example? 回答1: What you are asking is very broad, it involves many elements like creating buttons, skins, setting up Tables, etc. Anyway you should use Screens for this, add a stage and

Drawing a gradient in Libgdx

半城伤御伤魂 提交于 2020-01-29 04:29:04
问题 Ok I have this code @Override public void render() { // do not update game world when paused if (!paused) { // Update game world by the time that has passed // since last render frame worldController.update(Gdx.graphics.getDeltaTime()); } // Sets the clear screen color to: Cornflower Blue Gdx.gl.glClearColor(0x64/255.0f, 0x95/255.0f, 0xed/255.0f, 0xff/255.0f); // Clears the screen Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Render game world to screen worldRenderer.render(); } And it draws a

Increasing the width of line drawn using Shape Renderer in LibGDX

喜夏-厌秋 提交于 2020-01-28 10:44:05
问题 I am drawing a line using Shape Renderer in LibGDX and i am using Orthographic Camera in my code, so to increase the width i used camera = new OrthographicCamera(); int lineWidth = 8; // pixels Gdx.gl10.glLineWidth(lineWidth / camera.zoom); Now, I get a wider line. But the problem arises when the screen power goes off and then turns on, the line becomes the normal one again. How to keep the width constant? 回答1: ShapeRenderer has the method rectLine that is intended to be used to draw thick

Couldn't find Type for class 'com.badlogic.gdx.maps.objects.RectangleMapObject'

妖精的绣舞 提交于 2020-01-26 03:34:06
问题 Ok, so I made a simple game in libgdx (Android Studio). It works on desktop as well as on Android but in html throws this error : Uncaught Error: java.lang.RuntimeException: java.lang.RuntimeException: Couldn't find Type for class 'com.badlogic.gdx.maps.objects.RectangleMapObject' The only code that uses RectangleMapObject in my code is this: for(MapObject mapObject: tiledMap.getLayers().get(1).getObjects().getByType(RectangleMapObject.class)){ Rectangle rectangle = ((RectangleMapObject

Drawing a partially transparent Pixmap to a Texture (libgdx)

旧城冷巷雨未停 提交于 2020-01-25 20:39:31
问题 Using libgdx, is there something we have to do to enable transparency drawing a Pixmap to a Texture? I've tried doing this before the texture's draw() call where I pass the Pixmap: Gdx.gl.glClearColor(0.5f, 0.0f, 0.0f, 1.0f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); Gdx.gl.glEnable(GL10.GL_BLEND); But it's painting an opaque dark red (glClearColor) color instead of a transparent pixel. 回答1: I don't know the reason for the lack of transparency drawing to a Texture, but it appears that using

modify picture resource to rounded rectangle border in libgdx

倖福魔咒の 提交于 2020-01-25 20:04:57
问题 Before modifing after modyfing just as we can see,i want to achieve it by code.I have searched many materials ,but they are just making a rounded rectangle by their own color,not form one picture.Any help will be very appreciated. 回答1: I made a method for doing this which takes an original pixmap (image) and combines it with a mask to crop the original image to the shape of the mask. I posted the code in a question here: libGDX: How can I crop Texture as a circle In your case the mask should