Skip to content

Instantly share code, notes, and snippets.

View xsellier's full-sized avatar
🏠
Working from home

Xavier Sellier xsellier

🏠
Working from home
View GitHub Profile
#!/bin/bash
# This script is intended to run on Linux.
set -eo pipefail
export BUILD_REVISION=official
# if this flag is set, build is tagged as release in the version
# Build templates
@xsellier
xsellier / batch-build.sh
Last active February 15, 2020 22:53
Compile Godot Engine 2.1-branch
#!/bin/bash
# This script is intended to run on Linux.
set -eo pipefail
export BUILD_REVISION=official
# if this flag is set, build is tagged as release in the version
# Build templates
@xsellier
xsellier / color.gd
Last active March 19, 2018 14:50
RGB to HSL
extends Node
const S_FOREGROUND = 100 / 255.0
const L_FOREGROUND = 217 / 255.0
const PRELOADED_COLORS = {
red = Color('f44336'),
pink = Color('e91e63'),
purple = Color('9c27b0'),
deep_purple = Color('673ab7'),
@xsellier
xsellier / atlas-texture-utils.gd
Last active May 6, 2019 12:57
Computing UV map from an atlas texture
static func compute_uv(atlas_texture):
var uv_array_region = atlas_texture.get_region()
var uv_array_size = atlas_texture.get_atlas().get_size()
# 0.5 is used to get a margin (remove blank pixel due to round)
var uv_array_00 = (uv_array_region.pos + Vector2(0.5, 0.5)) / uv_array_size
var uv_array_01 = (uv_array_region.pos + Vector2(0.5, uv_array_region.size.y - 0.5)) / uv_array_size
var uv_array_11 = (uv_array_region.pos + uv_array_region.size + Vector2(-0.5, -0.5)) / uv_array_size
var uv_array_10 = (uv_array_region.pos + Vector2(uv_array_region.size.x -0.5, 0.5)) / uv_array_size