Skip to content

Instantly share code, notes, and snippets.

View demonixis's full-sized avatar

Yannick Comte demonixis

View GitHub Profile
@demonixis
demonixis / XRSubSystemTest.cs
Created January 13, 2020 13:28
A demonstration of how to use the all new XRSubsystem with Unity 2019.3+
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.Management;
public class XRSubSystemTest : MonoBehaviour
{
public void Start()
{
var xrSettings = XRGeneralSettings.Instance;
if (xrSettings == null)
@demonixis
demonixis / toggleFullscreen.js
Created March 18, 2013 16:07
A simple function to toggle fullscreen in JavaScript. It work well on Firefox and Webkit browsers.
/**
* Toggle fullscreen function who work with webkit and firefox.
* @function toggleFullscreen
* @param {Object} event
*/
function toggleFullscreen(event) {
var element = document.body;
if (event instanceof HTMLElement) {
element = event;
@demonixis
demonixis / Animation sample
Created May 19, 2012 20:45
Yna Framework Animations
public SpriteState()
{
sonicSprite = new Sprite(new Vector2(50, 50), "2d//soniclg4");
sonicSprite.LoadContent();
sonicSprite.PrepareAnimation(50, 41);
sonicSprite.AddAnimation("down", new int[] { 0, 1, 2, 3 }, 25, false);
sonicSprite.AddAnimation("left", new int[] { 4, 5, 6, 7 }, 25, false);
sonicSprite.AddAnimation("right", new int[] { 8, 9, 10, 11 }, 25, false);
sonicSprite.AddAnimation("up", new int[] { 12, 13, 14, 15 }, 25, false);
@demonixis
demonixis / Deploy-itch.sh
Last active August 12, 2023 10:23
Itch.io deploy script using Butler for DVR Simulator
#!/bin/bash
readonly ITCH_GAME_URL="$ITCH_USER/$ITCH_GAME"
readonly FOLDER_NAME="DVR-Simulator"
readonly GAME_NAME="DVR Simulator"
readonly BUTLER_PATH="../__Tools__/Butler/Butler.exe"
echo "Itch.io deployer for $GAME_NAME"
echo "Available targets: ue5, win64, win64-trial, linux, linux-trial, osx, osx-trial, quest, quest-trial, android, all, standalone"
read -p "Version: " gameVersion
@demonixis
demonixis / EnableOpenXR.gd
Created May 23, 2023 09:04
Enable XR in Godot 4 project
extends Node3D
var interface : XRInterface
func _ready() -> void
interface = XRServer.find_interface("OpenXR")
if interface and interface.is_initialized():
get_viewport().use_xr = true
@demonixis
demonixis / MathHelper.js
Created December 4, 2012 10:38
JavaScript Math helper
var MathHelper = {
// Get a value between two values
clamp: function (value, min, max) {
if (value < min) {
return min;
}
else if (value > max) {
return max;
}
@demonixis
demonixis / ArrayResize.js
Created April 15, 2015 13:51
Resize an array with JavaScript is easy
var array = [1, 2, 3, 4, 5];
console.log(array.length); // 5
array.length--;
console.log(array.length); // 4
array.length += 15;
console.log(array.length); // 19
@demonixis
demonixis / LightVariation.cs
Last active January 27, 2022 19:49
a simple script for varying the intensity of light with Unity 3D
using UnityEngine;
using System.Collections;
public class BlinkLight : MonoBehaviour
{
Light light;
public float minIntensity = 0.0f;
public float maxIntensity = 1.5f;
public float frequency = 0.01f;
public float phase = 0.0f;
@demonixis
demonixis / PersonClass.js
Last active November 8, 2021 15:26
A basic Person class in JavaScript
/***********************************
* First method to create a classe *
* *********************************/
var Person = function (firstname, lastname, age) {
this.firstName = firstname;
this.lastName = lastname;
this.age = age;
this.setAge = function (age) {