예제 #1
0
 private void RunWindow()
 {
     try
     {
         using (var window = new DesktopWindow(_options.Width, _options.Height))
         {
             window.PaintSurface += WindowOnPaintSurface;
             window.Run(_options.UpdatesPerSeconds, _options.FramesPerSeconds);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
예제 #2
0
        public void Run()
        {
            var platform = new DesktopPlatform();

            WindowCreateInfo wci = new WindowCreateInfo
            {
                X = 100,
                Y = 100,
                WindowWidth = 1280,
                WindowHeight = 720,
                WindowTitle = "Tortuga Demo"
            };

            GraphicsDeviceOptions options = new GraphicsDeviceOptions(
                debug: false,
                swapchainDepthFormat: PixelFormat.R16_UNorm,
                syncToVerticalBlank: true,
                resourceBindingModel: ResourceBindingModel.Improved,
                preferDepthRangeZeroToOne: true,
                preferStandardClipSpaceYDirection: true);
            #if DEBUG
            options.Debug = true;
            #endif

            _window = platform.CreateWindow(wci, options, GraphicsBackend.Vulkan) as DesktopWindow;
            _window.GraphicsDeviceCreated += LoadResources;
            _window.Tick += Update;
            _window.Resized += _window_Resized;

            _viewport = new ViewportManager(1280, 720);

            _cameraSpaceInputTracker = new TransformedInputTracker(_window.InputTracker);
            _cameraSpaceGameInputTracker = new ActiveInputTracker(_cameraSpaceInputTracker);

            _client.Start();
            _client.Connect(new IPEndPoint(IPAddress.Loopback, 5674));

            _window.Run();
        }