[][src]Struct beryllium::SDLToken

pub struct SDLToken { /* fields omitted */ }

The SDLToken is proof that you have initialized SDL2.

Most of SDL2 requires you to have performed initialization, and so most of its abilities are either methods off of this struct or off of things that you make from methods of this struct.

Methods

impl SDLToken[src]

pub fn new_pixel_format(
    &self,
    format: PixelFormatEnum
) -> Result<PixelFormat, String>
[src]

Allocates a new PixelFormat according to the enum given.

impl SDLToken[src]

pub fn get_pixel_format_name(&self, format: PixelFormatEnum) -> String[src]

Gets SDL2's textual name of a PixelFormatEnum.

Honestly, you can probably use the Debug impl of that type instead, but it's here if you want to double check SDL2's opinion of things.

pub fn masks_to_pixel_format_enum(
    &self,
    bpp: i32,
    r_mask: u32,
    g_mask: u32,
    b_mask: u32,
    a_mask: u32
) -> PixelFormatEnum
[src]

Try to combine some bpp and mask values into a single format value.

pub fn pixel_format_enum_to_masks(
    &self,
    format: PixelFormatEnum
) -> (i32, u32, u32, u32, u32)
[src]

Converts this format into the appropriate bpp and mask values.

impl SDLToken[src]

pub fn new_palette(&self, color_count: usize) -> Result<Palette, String>[src]

Allocates a new Palette with the number of color slots given.

The initial value of the palette color values is 0xFF in all four channels (opaque white).

impl SDLToken[src]

pub fn create_window<'sdl>(
    &'sdl self,
    title: &str,
    x: i32,
    y: i32,
    w: i32,
    h: i32,
    flags: WindowFlags
) -> Result<Window<'sdl>, String>
[src]

Creates a new window, or gives an error message.

Note that not all possible flags have an effect! See the wiki for guidance.

pub fn create_rgb_surface(
    &self,
    width: i32,
    height: i32,
    format: SurfaceFormat
) -> Result<Surface, String>
[src]

Creates a new Surface with the desired format, or error.

See the wiki page

pub fn poll_event(&self) -> Option<Event>[src]

Polls for an event, getting it out of the queue if one is there.

pub fn number_of_joysticks(&self) -> Result<i32, String>[src]

Obtains the number of joysticks connected to the system.

pub fn joystick_is_game_controller(&self, id: JoystickID) -> bool[src]

Says if the joystick index supports the Controller API.

pub fn controller_name(&self, id: JoystickID) -> Option<String>[src]

Given a joystick index, attempts to get the Controller name, if any.

pub fn open_controller(&self, id: JoystickID) -> Result<Controller, String>[src]

Attempts to open the given id as a Controller.

Not all joysticks support the Controller API, so this can fail.

pub fn load_cdylib<'sdl>(&'sdl self, name: &str) -> Result<CDyLib<'sdl>, String>[src]

Attempts to load the named dynamic library into the program.

pub fn open_default_audio_queue(
    &self,
    request: DefaultAudioQueueRequest
) -> Result<AudioQueue, String>
[src]

Attempts to open a default audio device in "queue" mode.

If successful, the device will initially be paused.

pub fn gl_set_attribute(&self, attr: GLattr, value: i32) -> bool[src]

Attempts to set a given attribute, returns true if successful.

Depending on the attribute, this can often be viewed as a "minimum request". Once you create the context you should examine it to see what you actually got.

pub fn gl_reset_attributes(&self)[src]

Resets all previously set attributes to their default values.

pub unsafe fn gl_get_proc_address(&self, name: &str) -> *const c_void[src]

Gets a function pointer to the named OpenGL function

Trait Implementations

impl Drop for SDLToken[src]

impl Debug for SDLToken[src]

Auto Trait Implementations

impl !Send for SDLToken

impl Unpin for SDLToken

impl !Sync for SDLToken

impl UnwindSafe for SDLToken

impl RefUnwindSafe for SDLToken

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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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