Skip to content

Instantly share code, notes, and snippets.

View JISyed's full-sized avatar

JISyed JISyed

View GitHub Profile
@JISyed
JISyed / InputManagerCloner.cs
Created April 14, 2017 01:50
Technique to clone Unity's InputManager into a ScripableObject in order to extract data for use in code
using UnityEngine;
using UnityEditor;
namespace XboxCtrlrInput.Editor
{
/// <summary>
/// Clones Unity's Input Manager into a new file at /Assets/Plugins/InputManagerClone.asset
/// </summary>
/// <remarks>
/// Do NOT modify!!!
@JISyed
JISyed / SnippetsXcodeCpp.cpp
Created April 4, 2016 03:11
A collection of C++ snippets that are useful for Xcode
//==================================================================
/// <#Insert description of new class here#>
class <#NewClassName#>
{
public:
//
// Essentials
//
@JISyed
JISyed / LoadShaderFromFile.cpp
Created December 7, 2013 04:24
A little helper function to load an OpenGL shader file (can be any text formatted file) to a C-String. The returned string has to be deleted by the caller when not needed anymore. You need: #include <iostream> #include <fstream>
const char* ReadShaderFileToMemory(const char* filePath)
{
const char * shaderFileBuffer = NULL;
std::ifstream inSdrFileStream(filePath);
if(inSdrFileStream)
{
// Get length of shader file by seeking and telling (offset of 0)
inSdrFileStream.seekg(0, inSdrFileStream.end);
unsigned long fileLength = (unsigned long) inSdrFileStream.tellg() + 1;
@JISyed
JISyed / MoveCameraInertia.cs
Last active August 31, 2022 09:26
Similar to MoveCamera.cs (https://gist.github.com/JISyed/5017805), except with inertia. This makes the camera gradually come to a smooth stop when stopping the camera movement.
// Credit to damien_oconnell from http://forum.unity3d.com/threads/39513-Click-drag-camera-movement
// for using the mouse displacement for calculating the amount of camera movement and panning code.
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
//
@JISyed
JISyed / gradually_turn.gml
Created September 5, 2013 04:05
GameMaker script (GML) that makes an object gradually turn towards a target object at the specified speed. A tutorial explaining this code can be found here: http://jibransyed.wordpress.com/2013/09/05/game-maker-gradually-rotating-an-object-towards-a-target/
// gradually_turn.gml
// --------
// Gradually turns an object towards its target
//
// FORMAT:
// gradually_turn(objToTurn, target, turnSpeed, accuracy);
//
// <objToTurn> takes an object
// <target> takes an object
@JISyed
JISyed / MoveCamera.cs
Last active August 26, 2024 05:45
Camera movement script in Unity3D. Supports rotating, panning, and zooming. Attach to the main camera. Tutorial explaining code: http://jibransyed.wordpress.com/2013/02/22/rotating-panning-and-zooming-a-camera-in-unity/
// Credit to damien_oconnell from http://forum.unity3d.com/threads/39513-Click-drag-camera-movement
// for using the mouse displacement for calculating the amount of camera movement and panning code.
using UnityEngine;
using System.Collections;
public class MoveCamera : MonoBehaviour
{
//
// VARIABLES