Skip to content

Instantly share code, notes, and snippets.

View ssube's full-sized avatar

Sean Sube ssube

View GitHub Profile
<Material texture="tex.dds" effect="bump.fx">
<Parameter name="bump_texture" value="texB.dds" />
</Material>
material "tex.dds"
{
effect = "bump.fx";
parameters
{
// Replace new with tracking-new and include the debug CRT header:
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#define NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new NEW
// In your startup code, init the tracker:
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRT0DBG_LEAK_CHECK_DF);
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
// While loop:
int x = 0;
while (x < y)
{
// do things
x++;
}
// For loop:
@ssube
ssube / Data.cs
Created February 17, 2012 04:53
Adventurey: Minimal text adventure
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Adventurey
{
public class Exit
{
[XmlAttribute("keyword")]
public String Keyword { get; set; }
@ssube
ssube / gist:2316056
Created April 6, 2012 02:17
c# short circuit
using System;
using System.Text;
namespace ShortCircuitTest
{
class Program
{
public static bool x() { Console.Write(" [x] "); return false; }
public static bool y() { Console.Write(" [y] "); return false; }
public static bool z() { Console.Write(" [z] "); return true; }
#include <iostream>
#include "Rectangle.h"
Rectangle::Rectangle() :
m_Width(0), m_Height(0), m_Unit('#')
{
// empty
}
Rectangle::Rectangle(int width, int height) :
@ssube
ssube / gist:2605557
Created May 5, 2012 20:57
FEZ Hydra rotation LED
public static void Main()
{
FEZHydra board = new FEZHydra();
LED7R led7 = new LED7R(14);
int n = 0;
while (true)
{
led7.TurnLightOn(++n, true);
n %= 7;
@ssube
ssube / gist:2605577
Created May 5, 2012 21:05
FEZ Hydra - Light indicator
public static void Main()
{
FEZHydra board = new FEZHydra();
LED7R led7 = new LED7R(14);
LightSensor light = new LightSensor(13);
light.DebugPrintEnabled = true;
for (int i = 0; i < 7; ++i)
{
led7.TurnLightOff(i);
}
@ssube
ssube / gist:3213546
Created July 31, 2012 04:15
sliding chunk window
private Chunk[,] chunks;
private Vector2 lastChunk;
private int chunkSize;
private void updateChunks(Vector2 position)
{
// Get the current chunk
Vector2 currentChunk = new Vector2(position).div(chunkSize);
if (currentChunk == lastChunk)
{
@ssube
ssube / Warning
Created August 11, 2012 17:14
Uninitialized pointer SA warning
C6101 Returning uninitialized memory Returning uninitialized memory '*pStrings'. A successful path through the function does not set the named _Out_ parameter. Voodoo_Core string.cpp 1
'*pStrings' is not initialized 1
Enter this branch, (assume 'pStrings') 8
Skip this loop, (assume 'index<cap' is false) 12
Skip this branch, (assume '<branch condition>' is false) 18
'*pStrings' is an _Out_ parameter that may not have been assigned to 1