Skip to content

Instantly share code, notes, and snippets.

prime31 prime31

Block or report user

Report or block prime31

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@prime31
prime31 / FilePicker.cs
Last active May 2, 2019
Simple file and folder picker for ImGui.Net
View FilePicker.cs
using ImGuiNET;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using Num = System.Numerics;
namespace Nez.ImGuiTools
{
public class FilePicker
View cute_c2_collisions.cs
const int C2_GJK_ITERS = 20;
public const int C2_MAX_POLYGON_VERTS = 8;
// position of impact p = ray.p + ray.d * raycast.t
public static c2v c2Impact(c2Ray ray, float t) => c2Add(ray.p, c2Mulvs(ray.d, t));
#region Wrapper Methods
public static unsafe bool c2Collided(void* A, c2x* ax, C2_TYPE typeA, void* B, c2x* bx, C2_TYPE typeB)
View Game2.cs
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Nez;
namespace TheWall
{
public class Game2 : Game
{
View BoxController2D.cs
using Microsoft.Xna.Framework;
using Nez;
using Nez.Sprites;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vapor.Code.Utility;
@prime31
prime31 / 2DDeferredLighting.fx
Last active Apr 15, 2016
2D deferred lighting implementation (first pass, not optimized)
View 2DDeferredLighting.fx
// ##### ##### ##### ##### ##### ##### #####
// ##### ##### Common Uniforms ##### #####
// ##### ##### ##### ##### ##### ##### #####
float4x4 _objectToWorld;
float4x4 _worldToView;
float4x4 _projection; // viewToCamera?
float4x4 _screenToWorld; // this is used to compute the world-position
// color of the light
View gist:ab89f2d0b759dc11a315
public static bool TestAABBSweep(Vector2 extents1, Vector2 centre1, Vector2 velocity1, Vector2 extents2, Vector2 centre2, Vector2 velocity2, out float t0, out float t1)
{
var aabb1 = new AABB(centre1, extents1);
var aabb2 = new AABB(centre2, extents2);
//Check if the boxes are currently overlapping
if (aabb1.Overlaps(aabb2))
{
t0 = t1 = 0;
return true;
View ActionExtensions.cs
using UnityEngine;
using System.Collections;
using System;
namespace Prime31
{
public static class ActionExtensions
{
/// <summary>
@prime31
prime31 / provider.js
Created Sep 30, 2015
Atom.io Haxe package autocomplete modifications. Just replace the provider.js file from the package with this file. All modifications have the comment MIKEWASHERE for easy identification
View provider.js
// node built in
var path = require('path')
, crypto = require('crypto')
// lib code
, query = require('./query')
, debug = require('./debug')
, file = require('./file')
, state = require('../haxe-state')
, signatures = require('../parsing/signatures')
@prime31
prime31 / curry-potjiekos.recipe
Created Aug 28, 2015
MEAT Curry Potjiekos recipe
View curry-potjiekos.recipe
INSERT-MEAT-TYPE-HERE Curry Potjiekos
Ingredients
2 lb INSERT-MEAT-TYPE-HERE
2 T oil
1 onions, chopped
3 - 6 cloves garlic, crushed
2 - 3 inches ginger, crushed
@prime31
prime31 / ExampleUsage.cs
Last active Aug 29, 2015 — forked from MattRix/ObjectInspector.cs
Generic inspector class that lets you implement OnScene/InspectorGUI in your class file instead of in a separate custom editor. It also provides attributes for getting Vector3/Vector3[]/List<Vector3> editing capabilities right in the scene view and getting buttons for any methods in your class in the inspector.
View ExampleUsage.cs
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class ExampleUsage : MonoBehaviour
{
// this attribute will add handles for your Vector3s so that you can drag them around in the scene view
You can’t perform that action at this time.