static Love2dGraphicsShaderBoot() { InitGLSLStrings(); var langs = new string[2] { "glsl", "glsles" }; var gammacorrects = new bool[2] { false, true }; string[] codeStr = new string[2 * 2 * 3]; int index = 0; foreach (var lang in langs) { foreach (var gammacorrect in gammacorrects) { codeStr[index++] = createShaderStageCode(Stage.Vertex, defaultcode_vertex, lang, gammacorrect, false); codeStr[index++] = createShaderStageCode(Stage.Pixel, defaultcode_pixel, lang, gammacorrect, false); codeStr[index++] = createShaderStageCode(Stage.Pixel, defaultcode_videopixel, lang, gammacorrect, false); } } Love.Love2dDll.wrap_love_dll_graphics_setDefaultShaderCode( DllTool.ToUTF8Bytes(codeStr[00]), DllTool.ToUTF8Bytes(codeStr[01]), DllTool.ToUTF8Bytes(codeStr[02]), DllTool.ToUTF8Bytes(codeStr[03]), DllTool.ToUTF8Bytes(codeStr[04]), DllTool.ToUTF8Bytes(codeStr[05]), DllTool.ToUTF8Bytes(codeStr[06]), DllTool.ToUTF8Bytes(codeStr[07]), DllTool.ToUTF8Bytes(codeStr[08]), DllTool.ToUTF8Bytes(codeStr[09]), DllTool.ToUTF8Bytes(codeStr[10]), DllTool.ToUTF8Bytes(codeStr[11]) ); }
public static float[] CheckToArrayNumber(int index) { IntPtr out_result; Love2dDll.wrap_love_dll_luasupport_checkToArrayNumber(index, out out_result, out var len); return(DllTool.ReadFloatsAndRelease(out_result, len)); }
public static string[] CheckToArrayString(int index) { IntPtr out_result; Love2dDll.wrap_love_dll_luasupport_checkToArrayString(index, out out_result); return(DllTool.WSSToStringListAndRelease(out_result)); }
// TODO: finishe function wrap_love_dll_luasupport_checkToArray // TODO: finishe function wrap_love_dll_luasupport_checkTo // TODO: finishe function wrap_love_dll_luasupport_checkToArrayNumber public static bool[] CheckToArrayBoolean(int index) { IntPtr out_result; Love2dDll.wrap_love_dll_luasupport_checkToArrayBoolean(index, out out_result, out var len); return(DllTool.ReadBooleansAndRelease(out_result, len)); }
public static void PushStringArray(string[] texts) { DllTool.ExecuteNullTailStringArray(texts, (pointers) => { Love2dDll.wrap_love_dll_luasupport_pushStringArray(pointers, pointers.Length); }); }
/// <summary> /// Creates a new Font by loading a specifically formatted image. /// <para>In versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string.</para> /// <para> This function can be slow if it is called repeatedly, such as from Scene.Update. If you need to use a specific resource often, create it once and store it somewhere it can be reused!</para> /// </summary> /// <param name="filename">The filepath to the image file.</param> /// <param name="glyphs">A string of the characters in the image in order from left to right.</param> /// <param name="extraspacing">Additional spacing (positive or negative) to apply to each glyph in the Font.</param> /// <returns></returns> public static Font NewImageFont(string filename, string glyphs, int extraspacing = 0) { var imageData = Resource.NewImageData(filename); var glyphsBytes = DllTool.GetNullTailUTF8Bytes(glyphs); var rasterizerImage = Font.NewImageRasterizer(imageData, glyphsBytes, extraspacing); return(Graphics.NewFont(rasterizerImage)); }
public static Shader NewShader(string vertexCodeStr, string pixelCodeStr) { IntPtr out_shader = IntPtr.Zero; string vertexCode, pixelCode; Love2dGraphicsShaderBoot.shaderCodeToGLSL(vertexCodeStr, pixelCodeStr, out vertexCode, out pixelCode); Love2dDll.wrap_love_dll_graphics_newShader(DllTool.ToUTF8Bytes(vertexCode), DllTool.ToUTF8Bytes(pixelCode), out out_shader); return(LoveObject.NewObject <Shader>(out_shader)); }
static int FunctionBack(IntPtr functionNameStr) { //RawOperate.DebugStackDump(); var name = DllTool.WSToStringAndRelease(functionNameStr); if (funcDict.TryGetValue(name, out var callbackCSharpTargetInfo)) { return(callbackCSharpTargetInfo.Call()); } throw new Exception(" love.sharp." + name + " is not exists !"); }
static void InitGraphicsShader() { InitGLSLStrings(); var langs_index = new string[] { "glsl1", "essl1", "glsl3", "essl3", }; var langs_dictionnary = new Dictionary <string, Tuple <string, bool> >(); langs_dictionnary.Add("glsl1", Tuple.Create("glsl1", false)); langs_dictionnary.Add("essl1", Tuple.Create("glsl1", true)); langs_dictionnary.Add("glsl3", Tuple.Create("glsl3", false)); langs_dictionnary.Add("essl3", Tuple.Create("glsl3", true)); var gammacorrects = new bool[] { false, true }; string[] codeStr = new string[2 * 4 * 4]; int index = 0; foreach (var gammacorrect in gammacorrects) { foreach (var langIndex in langs_index) { var lang = langs_dictionnary[langIndex]; string target = lang.Item1; bool gles = lang.Item2; // vertex codeStr[index++] = createShaderStageCode("VERTEX", defaultcode_vertex, target, gles, false, gammacorrect, false); // pixel codeStr[index++] = createShaderStageCode("PIXEL", defaultcode_pixel, target, gles, false, gammacorrect, false); // videopixel codeStr[index++] = createShaderStageCode("PIXEL", defaultcode_videopixel, target, gles, false, gammacorrect, true); // arraypixel codeStr[index++] = createShaderStageCode("PIXEL", defaultcode_arraypixel, target, gles, false, gammacorrect, true); } } DllTool.ExecuteNullTailStringArray(codeStr, (tmp) => { Love2dDll.wrap_love_dll_graphics_setDefaultShaderCode(tmp); }); }
public static void Write(string filename, byte[] input) { Write(DllTool.ToUTF8Bytes(filename), input); }
public static void Remove(string arg) { Remove(DllTool.ToUTF8Bytes(arg)); }
public static bool IsSymlink(string filename) { return(IsSymlink(DllTool.ToUTF8Bytes(filename))); }
public static bool IsDirectory(string arg) { return(IsDirectory(DllTool.ToUTF8Bytes(arg))); }
public static String GetRealDirectory(string filename) { return(GetRealDirectory(DllTool.ToUTF8Bytes(filename))); }
public static bool Mount(string archive, string mountpoint, bool appendToPath) { return(Mount(DllTool.ToUTF8Bytes(archive), DllTool.ToUTF8Bytes(mountpoint), appendToPath)); }
public static void SetIdentity(string arg, bool append = false) { SetIdentity(DllTool.ToUTF8Bytes(arg), append); }
public static void SetSource(string arg) { SetSource(DllTool.ToUTF8Bytes(arg)); }
public static bool Init(string args) { return(Init(DllTool.ToUTF8Bytes(args))); }
public static bool Unmount(string archive) { return(Unmount(DllTool.ToUTF8Bytes(archive))); }
public void SendMatrix(string name, Matrix44 valuearray) { SendMatrix(DllTool.ToUTF8Bytes(name), valuearray); }
public static bool Exists(string arg) { return(Exists(DllTool.ToUTF8Bytes(arg))); }
public void SendTexture(string name, Texture texture) { SendTexture(DllTool.ToUTF8Bytes(name), texture); }
public static bool IsFile(string arg) { return(IsFile(DllTool.ToUTF8Bytes(arg))); }
public Tuple <UniformType, int, int> getExternVariable(string name) { return(getExternVariable(DllTool.ToUTF8Bytes(name))); }
public static void CreateDirectory(string arg) { CreateDirectory(DllTool.ToUTF8Bytes(arg)); }
public void attachAttribute(string name, Mesh mesh) { AttachAttribute(DllTool.ToUTF8Bytes(name), mesh); }
public static byte[] read(string filename, long len = -1) { return(read(DllTool.ToUTF8Bytes(filename), len)); }
public void SetState(string state) { SetState(DllTool.ToUTF8Bytes(state)); }
public static void Append(string filename, byte[] input) { Append(DllTool.ToUTF8Bytes(filename), input); }
public void encode(EncodedFormat format_type, string filename) { Encode(format_type, DllTool.ToUTF8Bytes(filename)); }