Skip to content

Instantly share code, notes, and snippets.

@jringrose
jringrose / InspectorReadOnly.cs
Last active December 21, 2016 07:56
Use this InspectorReadOnly attribute for public fields that you want to easily inspect in the editor without allowing modifications. InspectorReadOnlyDrawer needs to be inside an Editor folder.
using System;
using UnityEngine;
// Usage:
//
// [InspectorReadOnly]
// public float someValue = 5f;
//
public class InspectorReadOnly : PropertyAttribute {
@digitalshadow
digitalshadow / OpenSimplexNoise.cs
Last active June 25, 2024 07:41
OpenSimplex Noise Refactored for C#
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace NoiseTest
@Kojirion
Kojirion / shapes.cpp
Last active August 29, 2015 13:57
The separating axis algorithm for arbitrary sf::Shapes
#include <SFML/Graphics.hpp>
#include <cmath>
#include <vector>
#include <memory>
//Vector math functions
float dotProduct(const sf::Vector2f& lhs, const sf::Vector2f& rhs)
{
return lhs.x * rhs.x + lhs.y * rhs.y;