Esempio n. 1
0
		public override async void ViewDidLoad()
		{
			base.ViewDidLoad();
			sampleTypes = typeof(Sample).Assembly.GetTypes()
				.Where(t => t.IsSubclassOf(typeof(Application)) && t != typeof(Sample))
				.ToArray();

			ButtonNext.Activated += (s, e) => 
				{
					if (++currentSampleIndex >= sampleTypes.Length)
						currentSampleIndex = 0;
					RunSample(sampleTypes[currentSampleIndex]);
				};

			ButtonPrev.Activated += (s, e) =>
				{
					if (--currentSampleIndex < 0)
						currentSampleIndex = sampleTypes.Length - 1;
					RunSample(sampleTypes[currentSampleIndex]);
				};

			var view = new UrhoSurface();
			view.Frame = UrhoSurface.Frame;
			view.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable;
			UrhoSurface.AddSubview(view);

			string assets = "../../../../../Assets";
			Urho.Desktop.DesktopUrhoInitializer.CopyEmbeddedCoreDataTo(assets);
			options = new ApplicationOptions("Data")
				{
					ExternalWindow = view.Handle,
					LimitFps = true,
					ResourcePrefixPaths = new string[] { assets },
				};
		}