Esempio n. 1
0
        /// <summary>
        /// Checks whether a certain <see cref="Scancode"/> is down. Not to be confused with <see cref="Scene.KeyPressed(KeyConstant, Scancode, bool)"/> or <see cref="Scene.KeyReleased(KeyConstant, Scancode)"/>.
        /// <para>Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode "w" is used if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.</para>
        /// </summary>
        /// <param name="scancode"></param>
        /// <returns></returns>
        public static bool IsScancodeDown(Scancode scancode)
        {
            bool out_result = false;

            Love2dDll.wrap_love_dll_keyboard_isScancodeDown((int)scancode, out out_result);
            return(out_result);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the hardware scancode corresponding to the given key.
        /// <para>Unlike <see cref="KeyConstant"/>, <see cref="Scancode"/> are keyboard layout-independent. For example the scancode "w" will be generated if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.</para>
        /// <para><see cref="Scancode"/> are useful for creating default controls that have the same physical locations on on all systems.</para>
        /// </summary>
        /// <param name="key">The key to get the scancode from.</param>
        /// <returns>The scancode corresponding to the given key, or "unknown" if the given key has no known physical representation on the current system.</returns>
        public static Scancode GetScancodeFromKey(KeyConstant key)
        {
            int out_scancode_type = 0;

            Love2dDll.wrap_love_dll_keyboard_getScancodeFromKey((int)key, out out_scancode_type);
            return((Scancode)out_scancode_type);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets whether key repeat is enabled.
        /// </summary>
        /// <returns></returns>
        public static bool HasKeyRepeat()
        {
            bool out_result = false;

            Love2dDll.wrap_love_dll_keyboard_hasKeyRepeat(out out_result);
            return(out_result);
        }
Esempio n. 4
0
        /// <summary>
        /// Checks whether a certain <see cref="KeyConstant"/> is down. Not to be confused with <see cref="Scene.KeyPressed(KeyConstant, Scancode, bool)"/> or <see cref="Scene.KeyReleased(KeyConstant, Scancode)"/>.
        /// </summary>
        /// <param name="key">The key to check.</param>
        /// <returns>True if the key is down, false if not.</returns>
        public static bool IsDown(KeyConstant key)
        {
            bool out_result = false;

            Love2dDll.wrap_love_dll_keyboard_isDown((int)key, out out_result);
            return(out_result);
        }
Esempio n. 5
0
        public static bool HasScreenKeyboard()
        {
            bool out_result = false;

            Love2dDll.wrap_love_dll_keyboard_hasScreenKeyboard(out out_result);
            return(out_result);
        }
Esempio n. 6
0
        /// <summary>
        /// Creates a new FileData object.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <returns></returns>
        public static FileData NewFileData(File file)
        {
            IntPtr out_file;

            Love2dDll.wrap_love_dll_filesystem_newFileData_file(file.p, out out_file);
            return(LoveObject.NewObject <FileData>(out_file));
        }
Esempio n. 7
0
        /// <summary>
        /// Creates a new FileData object.
        /// </summary>
        /// <param name="contents">The contents of the file.</param>
        /// <param name="filename">The name of the file.</param>
        /// <returns></returns>
        public static FileData NewFileData(byte[] contents, string filename)
        {
            IntPtr out_file;

            Love2dDll.wrap_love_dll_filesystem_newFileData_content(contents, contents.Length, DllTool.GetNullTailUTF8Bytes(filename), out out_file);
            return(LoveObject.NewObject <FileData>(out_file));
        }
Esempio n. 8
0
        /// <summary>
        /// <para>Gets the key corresponding to the given hardware scancode.</para>
        /// <para>Unlike <see cref="KeyConstant"/>, <see cref="Scancode"/> are keyboard layout-independent. For example the scancode "w" will be generated if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.</para>
        /// <para><see cref="Scancode"/> are useful for creating default controls that have the same physical locations on on all systems.</para>
        /// </summary>
        /// <param name="scancode">The scancode to get the key from.</param>
        /// <returns>The key corresponding to the given <see cref="Scancode"/> , or "unknown" if the <see cref="Scancode"/> doesn't map to a KeyConstant on the current system.</returns>
        public static KeyConstant GetKeyFromScancode(Scancode scancode)
        {
            int out_key_type = 0;

            Love2dDll.wrap_love_dll_keyboard_getKeyFromScancode((int)scancode, out out_key_type);
            return((KeyConstant)out_key_type);
        }
Esempio n. 9
0
            public static bool CheckToBoolean(int index)
            {
                bool out_result;

                Love2dDll.wrap_love_dll_luasupport_checkToBoolean(index, out out_result);
                return(out_result);
            }
Esempio n. 10
0
    // TODO: finishe function wrap_love_dll_type_Mesh_getVertexFormat
    public bool IsAttributeEnabled(byte[] name)
    {
        bool out_res;

        Love2dDll.wrap_love_dll_type_Mesh_isAttributeEnabled(p, name, out out_res);
        return(out_res);
    }
Esempio n. 11
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));
            }
Esempio n. 12
0
 public static void PushStringArray(string[] texts)
 {
     DllTool.ExecuteNullTailStringArray(texts, (pointers) =>
     {
         Love2dDll.wrap_love_dll_luasupport_pushStringArray(pointers, pointers.Length);
     });
 }
Esempio n. 13
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));
            }
Esempio n. 14
0
            public static bool IsTable(int index)
            {
                bool out_result;

                Love2dDll.wrap_love_dll_luasupport_isTable(index, out out_result);
                return(out_result);
            }
Esempio n. 15
0
            public static int CheckToInteger(int index)
            {
                int out_result;

                Love2dDll.wrap_love_dll_luasupport_checkToInteger(index, out out_result);
                return(out_result);
            }
Esempio n. 16
0
            public static float CheckToNumber(int index)
            {
                float out_result;

                Love2dDll.wrap_love_dll_luasupport_checkToNumber(index, out out_result);
                return(out_result);
            }
Esempio n. 17
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));
            }
Esempio n. 18
0
            public static int GetTop()
            {
                int out_result;

                Love2dDll.wrap_love_dll_luasupport_getTop(out out_result);
                return(out_result);
            }
Esempio n. 19
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));
        }
Esempio n. 20
0
 /// <summary>
 /// initiate lua module
 /// </summary>
 /// <param name="luaState">Assigning to internal Lua state, will be injected love function. if it is IntPtr.Zero, lua state will create automatic</param>
 public static void InitInternal(IntPtr luaState)
 {
     if (IsInit)
     {
         return;
     }
     // not Do not pass FunctionBack in directly ! the delegate variable from Automatically generate temporary variables!
     Love2dDll.wrap_love_dll_luasupport_init(luaState, static_WCSCFD);
     IsInit = true;
 }
        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);
            });
        }
Esempio n. 22
0
 public static void PushString(string str)
 {
     Love2dDll.wrap_love_dll_luasupport_pushString(DllTool.GetNullTailUTF8Bytes(str));
 }
Esempio n. 23
0
 public static void SetTop(int idx)
 {
     Love2dDll.wrap_love_dll_luasupport_setTop(idx);
 }
Esempio n. 24
0
 public static void PushNumber(float num)
 {
     Love2dDll.wrap_love_dll_luasupport_pushNumber(num);
 }
Esempio n. 25
0
 public static void PushInteger(int num)
 {
     Love2dDll.wrap_love_dll_luasupport_pushInteger(num);
 }
Esempio n. 26
0
 public static void PushBooleanArray(bool[] num)
 {
     Love2dDll.wrap_love_dll_luasupport_pushBooleanArray(num, num.Length);
 }
Esempio n. 27
0
 public static void PushNumberArray(float[] num)
 {
     Love2dDll.wrap_love_dll_luasupport_pushNumberArray(num, num.Length);
 }
Esempio n. 28
0
 public static void PushIntegerArray(int[] num)
 {
     Love2dDll.wrap_love_dll_luasupport_pushIntegerArray(num, num.Length);
 }
Esempio n. 29
0
 public static void PushString(byte[] str)
 {
     Love2dDll.wrap_love_dll_luasupport_pushString(str);
 }
Esempio n. 30
0
 public static void PushBoolean(bool v)
 {
     Love2dDll.wrap_love_dll_luasupport_pushBoolean(v);
 }