Skip to content

Instantly share code, notes, and snippets.

View tomspilman's full-sized avatar
💭
I may be slow to respond.

Tom Spilman tomspilman

💭
I may be slow to respond.
View GitHub Profile
@tomspilman
tomspilman / TouchPanel.cs
Created November 9, 2012 22:32
Previous location to fix
if (newTouch.Id == touch.Id)
{
stateChanged |= touch.UpdateState(newTouch);
foundEvent = true;
events.RemoveAt(j);
break;
}
}
// If a new event was found then store it.
_root = new Sequence
{
Call.Void( () => { Program.MineCycles++; Say("Walking to the mine!"); } ),
Wait.Seconds( 2 ),
Call.Void(() => Say("Entering the mine!")),
Wait.Seconds( 1 ),
new While( IsNotFatigued )
{
internal class GLString
{
public GLString(string value)
{
#if iOS
_string = value;
#elif ANDROID
_string = new StringBuilder(value);
#endif
}
@tomspilman
tomspilman / gist:4942988
Last active December 13, 2015 16:49
Unit test to verify the balance of BinaryReader/Writer for char arrays. Could be expanded to form a complete balance test for all calls.
[TestClass]
public class BinaryReaderWriterBalance
{
class TestBinaryWriter : BinaryWriter
{
private int _counter;
public TestBinaryWriter(Stream output)
: base(output)
[exec] "c:\.jenkins\jobs\MonoGame Pull Request builder\workspace\MonoGame.Framework.WindowsGL.sln" (Build target) (1) ->
[exec] "c:\.jenkins\jobs\MonoGame Pull Request builder\workspace\MonoGame.Framework\MonoGame.Framework.WindowsGL.csproj" (default target) (2) ->
[exec] (CoreCompile target) ->
[exec] Graphics\States\DepthStencilState.cs(163,21): error CS1502: The best overloaded method match for 'OpenTK.Graphics.OpenGL.GL.StencilFuncSeparate(OpenTK.Graphics.OpenGL.Version20, OpenTK.Graphics.OpenGL.StencilFunction, int, int)' has some invalid arguments [c:\.jenkins\jobs\MonoGame Pull Request builder\workspace\MonoGame.Framework\MonoGame.Framework.WindowsGL.csproj]
[exec] Graphics\States\DepthStencilState.cs(163,44): error CS1503: Argument 1: cannot convert from 'OpenTK.Graphics.OpenGL.All' to 'OpenTK.Graphics.OpenGL.Version20' [c:\.jenkins\jobs\MonoGame Pull Request builder\workspace\MonoGame.Framework\MonoGame.Framework.WindowsGL.csproj]
[exec] Graphics\States\DepthStencilSta
@tomspilman
tomspilman / Sideload.txt
Last active December 13, 2015 20:18
How To Sideload A Windows Store App For Testing
First on the developer side:
1. Open your solution in VisualStudio.
2. Select the menu item "Project -> Store -> Create App Packages...".
3. At the first question "Do you want to build packages to upload to the Windows Store?" select "No" and hit "Next".
4. On the next page the defaults are usually fine, but change the output location if you like.
5. Go to the output location.
6. Zip the folder that ends in "_Test" and share it with testers.
<!--
MonoGame - Copyright (C) The MonoGame Team
This file is subject to the terms and conditions defined in
file 'LICENSE.txt', which is part of this source code package.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="MonoGame_ParseContent" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup>
using System;
using System.Runtime.InteropServices;
namespace Microsoft.Xna.Framework.Graphics
{
internal class MojoShader
{
#if IOS
const string mojoshader_dll = "__Internal";
#elif WINDOWS
@tomspilman
tomspilman / gist:6239196
Created August 15, 2013 08:20
Collision Groups
var defaultDynamic = BEPUphysics.CollisionRuleManagement.CollisionRules.DefaultDynamicCollisionGroup;
var defaultStatic = BEPUphysics.CollisionRuleManagement.CollisionRules.DefaultKinematicCollisionGroup;
CollisionGroup.DefineCollisionRule(CharacterTrigger, Players, CollisionRule.NoSolver);
CollisionGroup.DefineCollisionRule(CharacterTrigger, Enemies, CollisionRule.NoSolver);
CollisionGroup.DefineCollisionRule(CharacterTrigger, defaultDynamic, CollisionRule.NoBroadPhase);
CollisionGroup.DefineCollisionRule(CharacterTrigger, defaultStatic, CollisionRule.NoBroadPhase);
CollisionGroup.DefineCollisionRule(CharacterTrigger, CharacterTrigger, CollisionRule.NoBroadPhase);
CollisionGroup.DefineCollisionRule(PlayerTrigger, Players, CollisionRule.NoSolver);
@tomspilman
tomspilman / gist:6530056
Created September 11, 2013 21:31
Changing the depth/stencil.
// Create a new depth buffer.
var newDepthBuffer = GL.GenRenderbuffer();
// Set the format and size of the new depth buffer.
GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, newDepthBuffer);
GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, RenderbufferStorage.Depth24Stencil8, width, height);
// Attach the new depth buffer to the default backbuffer.
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthStencilAttachment, RenderbufferTarget.Renderbuffer, newDepthBuffer);