Skip to content

Instantly share code, notes, and snippets.

View TinkerWorX's full-sized avatar

Nikolaj Mariager TinkerWorX

  • SoundHound
  • Denmark
View GitHub Profile
using System;
using System.Numerics;
using System.Text;
using Veldrid;
using Veldrid.SPIRV;
namespace Desolation.Graphics
{
public unsafe class QuadRenderer : IDisposable
{
<Project>
<Import Project="$(SharedDir)Nullable.props" />
<PropertyGroup>
<!-- Treat nullable warnings as errors -->
<!-- List found here: https://github.com/dotnet/roslyn/blob/master/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs -->
<WarningsAsErrors>$(WarningsAsErrors), CS8600</WarningsAsErrors>
<WarningsAsErrors>$(WarningsAsErrors), CS8601</WarningsAsErrors>
<WarningsAsErrors>$(WarningsAsErrors), CS8602</WarningsAsErrors>
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using OpenCL.Net;
namespace TinkerWorX.Simulation.MonoGame
{
public enum D3dDeviceSource : uint
{
D3D11_DEVICE = 0x4019,
public class TileAtlas : IReadOnlyList<Rectangle>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Rectangle IndexToRectangle(int index, int stride, int tileSize) => new Rectangle((index % stride) * tileSize, (index / stride) * tileSize, tileSize, tileSize);
private readonly int stride;
private readonly int colorCount;
public TileAtlas(GraphicsDevice graphicsDevice, int tileSize, int atlasSize = 4096)
/* ========== READONLY =========== */
/* == CHANGES WILL BE DISCARDED == */
/* ========== READONLY =========== */
#define HEAL_ID 'u000'
#define MIN_DAMAGE_ID 'u001'
#define MAX_DAMAGE_ID 'u002'
#define ARMOR_ID 'u003'
#define BUILDER_ID 'u004'
#define VILLAGER_ID 'u005'
using System;
using System.Runtime.InteropServices;
namespace Ultralight.Net.Interop
{
[StructLayout(LayoutKind.Sequential)]
public struct Platform
{
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate IntPtr GetterDelegate(IntPtr that);
using System;
using System.Runtime.InteropServices;
namespace Ultralight.Net
{
public class ClConfig : IDisposable
{
[StructLayout(LayoutKind.Sequential)]
private struct C_Config
{
@TinkerWorX
TinkerWorX / MonoGameProject.xml
Created September 24, 2019 20:41
Suggested project
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netcoreapp3.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45'">
<DefineConstants>$(DefineConstants);NETFULL</DefineConstants>
</PropertyGroup>
@TinkerWorX
TinkerWorX / war3map.lua
Created September 11, 2019 23:39
example
-- === START OF DO NOT MODIFY THIS ===
#include "../out/war3map.lua"
-- === END OF DO NOT MODIFY THIS ===
#define DEBUG 1
#include "log.lua"
#include "hacks.lua"
#include "map.lua"
#include "3rdParty/SimplexNoise.lua"
<Project>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<PropertyGroup>
<MonoGamePlatform>Windows</MonoGamePlatform>
<MonoGameContentCommand>&quot;$(SolutionDir)3rdParty\MonoGame.Content.Builder\MGCB.exe&quot;</MonoGameContentCommand>
<MonoGameContentFile>/@:&quot;$(MSBuildThisFileDirectory)\Content.mgcb&quot;</MonoGameContentFile>
<MonoGameContentObject>/intermediateDir:&quot;$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)\$(TargetFramework)\Content&quot;</MonoGameContentObject>
<MonoGameContentOutput>/outputDir:&quot;$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)\$(TargetFramework)\Content&quot;</MonoGameContentOutput>
</PropertyGroup>