Skip to content

Instantly share code, notes, and snippets.

View lukz's full-sized avatar

Łukasz Żmudziak lukz

View GitHub Profile
@lukz
lukz / FixedTMPColorsEditor.cs
Last active June 19, 2023 23:22
Extension of a TextMeshProUGUI Editor that includes a workaround to fix wrong outline color. Place this file in the Editor folder.
using TMPro;
using TMPro.EditorUtilities;
using UnityEditor;
using UnityEngine;
namespace LukaszZmudziak
{
[CustomEditor(typeof(TextMeshProUGUI), true), CanEditMultipleObjects]
public class FixedTMPColorsEditor : TMP_EditorPanelUI
{
@lukz
lukz / regionFromSpineAtlas.js
Last active May 26, 2017 11:10
Finding regions in @orange-games phaser-spine atlas cache and creating sprite
function create() {
var atlasKey = 'atlasKey';
var regionKey = 'someRegionInsideAtlas';
var data = this.game.cache.getSpine(atlasKey);
var textureLoader = new PhaserSpine.SpineTextureLoader(game);
var spineAtlas = new spine.Atlas(game.cache.getText(data.atlas), textureLoader);
var sprite = createSprite(game, getRegionByName(spineAtlas, regionKey));
}
@lukz
lukz / PerspectiveGroup.java
Last active June 8, 2016 20:47
Group that allows to change its perspective along X axis (will be very simple to change axis) using orthographic camera and Scene2d. You have to set camera.near = -1000 and camera.far = 1000 on your OrthographicCamera.
package om.mandir.gdx.utils.actors;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Affine2;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.scenes.scene2d.Group;
/**
* Allows to render Group in perspective.
*
@lukz
lukz / SpineUtils.java
Last active January 11, 2016 15:11
SpineUtils.putRegionIntoSpineSkin() allows to programmatically put LibGDX TextureRegion into Spine animation slot by replacing existing attachment in cloned spine skin. This way you don't have to change SkeletonData so you can use it for multiple spine animations with LibGDX AssetManager.
/**
* @author Lukasz Zmudziak, @lukz_dev on 2016-01-11.
*/
public class SpineUtils {
public static Skin cloneSkin(Skeleton skeleton, Skin oldSkin, String newName) {
Skin newSkin = new Skin(newName);
Array<Attachment> slotAttachments = new Array<Attachment>();
Array<String> attachmentNames = new Array<String>();