Skip to content

Instantly share code, notes, and snippets.

View demonixis's full-sized avatar

Yannick Comte demonixis

View GitHub Profile
@Olical
Olical / about.md
Created January 31, 2012 14:19
Fullscreen API class

This is a wrapper class for the fullscreen API. It should make it easier to use.

It is supported in the latest versions of Chrome and Safari. It will be supported in Firefox in version 10 (which is released tomorrow).

All calls to activate fullscreen have to be made from a user action. So a button click for example.

Here are some useful links. To run the example it has to be run on its own page, not an iframe. So I have linked to where the iframe points in jsFiddle.

@ianbarber
ianbarber / DotView.java
Created September 6, 2013 13:47
An Android view that responds to gamepad events
package com.riskcompletefailure.happydot;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
@jsermeno
jsermeno / perspectiveProject.js
Created June 5, 2011 03:19
Three.js Transform 3D coordinates to screen coordinates and back in perspective projection - http://catchvar.com/threejs-game-transforming-isometric-screen-co
var
projector = new THREE.Projector(),
p3D = new THREE.Vector3(25, 15, 9),
p2D;
p2D = projector.projectVector(p3D, camera);
p3D = projector.unprojectVector(p2D, camera);
@rpavlik
rpavlik / 99-sensics-usb.rules
Created January 11, 2016 23:24
udev rules for sensics HMDs
# udev file for USB interfaces on Sensics-based HMDs and emulated devices
###
# Section to permit access to HID streaming
###
# OSVR HDK (via HIDAPI/libusb)
SUBSYSTEM=="usb", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0b00", MODE="0660", GROUP="plugdev"
@flarb
flarb / VRInputModule.cs
Created August 20, 2014 22:27
Lets you use a VR world space cursor with World Space Canvases in Unity3D 4.6. Add this to the EventSystem object. Put some box colliders on your buttons in the World Space Canvas. Then, do a trace to see if you're looking at a menu object--if the trace hits one of those buttons, pass it to SetTargetObject. See ralphbarbagallo.com for a longer e…
using UnityEngine;
using UnityEngine.EventSystems;
//by Ralph Barbagallo
//www.flarb.com
//www.ralphbarbagallo.com
//@flarb
public class VRInputModule : BaseInputModule {
@flarb
flarb / SDKSwap.cs
Created May 23, 2015 18:50
Swap between Unity3D Google Cardboard and Gear VR / OVR Mobile SDKs. It swaps out the Android manifest files when you switch platforms--pretty much all you need (aside from wrapping the APIs) to switch platforms.
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
public class SDKSwap : EditorWindow {
static string _cardboardPath;
static string _OVRPath;
@sinc
sinc / gist:2409107
Created April 17, 2012 21:16
get rotation matrix from accelerometer
CMRotationMatrix rotationMatrixFromGravity(float x, float y, float z)
{
// The Z axis of our rotated frame is opposite gravity
vec3f_t zAxis = vec3f_normalize(vec3f_init(-x, -y, -z));
// The Y axis of our rotated frame is an arbitrary vector perpendicular to gravity
// Note that this convention will have problems as zAxis.x approaches +/-1 since the magnitude of
// [0, zAxis.z, -zAxis.y] will approach 0
vec3f_t yAxis = vec3f_normalize(vec3f_init(0, zAxis.z, -zAxis.y));
@tgjones
tgjones / YourProject.csproj
Last active August 17, 2021 08:43
Automatically adding MonoGame XNBs into an assembly as Embedded Resources
<Target Name="BeforeBuild" DependsOnTargets="BuildContent">
<ItemGroup>
<!-- Include just-built XNB files as embedded resources in output assembly -->
<EmbeddedResource Include="@(ExtraContent)">
<LogicalName>Apollo.Resources.Compiled.$([System.String]::new('%(RecursiveDir)').Replace('\', '.'))%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
<!-- Don't copy XNB files to output directory -->
<Content Remove="@(ExtraContent->'$(ParentOutputDir)\%(RecursiveDir)%(Filename)%(Extension)')" Condition="$(MonoGamePlatform) != 'Android'" />
<AndroidAsset Remove="@(ExtraContent->'$(ParentOutputDir)\%(RecursiveDir)%(Filename)%(Extension)')" Condition="$(MonoGamePlatform) == 'Android'" />
@rpavlik
rpavlik / GetRenderManager.cmd
Last active February 23, 2022 11:53
Batch script for keeping an up-to-date local copy of the latest 32 and 64-bit continuous builds of OSVR RenderManager and OSVR Core
@echo off
rem By Ryan Pavlik, Sensics, Inc. <http://sensics.com/osvr>
rem Copyright 2015-2016 Sensics, Inc.
rem SPDX-License-Identifier: Apache-2.0
rem Put this in a directory of its own, preferably. It will create one file and two subdirectories.
rem Doesn't hurt to run it more often than there are builds: it won't re-download (though
rem it will harmlessly re-extract)
rem Requires that you have wget and 7za (the command line version of 7z) in your path.
@flibitijibibo
flibitijibibo / FNAWindowExample.cs
Last active April 30, 2022 15:21
Example to hook up an SDL2 window to a Panel for use in a System.Windows.Forms window
#region License
/* FNA GameWindow for System.Windows.Forms Example
* Written by Ethan "flibitijibibo" Lee
* http://www.flibitijibibo.com/
*
* Released under public domain.
* No warranty implied; use at your own risk.
*/
#endregion