Skip to content

Instantly share code, notes, and snippets.

View ErisianArchitect's full-sized avatar

Null ErisianArchitect

  • USA
View GitHub Profile
@ErisianArchitect
ErisianArchitect / EvalHelper.cs
Created October 19, 2011 06:27
XScript Tokenizer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace XScript.Helpers
{
public sealed class EvalHelper
{
@ErisianArchitect
ErisianArchitect / matTransformatiosn.txt
Created October 19, 2011 23:00
Transformation methods
public static Matrix Invert(Matrix matrix)
{
Matrix matrix2;
float num5 = matrix.M11;
float num4 = matrix.M12;
float num3 = matrix.M13;
float num2 = matrix.M14;
float num9 = matrix.M21;
float num8 = matrix.M22;
float num7 = matrix.M23;
@ErisianArchitect
ErisianArchitect / tokenizer.txt
Created October 22, 2011 19:20
Read config
//Also note, this is pseudo-code, when passing the index to a function, you want to pass it as a reference so that you can modify the index.
void Tokenize(string src)
{
int ind = 0;
string configName = empty;
while(ind < src.Length)
{
char c = src[ind];
if(c == '#')
{
typedef unsigned char byte;
struct OpCode
{
byte Prefix : 4;
byte Code : 4;
};
struct TypeCodes
{
@ErisianArchitect
ErisianArchitect / Flood_Fill.cs
Created January 26, 2012 19:27
Flood Fill Algorithm
Queue<Point> _floodQueue = new Queue<Point>();
public static void FloodFill(Point start, Tile tile, MapRenderer map, DrawLayer layer)
{
if (map.ContainsTilePoint(start.X, start.Y))
{
Tile startTile = map.GetTile(start.X, start.Y, layer);
if (startTile != tile)
{
_floodQueue.Clear();
#pragma once
template<class T>
class List
{
private:
int bufferSize,top,sizeCap;
public:
T* buffer;
@ErisianArchitect
ErisianArchitect / outward_draw.cs
Created February 19, 2012 15:52
Drawing algorithm
#define FASTDRAW
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Microsoft.Xna.Framework;
@ErisianArchitect
ErisianArchitect / generatekey.cpp
Created February 26, 2012 20:56
Serial Key Generation with a format.
int generateKey(char* dest,char* format,unsigned int seed)
{
if(dest && format)
{
srand(seed);
int len = strlen(format);
for(int i = 0; i < len; i++)
{
switch(format[i])
{
@ErisianArchitect
ErisianArchitect / sat.cpp
Created March 5, 2012 00:12
Separating Axis
void getMin(double* values,int c, double & result)
{
//If count is greater than 0, find the min.
if(c > 0)
{
//Set result to the first value.
result = values[0];
//Begin looping through each value
for(int i = 1; i < c; i++)
{
int arr[5];
int input = 0;
arr[0] = INT_MAX;
arr[1] = INT_MAX;
arr[2] = INT_MAX;
arr[3] = INT_MAX;
arr[4] = INT_MAX;
for(int i = 0; i < 5; i++)
{
cin >> input;