[XNA/MonoGame/FNA] Premultiply Alpha for textures loaded via FromStream.

This is a snippet of code that leverages the GPU to quickly premultiply alpha for textures that are loaded using Texture2D.FromStream which bypasses the preprocessing provided by the content projects. Texture2D file; RenderTarget2D result; using (var titleStream = TitleContainer.OpenStream( »

[XNA] Event driven input on the PC

XNA has a rather severe limitation with regards to handling keyboard input. It is unable detect any keystrokes that occur between pollings. Because of this if your game is updating at the default 60 fps there are 0.017 seconds »

[XNA/MonoGame/FNA] Masking Sprites without Shaders

This post is an answer I posted to the Game Development Stack Exchange a while ago. It is a guide on how to perform masking using the stencil buffer. The first step is to tell the graphics card we need »