Created
February 2, 2017 04:36
-
-
Save riverar/1880c952522e51fed708502bf69a9f29 to your computer and use it in GitHub Desktop.
T4 Text Template to generate Unity opengl32/glu32 dummies for batchmode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ template debug="false" hostspecific="false" language="C#" #> | |
<#@ output extension="cpp" #> | |
/* Auto-generated code follows */ | |
#include <SDKDDKVer.h> | |
#include <stdio.h> | |
#define WIN32_LEAN_AND_MEAN | |
#define NOGDI | |
#include <windows.h> | |
<#@ assembly name="mscorlib" #> | |
<#@ import namespace="System.Collections.Generic" #> | |
<#@ assembly name="System.Core.dll" #> | |
<#@ import namespace="System.Linq" #> | |
<# | |
var defs = new Dictionary<string, int>() { | |
// opengl32.dll | |
{ "glDeleteTextures", 2 }, | |
{ "glGetIntegerv", 2 }, | |
{ "glGetError", 0 }, | |
{ "glTexImage1D", 8 }, | |
{ "glTexImage2D", 9 }, | |
{ "glPixelStorei", 2 }, | |
{ "glTexParameteri", 3 }, | |
{ "glBindTexture", 2 }, | |
{ "glGenTextures", 2 }, | |
{ "glGetTexLevelParameteriv", 4 }, | |
{ "glGetString", 1 }, | |
{ "wglCreateContext", 1 }, | |
{ "wglDeleteContext", 1 }, | |
{ "wglGetCurrentContext", 0 }, | |
{ "wglGetCurrentDC", 0 }, | |
{ "wglGetProcAddress", 1 }, | |
{ "wglMakeCurrent", 2 }, | |
// glu32.dll | |
{ "gluDeleteTess", 1 }, | |
{ "gluNewTess", 0 }, | |
{ "gluTessBeginContour", 1 }, | |
{ "gluTessBeginPolygon", 2 }, | |
{ "gluTessCallback", 3 }, | |
{ "gluTessEndContour", 1 }, | |
{ "gluTessEndPolygon", 1 }, | |
{ "gluTessVertex", 3 } | |
}; | |
foreach(var def in defs) { | |
var func = def.Key; | |
var paramCount = def.Value; | |
#> | |
void __stdcall <#= func #>(<#= paramCount > 0 ? string.Join(", ", Enumerable.Repeat("ULONG_PTR", paramCount)) : "void" #>) | |
{ | |
#pragma comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__) | |
printf("NOTIMPL: <#= func #>\n"); | |
} | |
<# | |
} | |
#> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment