Marker Interfaces

May 24, 2011 Empty Interface, Marker Interfaces

In Snowball I was debating adding an empty interface to identify certain classes in my framework as components. I wasn't sure if this was code smell or not so I did some searching on Stackoverflow and found out this concept is actually called "Marker Interfaces". Learn something new every day.

ComponentGlue on GitHub

May 10, 2011 ComponentGlue, Dependency Injection, IoC

I moved the ComponentGlue repository to GitHub. I updated the example slightly and cleaned up some of the source code a little. Need to build a full blown app with it eventually.

Snowball and GitHub

April 12, 2011 Github, Snowball

I started writing a 2D Game Engine on GitHub. I call it Snowball because I'm original like that.

Using git-gui with Cygwin on Windows 7

April 07, 2011 Cygwin, git, git-gui, Windows 7

I've started using git via cygwin and was running into trouble trying to pin it to my taskbar in Windows 7.

First I created a .bat file in the c:\cygwin folder which launches the app standalone:

@@echo off

chdir C:\cygwin\bin

start run.exe git gui

You can change paths accordingly. Now run the batch file and pin the program to the taskbar. You'll notice after you close the app, the icon changes and it won't launch again.

Right click on the shortcut while holding shift and choose properties. Change the target to the batch file we wrote. You can change the icon to the git-gui icon by pointing the shortcut icon to "C:\cygwin\usr\share\git-gui\lib\git-gui.ico".

Now if you click on the icon, the git-gui app should start up. Kill your explorer.exe in task manager and restart. If the icon is still the genie lamp, you'll need to clear your icon cache to get the icon to look right. Credit for that from here. Kill your explorer.exe again and while explorer is gone, start cmd.exe. From there enter the following commands:

CD /d %userprofile%\AppData\Local

DEL IconCache.db /a


After that your icon should be there as you want.

Getting started with SlimDX

March 31, 2011 DirectX

*Update 2013-09-29: At this point SlimDX is quite out of date and I would recommend starting with SharpDX.

Since I tried OpenTK, I decided to give SlimDX a try as well. So, here's a simple getting started app:

using System; using System.Drawing; using System.Windows.Forms; using SlimDX; using SlimDX.Direct3D9; using SlimDX.Windows; namespace SlimDXApp1 { public partial class SlimDXApp1Form : RenderForm { struct Vertex { public Vector4 Position; public int Color; } Device device; VertexDeclaration vertexDeclaration; public SlimDXApp1Form() : base("SlimDXApp1") { this.ClientSize = new Size(800, 600); this.device = new Device(new Direct3D(), 0, DeviceType.Hardware, this.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters() { BackBufferWidth = this.ClientSize.Width, BackBufferHeight = this.ClientSize.Height }); this.vertexDeclaration = new VertexDeclaration(this.device, new[] { new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.PositionTransformed, 0), new VertexElement(0, 16, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0), VertexElement.VertexDeclarationEnd }); } public void Run() { MessagePump.Run(this, () => { this.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); this.device.BeginScene(); this.device.VertexDeclaration = this.vertexDeclaration; this.device.DrawUserPrimitives<Vertex>(PrimitiveType.TriangleList, 1, new[] { new Vertex() { Color = Color.Red.ToArgb(), Position = new Vector4(400.0f, 100.0f, 0.5f, 1.0f) }, new Vertex() { Color = Color.Blue.ToArgb(), Position = new Vector4(650.0f, 500.0f, 0.5f, 1.0f) }, new Vertex() { Color = Color.Green.ToArgb(), Position = new Vector4(150.0f, 500.0f, 0.5f, 1.0f) } }); this.device.EndScene(); this.device.Present(); }); } [STAThread] static void Main() { SlimDXApp1Form form = new SlimDXApp1Form(); form.Run(); // Cleans up COM handles foreach(var item in ObjectTable.Objects) item.Dispose(); } } }