Skip to content

Instantly share code, notes, and snippets.

View kg's full-sized avatar

Katelyn Gadd kg

View GitHub Profile
.Lambda #Lambda1<Squared.Util.DeclarativeSort.Sorter`1+ValueComparer[Squared.Util.DeclarativeSort.TaggableWithIndex]>(
Squared.Util.DeclarativeSort.TaggableWithIndex& $lhs,
Squared.Util.DeclarativeSort.TaggableWithIndex& $rhs) {
.Block(System.Int32 $result) {
$result = .Block(System.Int32[] $sortKeys) {
$sortKeys = .Constant<Squared.Util.DeclarativeSort.Sorter`1+TagSortRule[Squared.Util.DeclarativeSort.TaggableWithIndex]>(Squared.Util.DeclarativeSort.Sorter`1+TagSortRule[Squared.Util.DeclarativeSort.TaggableWithIndex]).SortKeys;
$sortKeys[($lhs.Tags).Id] - $sortKeys[($rhs.Tags).Id]
};
.If ($result != 0) {
.Goto return-result { }
.method public static
void Main (
string[] ''
) cil managed
{
// Method begins at RVA 0x20f4
// Code size 134 (0x86)
.maxstack 12
.entrypoint
private static readonly Dictionary<string, Func<HttpListenerContext, IEnumerator<object>>> Handlers =
new Dictionary<string, Func<HttpListenerContext, IEnumerator<object>>> {
{"/api/list_playable_levels", ServePlayableLevelsList}
};
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Squared.Util;
using Squared.Util.Event;
using ThreesTown.Entities.EntityType;
using ThreesTown.Framework;
using ThreesTown.Modes;
IEnumerable<TilePlacement> PlacementsOrderedAlongAxis (
Pair<int> direction,
int minX = int.MinValue, int minY = int.MinValue,
int exclusiveMaxX = int.MaxValue, int exclusiveMaxY = int.MaxValue
) {
minX = Math.Max(0, minX);
minY = Math.Max(0, minY);
exclusiveMaxX = Math.Min(exclusiveMaxX, Playfield.WidthInTiles);
exclusiveMaxY = Math.Min(exclusiveMaxY, Playfield.HeightInTiles);
@kg
kg / BearSpawner.cs
Last active August 29, 2015 14:01
Threefold Trials code samples
public class BearSpawner : AnchoredEntitySpawner<Bear> {
public Bear Bear;
public BearSpawner (ThreefoldTrialsGame game, Tile anchor)
: base(game, anchor) {
if (anchor.Type != TileType.BearDen)
throw new ArgumentException("anchor");
Bear = new Bear(this);
public static void FisherYates<T> (List<T> values) {
var n = values.Count;
for (var i = 0; i < n; i += 1) {
var j = ThreefoldTrials.Game.RNG.Next(i, n);
var temp = values[j];
values[j] = values[i];
values[i] = temp;
}
}
A few variations on this core theme:
"The cream will rise to the top"
"Good games will find an audience"
"Create something truly special and you will be successful"
These lines of thinking are all COMPLETE AND UTTER NONSENSE. I would love to live in a world where those statements were true, but they are not. They have never been true in video games, even if they are perhaps true in other industries. Anyone with any experience observing games development, sales and marketing knows that these statements are false.
@kg
kg / GameplayState::Draw*.cs
Created May 27, 2014 09:10
TT rendering bullshit
private void DrawIsPlaying (Frame frame, ref ImperativeRenderer renderer) {
var renderData = new RenderData(frame, Game.ScreenSize, Game.PlayfieldRenderTarget);
using (var playfieldGroup = BatchGroup.ForRenderTarget(
renderer.Container, renderer.Layer + 1,
Game.PlayfieldRenderTarget, SetupPlayfieldView, UnSetupPlayfieldView, Game.PlayfieldRenderTarget
))
using (var playfieldCroppedGroup = BatchGroup.New(
playfieldGroup, 0,
SetupPlayfieldScissor, UnSetupPlayfieldScissor, Game.PlayfieldRenderTarget
Game.InputControls.LeftMouse.AddListener(OnLeftMouse);
}
public bool OnLeftMouse (InputControl ic, InputEvent ie) {
if (Game.IsPaused)
return false;
if (!Game.InputControls.MouseLocation.HasValue)
return false;