RaylibGui

Struct RaylibGui 

Source
pub struct RaylibGui {
    pub context: Context,
    /* private fields */
}

Fields§

§context: Context

Implementations§

Source§

impl RaylibGui

Source

pub fn new(rl: &mut RaylibHandle, _thread: &RaylibThread) -> RaylibGui

Examples found in repository?
examples/raylib_draw_extension.rs (line 20)
14fn main() {
15  let (mut rl, thread) = raylib::init()
16    .size(800, 600)
17    .title("Using raylib draw")
18    .build();
19
20  let mut gui = RaylibGui::new(&mut rl, &thread);
21  let mut open = true;
22
23  while !rl.window_should_close() {
24    gui.update(&mut rl);
25    let mut d = rl.begin_drawing(&thread);
26
27    d.clear_background(Color::WHITE);
28    d.draw_text("Hello, world!", 12, 12, 20, Color::BLACK);
29    d.on_ui(&mut gui, &mut open);
30  }
31}
More examples
Hide additional examples
examples/demo_window.rs (line 10)
4fn main() {
5  let (mut rl, thread) = raylib::init()
6    .size(800, 600)
7    .title("Demo window")
8    .build();
9
10  let mut gui = RaylibGui::new(&mut rl, &thread);
11  let mut open = true;
12
13  while !rl.window_should_close() {
14    let ui = gui.begin(&mut rl);
15    ui.show_demo_window(&mut open);
16    // Draw ImGui stuff here
17
18    let mut d = rl.begin_drawing(&thread);
19    d.clear_background(Color::WHITE);
20    // Draw raylib stuff here
21
22    gui.end();
23  }
24}
Source

pub fn set_style(&mut self, style: Style)

Source

pub fn update(&mut self, rl: &mut RaylibHandle)

Examples found in repository?
examples/raylib_draw_extension.rs (line 24)
14fn main() {
15  let (mut rl, thread) = raylib::init()
16    .size(800, 600)
17    .title("Using raylib draw")
18    .build();
19
20  let mut gui = RaylibGui::new(&mut rl, &thread);
21  let mut open = true;
22
23  while !rl.window_should_close() {
24    gui.update(&mut rl);
25    let mut d = rl.begin_drawing(&thread);
26
27    d.clear_background(Color::WHITE);
28    d.draw_text("Hello, world!", 12, 12, 20, Color::BLACK);
29    d.on_ui(&mut gui, &mut open);
30  }
31}
Source

pub fn update_delta(&mut self, rl: &mut RaylibHandle, delta_time: f32)

Source

pub fn begin(&mut self, rl: &mut RaylibHandle) -> &mut Ui

Examples found in repository?
examples/demo_window.rs (line 14)
4fn main() {
5  let (mut rl, thread) = raylib::init()
6    .size(800, 600)
7    .title("Demo window")
8    .build();
9
10  let mut gui = RaylibGui::new(&mut rl, &thread);
11  let mut open = true;
12
13  while !rl.window_should_close() {
14    let ui = gui.begin(&mut rl);
15    ui.show_demo_window(&mut open);
16    // Draw ImGui stuff here
17
18    let mut d = rl.begin_drawing(&thread);
19    d.clear_background(Color::WHITE);
20    // Draw raylib stuff here
21
22    gui.end();
23  }
24}
Source

pub fn begin_delta(&mut self, rl: &mut RaylibHandle, delta_time: f32) -> &mut Ui

Source

pub fn end(&mut self)

Examples found in repository?
examples/demo_window.rs (line 22)
4fn main() {
5  let (mut rl, thread) = raylib::init()
6    .size(800, 600)
7    .title("Demo window")
8    .build();
9
10  let mut gui = RaylibGui::new(&mut rl, &thread);
11  let mut open = true;
12
13  while !rl.window_should_close() {
14    let ui = gui.begin(&mut rl);
15    ui.show_demo_window(&mut open);
16    // Draw ImGui stuff here
17
18    let mut d = rl.begin_drawing(&thread);
19    d.clear_background(Color::WHITE);
20    // Draw raylib stuff here
21
22    gui.end();
23  }
24}
Source

pub fn reload_fonts(&mut self)

Source

pub fn new_frame(&mut self) -> &mut Ui

Examples found in repository?
examples/raylib_draw_extension.rs (line 7)
6  fn on_ui(&self, gui: &mut RaylibGui, open: &mut bool) {
7    let ui = gui.new_frame();
8
9    ui.show_demo_window(open);
10    gui.render();
11  }
Source

pub fn prepare_frame(&mut self, rl: &mut RaylibHandle, delta_time: f32)

Source

pub fn handle_events(&mut self, rl: &mut RaylibHandle)

Source

pub fn render(&mut self)

Examples found in repository?
examples/raylib_draw_extension.rs (line 10)
6  fn on_ui(&self, gui: &mut RaylibGui, open: &mut bool) {
7    let ui = gui.new_frame();
8
9    ui.show_demo_window(open);
10    gui.render();
11  }

Trait Implementations§

Source§

impl Drop for RaylibGui

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.