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
@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
@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 / 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
#!/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
Pour avoir un projet moins ambigü, aucun fichier n'est au pluriel, tout au singulier, en vrai l'orthographe importe peu dans ces cas la.
Cette règle permet de gagner du temps lorsqu'on veut nommer des fichiers/répertoires.
nom-du-projet/
.gitignore
- config/
- default.json <= Options par défaut
- local.json <= Fichier ajouté une fois, mais ensuite mis dans le fichier .gitignore, comme ça tous les devs pourront rouler l'app localement
- custom-environment-variable.json <= Utilisé pour la prod, les variables secrètes sont des variables d'environnement, donc plus dur a récupérer en cas de hack
- lib/
@xsellier
xsellier / Structure d'un projet pour Godot Engine
Created May 8, 2019 21:54
Structure d'un jeu fait sous Godot Engine
Pour avoir un projet moins ambigü, aucun fichier n'est au pluriel, tout au singulier, en vrai l'orthographe importe peu dans ces cas la.
Cette règle permet de gagner du temps lorsqu'on veut nommer des fichiers/répertoires.
nom-du-projet/
.gitignore
assets/ <= utilisé pour les assets non inclus dans le jeu. Par exemple pour les succès steams.
design/ <= Le Game Design Document se trouve dans ce répertoire (c'est pas forcément un seul fichier ça peut être une collection de fichier)
game/ <= C'est là que se trouve tous les fichiers utilisé par godot. On doit utiliser ce répertoire pour pour ouvrir le projet via Godot engine
asset/
fx/ <= Contient les effets sonores du jeu
@xsellier
xsellier / gist:743ba1f214ab89259c8b2ac338670dc2
Created February 7, 2020 19:24
Debug les signaux de Godot Engine
extends Node
# ' emit_signal\(([^\n]+)*\)'
# ' debug_manager.emit_signal_debug(self, [\1])'
# ' ([^\s]+)\.emit_signal\(([^\n]+)*\)'
# ' debug_manager.emit_signal_debug(\1, [\2])'
var new_frame = true
var signals = {}
#!/bin/bash -e
while [ true ]
do
CURRENT_LINE_COUNT=$(git diff --shortstat | sed -e 's/,/\n\r/gi' -e 's/files changed/Fichiers modifiés/gi' -e 's/insertions/Lignes ajoutées/gi' -e 's/deletions/Lignes supprimées/gi')
echo -e "Statistiques:\n${CURRENT_LINE_COUNT}" > ~/Stream/line-count.txt
sleep 60
done
@xsellier
xsellier / godot3.2-benchmark.gd
Last active December 2, 2020 15:47
Benchmark GDScript
extends Node
export(bool) var click_to_run setget run
var outfile : File
var startusec : int = 0
var elapsed : int = 0
var testvar : int = 0
var bigarray : Array = []
func fileinit():
@xsellier
xsellier / computeSteamTags.js
Last active December 3, 2020 16:05
Install request and async npm packages first, then run `node computeSteamTags.js`
/******************************************
* PREREQ:
* NodeJS 8+
* NPM
******************************************
* USAGE:
* npm install async request
* node index.js
******************************************/
const async = require('async')