Exemple #1
0
        public void Init(string title, Settings settings)
        {
            // Initialize window and other SDL fields
            SDL.SDL_Init(SDL.SDL_INIT_VIDEO);
            _window = SDL.SDL_CreateWindow(title, SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED,
                                           settings.ResolutionX, settings.ResolutionY, GetWindowFlags(settings.WindowMode));
            SDL.SDL_SetHint("SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "0");
            _performanceFrequency = SDL.SDL_GetPerformanceFrequency();

            // Initialize graphics context
            _context.CreateContext(_window);

            // Apply settings from ISettingsManager
            _context.Vsync = settings.Vsync;
            MaxFps         = settings.MaxFps;
            MouseGrab      = settings.MouseGrab;
            SetResolution(settings.ResolutionX, settings.ResolutionY);
        }