[][src]Struct nannou::window::Builder

pub struct Builder<'app> { /* fields omitted */ }

For building an OpenGL window.

Window parameters can be specified via the window method.

OpenGL context parameters can be specified via the context method.

Methods

impl<'app> Builder<'app>[src]

pub fn new(app: &'app App) -> Self[src]

Begin building a new window.

pub fn window(self, window: WindowBuilder) -> Self[src]

Build the window with some custom window parameters.

pub fn vk_physical_device(self, device: PhysicalDevice<'app>) -> Self[src]

The physical device to associate with the window surface's swapchain.

pub fn vk_device_extensions(self, extensions: DeviceExtensions) -> Self[src]

Specify a set of required extensions.

The device associated with the window's swapchain must always have the khr_swapchain feature enabled, so it will be implicitly enabled whether or not it is specified in this given set of extensions.

pub fn vk_device_queue(self, queue: Arc<Queue>) -> Self[src]

Specify the vulkan device queue for this window.

This queue is used as the SharingMode for the swapchain, and is also used for constructing the Frame's intermediary image.

Once the window is built, this queue can be accessed via the window.swapchain_queue() method.

Note: If this builder method is called, previous calls to vk_physical_device and vk_device_extensions will be ignored as specifying the queue for the sharing mode implies which logical device is desired.

pub fn swapchain_builder(self, swapchain_builder: SwapchainBuilder) -> Self[src]

Specify a set of parameters for building the window surface swapchain.

pub fn msaa_samples(self, msaa_samples: u32) -> Self[src]

Specify the number of samples per pixel for the multisample anti-aliasing render pass.

If msaa_samples is unspecified, the first default value that nannou will attempt to use can be found via the Frame::DEFAULT_MSAA_SAMPLES constant. If however this value is not supported by the window's swapchain, nannou will fallback to the next smaller power of 2 that is supported. If MSAA is not supported at all, then the default will be 1.

Note: This parameter has no meaning if the window uses a raw_view function for rendering graphics to the window rather than a view function. This is because the raw_view function provides a RawFrame with direct access to the swapchain image itself and thus must manage their own MSAA pass.

On the other hand, the view function provides the Frame type which allows the user to render to a multisampled intermediary image allowing Nannou to take care of resolving the multisampled image to the swapchain image. In order to avoid confusion, The Window::build method will panic! if the user tries to specify msaa_samples as well as a raw_view method.

TODO: Perhaps it would be worth adding two separate methods for specifying msaa samples. One for forcing a certain number of samples and returning an error otherwise, and another for attempting to use the given number of samples but falling back to a supported value in the case that the specified number is not supported.

pub fn sketch(self, sketch_fn: SketchFn) -> Self[src]

Provide a simple function for drawing to the window.

This is similar to view but does not provide access to user data via a Model type. This is useful for sketches where you don't require tracking any state.

pub fn view<M>(self, view_fn: ViewFn<M>) -> Self where
    M: 'static, 
[src]

The view function that the app will call to allow you to present your Model to the surface of the window on your display.

pub fn raw_view<M>(self, raw_view_fn: RawViewFn<M>) -> Self where
    M: 'static, 
[src]

The view function that the app will call to allow you to present your Model to the surface of the window on your display.

Unlike the ViewFn, the RawViewFn provides a RawFrame that is designed for drawing directly to a window's swapchain images, rather than to a convenient intermediary image.

pub fn event<M>(self, event_fn: EventFn<M>) -> Self where
    M: 'static, 
[src]

A function for updating your model on WindowEvents associated with this window.

These include events such as key presses, mouse movement, clicks, resizing, etc.

Event Function Call Order

In nannou, if multiple functions require being called for a single kind of event, the more general event function will always be called before the more specific event function.

If an event function was also submitted to the App, that function will always be called immediately before window-specific event functions. Similarly, if a function associated with a more specific event type (e.g. key_pressed) was given, that function will be called after this function will be called.

Specific Events Variants

Note that if you only care about a certain kind of event, you can submit a function that only gets called for that specific event instead. For example, if you only care about key presses, you may wish to use the key_pressed method instead.

pub fn raw_event<M>(self, raw_event_fn: RawEventFn<M>) -> Self where
    M: 'static, 
[src]

The same as the event method, but allows for processing raw winit::WindowEvents rather than Nannou's simplified event::WindowEvents.

Event Function Call Order

If both raw_event and event functions have been provided, the given raw_event function will always be called immediately before the given event function.

pub fn key_pressed<M>(self, f: KeyPressedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing key press events associated with this window.

pub fn key_released<M>(self, f: KeyReleasedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing key release events associated with this window.

pub fn mouse_moved<M>(self, f: MouseMovedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing mouse moved events associated with this window.

pub fn mouse_pressed<M>(self, f: MousePressedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing mouse pressed events associated with this window.

pub fn mouse_released<M>(self, f: MouseReleasedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing mouse released events associated with this window.

pub fn mouse_wheel<M>(self, f: MouseWheelFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing mouse wheel events associated with this window.

pub fn mouse_entered<M>(self, f: MouseEnteredFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing mouse entered events associated with this window.

pub fn mouse_exited<M>(self, f: MouseExitedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing mouse exited events associated with this window.

pub fn touch<M>(self, f: TouchFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing touch events associated with this window.

pub fn touchpad_pressure<M>(self, f: TouchpadPressureFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing touchpad pressure events associated with this window.

pub fn moved<M>(self, f: MovedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing window moved events associated with this window.

pub fn resized<M>(self, f: ResizedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing window resized events associated with this window.

pub fn hovered_file<M>(self, f: HoveredFileFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing hovered file events associated with this window.

pub fn hovered_file_cancelled<M>(self, f: HoveredFileCancelledFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing hovered file cancelled events associated with this window.

pub fn dropped_file<M>(self, f: DroppedFileFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing dropped file events associated with this window.

pub fn focused<M>(self, f: FocusedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing the focused event associated with this window.

pub fn unfocused<M>(self, f: UnfocusedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing the unfocused event associated with this window.

pub fn closed<M>(self, f: ClosedFn<M>) -> Self where
    M: 'static, 
[src]

A function for processing the window closed event associated with this window.

pub fn build(self) -> Result<Id, BuildError>[src]

Builds the window, inserts it into the App's display map and returns the unique ID.

pub fn with_dimensions(self, width: u32, height: u32) -> Self[src]

Requests the window to be specific dimensions pixels.

pub fn with_min_dimensions(self, width: u32, height: u32) -> Self[src]

Set the minimum dimensions in pixels for the window.

pub fn with_max_dimensions(self, width: u32, height: u32) -> Self[src]

Set the maximum dimensions in pixels for the window.

pub fn with_title<T>(self, title: T) -> Self where
    T: Into<String>, 
[src]

Requests a specific title for the window.

pub fn with_fullscreen(self, monitor: Option<MonitorId>) -> Self[src]

Sets the window fullscreen state.

None means a normal window, Some(MonitorId) means a fullscreen window on that specific monitor.

pub fn with_maximized(self, maximized: bool) -> Self[src]

Requests maximized mode.

pub fn with_visibility(self, visible: bool) -> Self[src]

Sets whether the window will be initially hidden or visible.

pub fn with_transparency(self, transparent: bool) -> Self[src]

Sets whether the background of the window should be transparent.

pub fn with_decorations(self, decorations: bool) -> Self[src]

Sets whether the window should have a border, a title bar, etc.

pub fn with_multitouch(self) -> Self[src]

Enables multitouch.

Auto Trait Implementations

impl<'app> !Send for Builder<'app>

impl<'app> !Sync for Builder<'app>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Content for T[src]

impl<T> SafeBorrow<T> for T[src]

impl<T> Erased for T

impl<S> FromSample<S> for S[src]

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.