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])
                );
        }
示例#2
0
            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));
            }
示例#3
0
            public static string[] CheckToArrayString(int index)
            {
                IntPtr out_result;

                Love2dDll.wrap_love_dll_luasupport_checkToArrayString(index, out out_result);
                return(DllTool.WSSToStringListAndRelease(out_result));
            }
示例#4
0
            // 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));
            }
示例#5
0
 public static void PushStringArray(string[] texts)
 {
     DllTool.ExecuteNullTailStringArray(texts, (pointers) =>
     {
         Love2dDll.wrap_love_dll_luasupport_pushStringArray(pointers, pointers.Length);
     });
 }
示例#6
0
        /// <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));
        }
示例#7
0
        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));
        }
示例#8
0
        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);
            });
        }
示例#10
0
 public static void Write(string filename, byte[] input)
 {
     Write(DllTool.ToUTF8Bytes(filename), input);
 }
示例#11
0
 public static void Remove(string arg)
 {
     Remove(DllTool.ToUTF8Bytes(arg));
 }
示例#12
0
 public static bool IsSymlink(string filename)
 {
     return(IsSymlink(DllTool.ToUTF8Bytes(filename)));
 }
示例#13
0
 public static bool IsDirectory(string arg)
 {
     return(IsDirectory(DllTool.ToUTF8Bytes(arg)));
 }
示例#14
0
 public static String GetRealDirectory(string filename)
 {
     return(GetRealDirectory(DllTool.ToUTF8Bytes(filename)));
 }
示例#15
0
 public static bool Mount(string archive, string mountpoint, bool appendToPath)
 {
     return(Mount(DllTool.ToUTF8Bytes(archive), DllTool.ToUTF8Bytes(mountpoint), appendToPath));
 }
示例#16
0
 public static void SetIdentity(string arg, bool append = false)
 {
     SetIdentity(DllTool.ToUTF8Bytes(arg), append);
 }
示例#17
0
 public static void SetSource(string arg)
 {
     SetSource(DllTool.ToUTF8Bytes(arg));
 }
示例#18
0
 public static bool Init(string args)
 {
     return(Init(DllTool.ToUTF8Bytes(args)));
 }
示例#19
0
 public static bool Unmount(string archive)
 {
     return(Unmount(DllTool.ToUTF8Bytes(archive)));
 }
示例#20
0
 public void SendMatrix(string name, Matrix44 valuearray)
 {
     SendMatrix(DllTool.ToUTF8Bytes(name), valuearray);
 }
示例#21
0
 public static bool Exists(string arg)
 {
     return(Exists(DllTool.ToUTF8Bytes(arg)));
 }
示例#22
0
 public void SendTexture(string name, Texture texture)
 {
     SendTexture(DllTool.ToUTF8Bytes(name), texture);
 }
示例#23
0
 public static bool IsFile(string arg)
 {
     return(IsFile(DllTool.ToUTF8Bytes(arg)));
 }
示例#24
0
 public Tuple <UniformType, int, int> getExternVariable(string name)
 {
     return(getExternVariable(DllTool.ToUTF8Bytes(name)));
 }
示例#25
0
 public static void CreateDirectory(string arg)
 {
     CreateDirectory(DllTool.ToUTF8Bytes(arg));
 }
示例#26
0
 public void attachAttribute(string name, Mesh mesh)
 {
     AttachAttribute(DllTool.ToUTF8Bytes(name), mesh);
 }
示例#27
0
 public static byte[] read(string filename, long len = -1)
 {
     return(read(DllTool.ToUTF8Bytes(filename), len));
 }
示例#28
0
 public void SetState(string state)
 {
     SetState(DllTool.ToUTF8Bytes(state));
 }
示例#29
0
 public static void Append(string filename, byte[] input)
 {
     Append(DllTool.ToUTF8Bytes(filename), input);
 }
示例#30
0
 public void encode(EncodedFormat format_type, string filename)
 {
     Encode(format_type, DllTool.ToUTF8Bytes(filename));
 }