Beispiel #1
0
        public static void Main(string[] args)
        {
            // TODO: Get this from a launch parameter.
            const SageGame sageGame = SageGame.CncGenerals;

            // TODO: Support other locators.
            var locator      = new RegistryInstallationLocator();
            var installation = locator.FindInstallations(sageGame).First();
            var fileSystem   = installation.CreateFileSystem();

            HostPlatform.Start();

            var game = new Game(
                HostPlatform.GraphicsDevice,
                HostPlatform.GraphicsDevice2D,
                fileSystem,
                sageGame);

            SetupInitialScene(game);

            var hostView = new GameView
            {
                Game = game,
                Dock = DockStyle.Fill
            };

            // TODO: Use something other than WinForms for cross-platform compatibility.
            var window = new Form
            {
                Size = new Size(1024, 768),
                // TODO: Read game version from assembly metadata or .git folder
                Text = "OpenSAGE (master)",
                Icon = GetIcon()
            };

            window.Controls.Add(hostView);
            window.Show();

            // TODO: This only works on Windows and DX11. Implement this for other platforms.
            RenderLoop.Run(hostView, game.Tick);

            HostPlatform.Stop();
        }
Beispiel #2
0
 public DataViewerApplication(Platform platform)
     : base(platform)
 {
     HostPlatform.Start();
 }