Program.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.IO;
  3. using System.Runtime.InteropServices;
  4. using Urho;
  5. using Urho.Gui;
  6. namespace Playgrounds.NetCoreApp
  7. {
  8. class Program
  9. {
  10. [DllImport("kernel32.dll")]
  11. static extern IntPtr LoadLibrary(string dllToLoad);
  12. static void Main(string[] args)
  13. {
  14. throw new NotImplementedException("Not fully implemented yet, requires changes in Urho3D (FileSystem)");
  15. Console.WriteLine("Dir: " + Environment.CurrentDirectory);
  16. // the current directory is not "bin" ?? https://github.com/dotnet/project-system/issues/589
  17. // workaround:
  18. var coreDataPak = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "CoreData.pak");
  19. }
  20. }
  21. public class HelloWorld : Application
  22. {
  23. public HelloWorld(ApplicationOptions options = null) : base(options) { }
  24. protected override void Start()
  25. {
  26. var cache = ResourceCache;
  27. var helloText = new Text()
  28. {
  29. Value = "Hello World from UrhoSharp for .NET Core",
  30. HorizontalAlignment = HorizontalAlignment.Center,
  31. VerticalAlignment = VerticalAlignment.Center
  32. };
  33. helloText.SetColor(new Color(0f, 1f, 0f));
  34. helloText.SetFont(font: CoreAssets.Fonts.AnonymousPro, size: 30);
  35. UI.Root.AddChild(helloText);
  36. // Subscribe to Esc key:
  37. Input.SubscribeToKeyDown(args => { if (args.Key == Key.Esc) Exit(); });
  38. }
  39. }
  40. }