예제 #1
0
        async void LaunchGame()
        {
            await Task.Yield();

            UrhoEngine.Init();
            new MyGame().Run();
        }
예제 #2
0
파일: Program.cs 프로젝트: elix22/urho
        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();
        }
예제 #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);
        }
예제 #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
 }
예제 #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
        }
예제 #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();
        }
예제 #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);
        }
예제 #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();
        }
예제 #9
0
파일: Program.cs 프로젝트: corefan/urho
 static void Main(string[] args)
 {
     UrhoEngine.Init();
     new MyGame().Run();
 }
예제 #10
0
 static void Main(string[] args)
 {
     UrhoEngine.Init(@"../../Assets");
     new SamplyGame().Run();
 }