Skip to content

Instantly share code, notes, and snippets.

@GamerDude27
Created August 6, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GamerDude27/ab41bfbd77200c203c781206eda2486f to your computer and use it in GitHub Desktop.
Save GamerDude27/ab41bfbd77200c203c781206eda2486f to your computer and use it in GitHub Desktop.
Shortcut to glfwCreateWindow()'s comment
/*! @brief Creates a window and its associated context.
*
* This function creates a window and its associated OpenGL or OpenGL ES
* context. Most of the options controlling how the window and its context
* should be created are specified with [window hints](@ref window_hints).
*
* Successful creation does not change which context is current. Before you
* can use the newly created context, you need to
* [make it current](@ref context_current). For information about the `share`
* parameter, see @ref context_sharing.
*
* The created window, framebuffer and context may differ from what you
* requested, as not all parameters and hints are
* [hard constraints](@ref window_hints_hard). This includes the size of the
* window, especially for full screen windows. To query the actual attributes
* of the created window, framebuffer and context, see @ref
* glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
*
* To create a full screen window, you need to specify the monitor the window
* will cover. If no monitor is specified, the window will be windowed mode.
* Unless you have a way for the user to choose a specific monitor, it is
* recommended that you pick the primary monitor. For more information on how
* to query connected monitors, see @ref monitor_monitors.
*
* For full screen windows, the specified size becomes the resolution of the
* window's _desired video mode_. As long as a full screen window is not
* iconified, the supported video mode most closely matching the desired video
* mode is set for the specified monitor. For more information about full
* screen windows, including the creation of so called _windowed full screen_
* or _borderless full screen_ windows, see @ref window_windowed_full_screen.
*
* Once you have created the window, you can switch it between windowed and
* full screen mode with @ref glfwSetWindowMonitor. If the window has an
* OpenGL or OpenGL ES context, it will be unaffected.
*
* By default, newly created windows use the placement recommended by the
* window system. To create the window at a specific position, make it
* initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
* hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
* it.
*
* As long as at least one full screen window is not iconified, the screensaver
* is prohibited from starting.
*
* Window systems put limits on window sizes. Very large or very small window
* dimensions may be overridden by the window system on creation. Check the
* actual [size](@ref window_size) after creation.
*
* The [swap interval](@ref buffer_swap) is not set during window creation and
* the initial value may vary depending on driver settings and defaults.
*
* @param[in] width The desired width, in screen coordinates, of the window.
* This must be greater than zero.
* @param[in] height The desired height, in screen coordinates, of the window.
* This must be greater than zero.
* @param[in] title The initial, UTF-8 encoded window title.
* @param[in] monitor The monitor to use for full screen mode, or `NULL` for
* windowed mode.
* @param[in] share The window whose context to share resources with, or `NULL`
* to not share resources.
* @return The handle of the created window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
* GLFW_PLATFORM_ERROR.
*
* @remark @win32 Window creation will fail if the Microsoft GDI software
* OpenGL implementation is the only one available.
*
* @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
* will be set as the initial icon for the window. If no such icon is present,
* the `IDI_WINLOGO` icon will be used instead. To set a different icon, see
* @ref glfwSetWindowIcon.
*
* @remark @win32 The context to share resources with must not be current on
* any other thread.
*
* @remark @osx The GLFW window has no icon, as it is not a document
* window, but the dock icon will be the same as the application bundle's icon.
* For more information on bundles, see the
* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
* in the Mac Developer Library.
*
* @remark @osx The first time a window is created the menu bar is populated
* with common commands like Hide, Quit and About. The About entry opens
* a minimal about dialog with information from the application's bundle. The
* menu bar can be disabled with a
* [compile-time option](@ref compile_options_osx).
*
* @remark @osx On OS X 10.10 and later the window frame will not be rendered
* at full resolution on Retina displays unless the `NSHighResolutionCapable`
* key is enabled in the application bundle's `Info.plist`. For more
* information, see
* [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
* in the Mac Developer Library. The GLFW test and example programs use
* a custom `Info.plist` template for this, which can be found as
* `CMake/MacOSXBundleInfo.plist.in` in the source tree.
*
* @remark @x11 Some window managers will not respect the placement of
* initially hidden windows.
*
* @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
* a window to reach its requested state. This means you may not be able to
* query the final size, position or other attributes directly after window
* creation.
*
* @reentrancy This function must not be called from a callback.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_creation
* @sa glfwDestroyWindow
*
* @since Added in version 3.0. Replaces `glfwOpenWindow`.
*
* @ingroup window
*/
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment