Skip to content

Instantly share code, notes, and snippets.

View Jjagg's full-sized avatar

Jesse Jjagg

View GitHub Profile
@Jjagg
Jjagg / Game1.cs
Last active August 25, 2021 01:51
MonoGame backend sample for ImGui.NET (https://github.com/mellinoe/ImGui.NET)
using System;
using System.Runtime.InteropServices;
using ImGuiNET;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Vector2 = ImGuiNET.Vector2;
using Vector3 = ImGuiNET.Vector3;
using Vector4 = ImGuiNET.Vector4;
@Jjagg
Jjagg / IPrimitiveBatcher.cs
Last active July 2, 2021 20:04
Platform agnostic primitive batcher with implementation for MonoGame.
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
namespace MgWheels
{
public interface IPrimitiveBatcher
{
void DrawLine(Vector2 p1, Vector2 p2, Color color, float lineWidth);
void DrawLineStrip(IEnumerable<Vector2> points, Color color, float lineWidth);
@Jjagg
Jjagg / UpscalePoint.cs
Created November 7, 2017 20:45
Upscaling with Point sampling in MonoGame
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace WinDesktopPlatformer
{
public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
@Jjagg
Jjagg / AlphaTestSample.cs
Created January 15, 2018 22:05
MonoGame sample for using AlphaTestEffect
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace AlphaTestSample
{
public class Game1 : Game
{
private GraphicsDeviceManager _graphics;
@Jjagg
Jjagg / BlendTransparentSample.cs
Created January 15, 2018 23:16
MonoGame sample that shows how you make a texture use the transparency of another texture by rendering it on top of the first one with a custom blend state.
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace BlendStateSample
{
public class Game1 : Game
{
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
@Jjagg
Jjagg / Color.cs
Created February 19, 2018 13:56
Creating a Color class that can interop with MonoGame, but isn't necessarily dependant on it.
using System.Runtime.InteropServices;
namespace MyGameLibrary
{
/// <summary>
/// Value type representing an ABGR color with 1 byte per channel (values in [0-255]).
/// </summary>
[StructLayout(LayoutKind.Explicit)]
public struct Color
{
@Jjagg
Jjagg / GifGame.cs
Last active June 14, 2020 20:25
Create a GIF with ImageSharp in MonoGame by storing old frames. MIT license: https://opensource.org/licenses/MIT
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.PixelFormats;
namespace ImageSharpMg
@Jjagg
Jjagg / FrameStore.cs
Last active March 11, 2021 18:42
Store and export old frames in MonoGame using ImageSharp. MIT license: https://opensource.org/licenses/MIT
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.PixelFormats;
namespace ImageSharpMg
{