Skip to content

Instantly share code, notes, and snippets.

@crykn
crykn / clipboard.js
Last active March 11, 2022 17:25
A simple copy to clipboard button; is used at https://github.com/libgdx/libgdx.github.io
/* 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) {
@crykn
crykn / switch_to_lwjgl3.md
Last active October 17, 2022 06:06
How to switch to libGDX's LWJGL3 backend

How to switch your libGDX project to LWJGL 3


--- This guide is now available on libgdx.com. Check it out here. If you have any questions, join us on Discord! ---


  1. To switch to libGDX's LWJGL 3 backend, open your root build.gradle file and replace the LWJGL backend dependency:
@mgsx-dev
mgsx-dev / BlendingExportDemo.java
Last active February 25, 2021 00:13
How to draw into a FBO with proper blending function and save it to a PNG file
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;
@williewillus
williewillus / primer.md
Last active April 22, 2024 15:29
1.13/1.14 update primer

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

Things in Advance

  • 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 (/).

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@mattdesl
mattdesl / ShaderBatch.java
Created December 11, 2012 02:56
Brightness/Contrast SpriteBatch
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" //