Esempio n. 1
0
        async void LaunchGame()
        {
            await Task.Yield();

            UrhoEngine.Init();
            new MyGame().Run();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //   UrhoEngine.Init(pathToAssets);
            //   new Water(new Context()).Run();
            //   return;

            FindAvailableSamplesAndPrint();
            Type selectedSampleType = null;

            if (args.Length > 0)
            {
                selectedSampleType = ParseSampleFromNumber(args[0]);
            }

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                while (selectedSampleType == null)
                {
                    WriteLine("Enter a sample number:", ConsoleColor.White);
                    selectedSampleType = ParseSampleFromNumber(Console.ReadLine());
                }
            }
            else
            {
                selectedSampleType = typeof(Water);
            }

            UrhoEngine.Init(pathToAssets: @"../../Assets");
            var game     = (Application)Activator.CreateInstance(selectedSampleType);
            var exitCode = game.Run();

            WriteLine($"Exit code: {exitCode}. Press any key to exit...", ConsoleColor.DarkYellow);
            Console.ReadKey();
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);

            UrhoEngine.Init();
            var surface = UrhoSurface.CreateSurface <SamplyGame>(this);

            mLayout.AddView(surface);
            SetContentView(mLayout);
        }
Esempio n. 4
0
 public MainWindow()
 {
     InitializeComponent();
     UrhoEngine.Init(pathToAssets: @"../../Assets");
     GameTypes = typeof(Sample).Assembly.GetTypes()
                 .Where(t => t.IsSubclassOf(typeof(Application)) && t != typeof(Sample))
                 .Select((t, i) => new TypeInfo(t, $"{i + 1}. {t.Name}", ""))
                 .ToArray();
     DataContext = this;
     Loaded     += (s, e) => SelectedGameType = GameTypes[19];        //water
 }
Esempio n. 5
0
        public SamplesForm()
        {
            InitializeComponent();
            UrhoEngine.Init(pathToAssets: @"../../Assets");
            var sampleTypes = typeof(Sample).Assembly.GetTypes()
                              .Where(t => t.IsSubclassOf(typeof(Application)) && t != typeof(Sample))
                              .ToArray();

            samplesListbox.DisplayMember = "Name";
            samplesListbox.Items.AddRange(sampleTypes);
            samplesListbox.SelectedIndex = 19;             //Water by default
        }
Esempio n. 6
0
        /// <param name="args">sample number, e.g. "19"</param>
        static void Main(string[] args)
        {
            //   UrhoEngine.Init(pathToAssets);
            //   new Water().Run();
            //   return;

            samples = typeof(Sample).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Application)) && t != typeof(Sample)).ToArray();
            Type selectedSampleType = args.Length > 0 ? ParseSampleFromNumber(args[0]) : typeof(Water);

            UrhoEngine.Init(pathToAssets: @"../../Assets");
            var game     = (Application)Activator.CreateInstance(selectedSampleType, new ApplicationOptions("Data"));
            var exitCode = game.Run();

            Console.WriteLine($"Exit code: {exitCode}. Press any key to exit...");
            Console.ReadKey();
        }
Esempio n. 7
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var window = new UIWindow(UIScreen.MainScreen.Bounds);

            window.RootViewController = new DialogViewController(new RootElement("UrhoSharp")
            {
                new Section("Feature Samples")
                {
                    from type in typeof(HelloWorld).Assembly.GetTypes()
                    where type.IsSubclassOf(typeof(Sample))
                    select new StringElement(type.Name, () => Run(type))
                }
            });
            window.MakeKeyAndVisible();
            UrhoEngine.Init();
            return(true);
        }
Esempio n. 8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            //Show a list of available samples (click to run):
            ArrayAdapter <string> adapter = new ArrayAdapter <string>(this, Resource.Layout.samples_list_text_view);

            sampleTypes = typeof(Sample).Assembly.GetTypes().Where(t => t.BaseType == typeof(Sample)).ToArray();
            foreach (var sample in sampleTypes)
            {
                adapter.Add(sample.Name);
            }
            SetContentView(Resource.Layout.samples_list);
            ListAdapter = adapter;
            UrhoEngine.Init();
        }
Esempio n. 9
0
 static void Main(string[] args)
 {
     UrhoEngine.Init();
     new MyGame().Run();
 }
Esempio n. 10
0
 static void Main(string[] args)
 {
     UrhoEngine.Init(@"../../Assets");
     new SamplyGame().Run();
 }