Example #1
0
        public static string GetUserInput(EWindowTitle windowTitle, string defaultText, int maxLength)
        {
            NativeFunction.Natives.DISPLAY_ONSCREEN_KEYBOARD(true, windowTitle.ToString(), "", defaultText, "", "", "", maxLength + 1);

            while (NativeFunction.Natives.UPDATE_ONSCREEN_KEYBOARD <int>() == 0)
            {
                GameFiber.Yield();
            }

            return((string)NativeFunction.Natives.GET_ONSCREEN_KEYBOARD_RESULT <string>());
        }
        //public static Texture GetTextureFromEmbeddedResource(string resourceName)
        //{
        //    System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
        //    System.IO.Stream stream = assembly.GetManifestResourceStream(resourceName);
        //    string tempPath = System.IO.Path.GetTempFileName();
        //    using (System.IO.FileStream fs = new System.IO.FileStream(tempPath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write))
        //    {
        //        fs.SetLength(0);
        //        byte[] buffer = new byte[stream.Length];
        //        stream.Read(buffer, 0, buffer.Length);
        //        fs.Write(buffer, 0, buffer.Length);
        //    }

        //    return Game.CreateTextureFromFile(tempPath);
        //}


#if DEBUG
        public static string GetUserInput(EWindowTitle windowTitle, string defaultText, int maxLength)
        {
            NativeFunction.CallByName <uint>("DISPLAY_ONSCREEN_KEYBOARD", true, windowTitle.ToString(), "", defaultText, "", "", "", maxLength + 1);

            while (NativeFunction.CallByName <int>("UPDATE_ONSCREEN_KEYBOARD") == 0)
            {
                GameFiber.Yield();
            }

            return((string)NativeFunction.CallByName("GET_ONSCREEN_KEYBOARD_RESULT", typeof(string)));
        }