/// <summary> /// Create a new game window with game settings. /// </summary> /// <param name="title">The title of the <see cref="GameWindow"/>.</param> /// <param name="share">The window to share context resources with.</param> public GameWindow(string title, GameWindow share) : this() { // Set default window hints GLFW.GLFW.DefaultWindowHints(); GLFW.GLFW.WindowHint(GLFW.GLFW.Hint.Resizable, false); GLFW.GLFW.WindowHint(GLFW.GLFW.Hint.AutoIconify, true); GLFW.GLFW.WindowHint(GLFW.GLFW.Hint.Doublebuffer, true); GLFW.GLFW.WindowHint(GLFW.GLFW.Hint.Visible, false); if (GameSettings.MultisampleEnabled) { GLFW.GLFW.WindowHint(GLFW.GLFW.Hint.Samples, GameSettings.MultisampleLevel); } else { GLFW.GLFW.WindowHint(GLFW.GLFW.Hint.Samples, 0); } Handle = GLFW.GLFW.CreateWindow(GameSettings.GameWindowSize.Width, GameSettings.GameWindowSize.Height, title, (GameSettings.GameWindowFullscreenMode) ? Monitor.PrimaryMonitor.Handle : Monitor.None.Handle, (share != null) ? share.Handle : None.Handle); if (!Handle) { GLFW.GLFW.Shutdown(); Environment.Exit(-1); } // Enable V-Sync if (GameSettings.VSyncEnabled) { GLFW.GLFW.SwapInterval(GameSettings.VSyncInterval); } }
/// <summary> /// Create a new <see cref="GameWindow"/> by /// giving the <see cref="Handle"/>. /// </summary> /// <param name="handle">The GLFW window.</param> private GameWindow(Window handle) : this() { Handle = handle; }