Пример #1
0
 /// <summary>
 /// Adds this window platform to the platform list. Shouldn't be used unless writing your own windowing backend.
 /// </summary>
 /// <param name="platform">The platform to add.</param>
 public static void Add(IWindowPlatform platform)
 {
     if (!_platformsKeys.Contains(platform.GetType()))
     {
         _platformsKeys.Add(platform.GetType());
         _platformsValues.Add(platform);
     }
 }
Пример #2
0
        /// <summary>
        /// Removes this window platform from the platform list. Shouldn't be used unless writing your own windowing backend.
        /// </summary>
        /// <param name="platform">The platform to remove.</param>
        public static void Remove(IWindowPlatform platform)
        {
            var index = _platformsKeys.IndexOf(platform.GetType());

            if (index != -1)
            {
                _platformsKeys.RemoveAt(index);
                _platformsValues.RemoveAt(index);
            }
        }
Пример #3
0
        // Registrar functions

        /// <summary>
        /// Adds/moves this window platform to the top of the platform list, to ensure that <see cref="Window"/>
        /// functions check/use the provided platform first.
        /// </summary>
        public static void Prioritize(IWindowPlatform platform)
        {
            Remove(platform);
            _platformsKeys.Insert(0, platform.GetType());
            _platformsValues.Insert(0, platform);
        }
Пример #4
0
 /// <summary>
 /// Creates a window and adds it to this manager.
 /// </summary>
 /// <param name="opts">The options to initialize the new window with.</param>
 /// <param name="platform">
 /// The windowing platform to use. If null, the current windowing platform will be
 /// fetched using the <see cref="SilkManager"/>.
 /// </param>
 public void CreateWindow(WindowOptions opts, IWindowPlatform platform = null)
 => AddWindow((platform ?? SilkManager.Get <IWindowPlatform>()).GetWindow(opts));