Function cgl_rs::graphics::widgets::begin_int

source ·
pub fn begin_int(
    scale_x: f32,
    scale_y: f32,
    offset_x: f32,
    offset_y: f32
) -> bool
Expand description

Begins a new CGL frame with a global scale and offset.

Arguments

  • scale_x - The horizontal scaling factor
  • scale_y - The vertical scaling factor
  • offset_x - The horizontal offset
  • offset_y - The vertical offset

Returns

Returns true if the frame was successfully created, otherwise returns false

Example

cgl_rs::init();
let mut window = cgl_rs::Window::new("CGL Window", 800, 600).unwrap();
cgl_rs::graphics::init();
cgl_rs::graphics::widgets::init();
 
while !window.should_close() {
    // bind framebuffers, etc.
    cgl_rs::graphics::widgets::begin_int(2.0, 2.0, 0.0, 0.0); // you could also check if the function returns true
        // draw widgets here
    cgl_rs::graphics::widgets::end();
    // update window, swap buffers, etc.
    break; // for testing purposes
}
 
cgl_rs::graphics::widgets::shutdown();
cgl_rs::graphics::shutdown();
window.destroy();
cgl_rs::shutdown();