pub struct Window {
pub window: Window,
pub width: usize,
pub height: usize,
pub framebuffer_raw: Vec<u32>,
pub is_fullscreen: bool,
pub aa: f32,
/* private fields */
}Expand description
Owns the window and the raw flat framebuffer to be rendered.
Fields§
§window: Window§width: usize§height: usize§framebuffer_raw: Vec<u32>§is_fullscreen: bool§aa: f32Anti-aliasing softness in pixels. 0.0 = hard edges (no AA), 1.0 = standard AA. Higher values produce softer/blurrier edges.
Implementations§
Source§impl Window
impl Window
Sourcepub fn default() -> Self
pub fn default() -> Self
Creates a non-resizable window with a resolution of 1280 by 720 pixels
Sourcepub fn custom(
name: &str,
width: usize,
height: usize,
borders: bool,
resizable: bool,
) -> Self
pub fn custom( name: &str, width: usize, height: usize, borders: bool, resizable: bool, ) -> Self
Creates a window with custom resolution, can be borderless and resizable
Sourcepub fn get_typed_chars(&self) -> Vec<char>
pub fn get_typed_chars(&self) -> Vec<char>
Drains and returns all characters typed since the last call.
Sourcepub fn draw_pixel(&mut self, x: usize, y: usize, color: &Color)
pub fn draw_pixel(&mut self, x: usize, y: usize, color: &Color)
Draws a single pixel at given coordinates with color, respecting alpha
pub fn get_pixel(&self, x: usize, y: usize) -> u32
pub fn clear(&mut self, color: &Color)
Sourcepub fn draw_line(
&mut self,
x0: isize,
y0: isize,
x1: isize,
y1: isize,
th: usize,
color: Color,
)
pub fn draw_line( &mut self, x0: isize, y0: isize, x1: isize, y1: isize, th: usize, color: Color, )
Draws a straight line. Uses AA when self.aa > 0.
Sourcepub fn draw_line_dashed(
&mut self,
x0: isize,
y0: isize,
x1: isize,
y1: isize,
th: usize,
dash_len: usize,
gap_len: usize,
color: Color,
)
pub fn draw_line_dashed( &mut self, x0: isize, y0: isize, x1: isize, y1: isize, th: usize, dash_len: usize, gap_len: usize, color: Color, )
Draws a dashed line. dash_len is pixels on, gap_len is pixels off.
Sourcepub fn draw_line_dotted(
&mut self,
x0: isize,
y0: isize,
x1: isize,
y1: isize,
th: usize,
spacing: usize,
color: Color,
)
pub fn draw_line_dotted( &mut self, x0: isize, y0: isize, x1: isize, y1: isize, th: usize, spacing: usize, color: Color, )
Draws a dotted line (dash=1, gap=spacing)
Sourcepub fn draw_rect_f(
&mut self,
x: usize,
y: usize,
w: usize,
h: usize,
radius: usize,
color: &Color,
blur: usize,
)
pub fn draw_rect_f( &mut self, x: usize, y: usize, w: usize, h: usize, radius: usize, color: &Color, blur: usize, )
Draws a filled rectangle with optional rounded corners, alpha blending, and background blur.
Pass radius: 0 for sharp corners, blur: 0 for no blur.
Sourcepub fn draw_rect(
&mut self,
x: usize,
y: usize,
w: usize,
h: usize,
radius: usize,
color: &Color,
)
pub fn draw_rect( &mut self, x: usize, y: usize, w: usize, h: usize, radius: usize, color: &Color, )
Draws a hollow rectangle with optional rounded corners.
Pass radius: 0 for sharp corners.
Sourcepub fn draw_ellipse_f(
&mut self,
cx: isize,
cy: isize,
rx: usize,
ry: usize,
color: &Color,
blur: usize,
)
pub fn draw_ellipse_f( &mut self, cx: isize, cy: isize, rx: usize, ry: usize, color: &Color, blur: usize, )
Draws a filled ellipse with alpha blending and optional background blur.
For circles, pass rx == ry. Pass blur: 0 for no blur.
Sourcepub fn draw_ellipse(
&mut self,
cx: isize,
cy: isize,
rx: usize,
ry: usize,
color: &Color,
)
pub fn draw_ellipse( &mut self, cx: isize, cy: isize, rx: usize, ry: usize, color: &Color, )
Draws a hollow ellipse. For circles, pass rx == ry.
Sourcepub fn draw_gradient_h(
&mut self,
x: usize,
y: usize,
w: usize,
h: usize,
radius: usize,
color_left: &Color,
color_right: &Color,
)
pub fn draw_gradient_h( &mut self, x: usize, y: usize, w: usize, h: usize, radius: usize, color_left: &Color, color_right: &Color, )
Draws a filled rectangle with a horizontal linear gradient (left to right)
Draws a filled rectangle with a horizontal linear gradient (left to right).
Pass radius: 0 for sharp corners.
Sourcepub fn draw_gradient_v(
&mut self,
x: usize,
y: usize,
w: usize,
h: usize,
radius: usize,
color_top: &Color,
color_bottom: &Color,
)
pub fn draw_gradient_v( &mut self, x: usize, y: usize, w: usize, h: usize, radius: usize, color_top: &Color, color_bottom: &Color, )
Draws a filled rectangle with a vertical linear gradient (top to bottom).
Pass radius: 0 for sharp corners.
Sourcepub fn draw_box_shadow(
&mut self,
x: isize,
y: isize,
w: usize,
h: usize,
radius: usize,
offset_x: isize,
offset_y: isize,
spread: isize,
blur: usize,
color: &Color,
)
pub fn draw_box_shadow( &mut self, x: isize, y: isize, w: usize, h: usize, radius: usize, offset_x: isize, offset_y: isize, spread: isize, blur: usize, color: &Color, )
Draws a rectangular drop shadow.
Draws a drop shadow with optional rounded corners using SDF distance falloff.
Pass radius: 0 for sharp corners.
Sourcepub fn draw_bezier_quad(
&mut self,
x0: f32,
y0: f32,
x1: f32,
y1: f32,
x2: f32,
y2: f32,
th: usize,
color: &Color,
)
pub fn draw_bezier_quad( &mut self, x0: f32, y0: f32, x1: f32, y1: f32, x2: f32, y2: f32, th: usize, color: &Color, )
Draws a quadratic bezier curve from p0 to p2 with control point p1
Sourcepub fn draw_bezier_cubic(
&mut self,
x0: f32,
y0: f32,
x1: f32,
y1: f32,
x2: f32,
y2: f32,
x3: f32,
y3: f32,
th: usize,
color: &Color,
)
pub fn draw_bezier_cubic( &mut self, x0: f32, y0: f32, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, th: usize, color: &Color, )
Draws a cubic bezier curve from p0 to p3 with control points p1 and p2
Sourcepub fn draw_text(
&mut self,
x: usize,
y: usize,
text: &Text,
size: f32,
color: &Color,
)
pub fn draw_text( &mut self, x: usize, y: usize, text: &Text, size: f32, color: &Color, )
Draws text using the passed font
Sourcepub fn update(&mut self)
pub fn update(&mut self)
Updates the window. Should be called in a loop until the window is to be closed
pub fn get_mouse_state(&self) -> MouseState
Sourcepub fn draw_text_centered(
&mut self,
x: usize,
y: usize,
w: usize,
h: usize,
text: &Text,
size: f32,
color: &Color,
)
pub fn draw_text_centered( &mut self, x: usize, y: usize, w: usize, h: usize, text: &Text, size: f32, color: &Color, )
Draws text centered both horizontally and vertically within a bounding box
Sourcepub fn blur_region(
&mut self,
rx: usize,
ry: usize,
rw: usize,
rh: usize,
radius: usize,
)
pub fn blur_region( &mut self, rx: usize, ry: usize, rw: usize, rh: usize, radius: usize, )
Applies a separable box blur to a rectangular region of the framebuffer. Uses an O(n) sliding window — performance is independent of blur radius.
Sourcepub fn blur_region_rounded(
&mut self,
rx: usize,
ry: usize,
rw: usize,
rh: usize,
corner_radius: usize,
blur_radius: usize,
)
pub fn blur_region_rounded( &mut self, rx: usize, ry: usize, rw: usize, rh: usize, corner_radius: usize, blur_radius: usize, )
Applies a box blur to a region, preserving pixels outside rounded corners. This prevents the rectangular blur from leaking past rounded card edges.
Sourcepub fn push_clip(&mut self, x: usize, y: usize, w: usize, h: usize)
pub fn push_clip(&mut self, x: usize, y: usize, w: usize, h: usize)
Pushes a clipping rectangle. Drawing outside this region is discarded. Nested clips are intersected.