Пример #1
0
 private RenderWindow CreateWindow(ApplicationSettings settings)
 {
     var windowStyle = settings.Fullscreen ? Styles.Fullscreen : Styles.Close;
     var window = new RenderWindow(settings.VideoMode, settings.WindowCaption, windowStyle);
     window.SetMouseCursorVisible(settings.MouseCursorVisible);
     window.SetVerticalSyncEnabled(settings.VerticalSyncEnabled);
     if (settings.FramerateLimit > 0)
         window.SetFramerateLimit(settings.FramerateLimit);
     return window;
 }
Пример #2
0
        public Application(ApplicationSettings settings, IApplicationState startState)
        {
            Settings = settings;

            Window = CreateWindow(settings);
            Window.Closed += (sender, args) => Window.Close();

            appStates = new Stack<IApplicationState>();
            appStates.Push(startState);
            startState.App = this;
            startState.OnEnable();
        }
Пример #3
0
        static void Main()
        {
            var settings = new ApplicationSettings()
            {
                WindowCaption = String.Format("{0} {1}", NAME, VERSION),
                FramerateLimit = 200,
                VideoMode = new VideoMode(1024, 600),
                Fullscreen = false,
                VerticalSyncEnabled = true,
                MouseCursorVisible = true,
                EnableLights = true,
            };

            var app = new Application(settings, new Init());
            app.Run();
        }