--- This guide is now available on libgdx.com. Check it out here. If you have any questions, join us on Discord! ---
- To switch to libGDX's LWJGL 3 backend, open your root
build.gradle
file and replace the LWJGL backend dependency:
/* Simple copy to clipboard action | |
* --- | |
* This script adds a simple "copy to clipboard" button to code elements located within <pre> elements. | |
* Requires jQuery. Can be used with the Jekyll Minimal Mistakes theme by adding it to the 'after_footer_scripts'. | |
*/ | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function onClickEffect(btn, style) { |
import com.badlogic.gdx.Game; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | |
import com.badlogic.gdx.graphics.GL20; | |
import com.badlogic.gdx.graphics.Pixmap; | |
import com.badlogic.gdx.graphics.PixmapIO; | |
import com.badlogic.gdx.graphics.Texture; | |
import com.badlogic.gdx.graphics.g2d.Batch; | |
import com.badlogic.gdx.graphics.g2d.SpriteBatch; |
This primer is licensed under CC0, do whatever you want.
BUT do note that this can be updated, so leave a link here so readers can see the updated information themselves.
1.13 and 1.14 are lumped together in this doc, you're on your own if you just want to go to 1.13 and not 1.14, for some reason.
1.15 stuff: https://gist.github.com/williewillus/30d7e3f775fe93c503bddf054ef3f93e
ResourceLocation
now throw on non-snake-case names instead of silently lowercasing for you, so you probably should go and change all those string constants now. More precisely, domains must only contain alphanumeric lowercase, underscore (_), dash (-), or dot (.). Paths have the same restrictions, but can also contain forward slashes (/).public class ShaderBatch extends SpriteBatch { | |
static final String vertexShader = "attribute vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" // | |
+ "attribute vec4 " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" // | |
+ "attribute vec2 " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" // | |
+ "uniform mat4 u_projTrans;\n" // | |
+ "varying vec4 v_color;\n" // | |
+ "varying vec2 v_texCoords;\n" // | |
+ "\n" // | |
+ "void main()\n" // |