mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Merge pull request #82 from tomaka/documentation
Some documentation improvements
This commit is contained in:
commit
f1d70d351e
44
src/lib.rs
44
src/lib.rs
|
@ -1,5 +1,4 @@
|
|||
//! The purpose of this library is to provide an OpenGL context on as many
|
||||
//! platforms as possible.
|
||||
//! Winit allows you to build a window on as many platforms as possible.
|
||||
//!
|
||||
//! # Building a window
|
||||
//!
|
||||
|
@ -8,20 +7,25 @@
|
|||
//! - Calling `Window::new()`.
|
||||
//! - Calling `let builder = WindowBuilder::new()` then `builder.build()`.
|
||||
//!
|
||||
//! The first way is the simpliest way and will give you default values.
|
||||
//! The first way is the simpliest way and will give you default values for everything.
|
||||
//!
|
||||
//! The second way allows you to customize the way your window and GL context
|
||||
//! will look and behave.
|
||||
//! The second way allows you to customize the way your window will look and behave by modifying
|
||||
//! the fields of the `WindowBuilder` object before you create the window.
|
||||
//!
|
||||
//! # Features
|
||||
//! # Events handling
|
||||
//!
|
||||
//! This crate has two Cargo features: `window` and `headless`.
|
||||
//! Once a window has been created, you can handle the events that it generates. There are two ways
|
||||
//! to do so: with `poll_events` or with `wait_events`. The former returns an iterator that ends
|
||||
//! when no event is available, and the latter returns an iterator that blocks and waits for events
|
||||
//! if none is available. Depending on which kind of program you're writing, you usually choose
|
||||
//! one or the other.
|
||||
//!
|
||||
//! - `window` allows you to create regular windows and enables the `WindowBuilder` object.
|
||||
//! - `headless` allows you to do headless rendering, and enables
|
||||
//! the `HeadlessRendererBuilder` object.
|
||||
//! # Drawing on the window
|
||||
//!
|
||||
//! Winit doesn't provide any function that allows drawing on a window. However it allows you to
|
||||
//! retreive the raw handle of the window (see the `os` module for that), which in turn allows you
|
||||
//! to create an OpenGL/Vulkan/DirectX/Metal/etc. context that will draw on the window.
|
||||
//!
|
||||
//! By default only `window` is enabled.
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
@ -72,27 +76,21 @@ mod window;
|
|||
|
||||
pub mod os;
|
||||
|
||||
/// Represents an OpenGL context and the Window or environment around it.
|
||||
/// Represents a window.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```ignore
|
||||
/// ```no_run
|
||||
/// use winit::Window;
|
||||
/// let window = Window::new().unwrap();
|
||||
///
|
||||
/// unsafe { window.make_current() };
|
||||
///
|
||||
/// loop {
|
||||
/// for event in window.poll_events() {
|
||||
/// match(event) {
|
||||
/// for event in window.wait_events() {
|
||||
/// match event {
|
||||
/// // process events here
|
||||
/// _ => ()
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// // draw everything here
|
||||
///
|
||||
/// window.swap_buffers();
|
||||
/// std::old_io::timer::sleep(17);
|
||||
/// }
|
||||
/// ```
|
||||
pub struct Window {
|
||||
|
@ -105,7 +103,7 @@ pub struct WindowBuilder {
|
|||
/// The attributes to use to create the window.
|
||||
pub window: WindowAttributes,
|
||||
|
||||
/// Platform-specific configuration.
|
||||
// Platform-specific configuration. Private.
|
||||
platform_specific: platform::PlatformSpecificWindowBuilderAttributes,
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
//! - `unix`
|
||||
//! - `windows`
|
||||
//!
|
||||
//! However only the module corresponding to the platform you're compiling to will be available.
|
||||
//!
|
||||
pub mod android;
|
||||
pub mod macos;
|
||||
pub mod unix;
|
||||
|
|
|
@ -297,6 +297,7 @@ impl Window {
|
|||
/// DEPRECATED. Gets the native platform specific display for this window.
|
||||
/// This is typically only required when integrating with
|
||||
/// other libraries that need this information.
|
||||
#[deprecated]
|
||||
#[inline]
|
||||
pub unsafe fn platform_display(&self) -> *mut libc::c_void {
|
||||
self.window.platform_display()
|
||||
|
@ -305,6 +306,7 @@ impl Window {
|
|||
/// DEPRECATED. Gets the native platform specific window handle. This is
|
||||
/// typically only required when integrating with other libraries
|
||||
/// that need this information.
|
||||
#[deprecated]
|
||||
#[inline]
|
||||
pub unsafe fn platform_window(&self) -> *mut libc::c_void {
|
||||
self.window.platform_window()
|
||||
|
|
Loading…
Reference in a new issue