31 lines
748 B
Rust
31 lines
748 B
Rust
mod sprite;
|
|
mod textarea;
|
|
|
|
pub(super) use sprite::UiSprite;
|
|
pub(super) use textarea::UiTextArea;
|
|
|
|
use nalgebra::{Point2, Vector2};
|
|
|
|
use crate::{RenderInput, RenderState};
|
|
|
|
/// Represents a rectangular region inside a sprite.
|
|
pub(crate) struct SpriteRect {
|
|
/// The position of the top-left corner of this rectangle, in fractional units.
|
|
/// (0.0 is left edge of sprite, 1.0 is right edge)
|
|
pub pos: Point2<f32>,
|
|
|
|
/// The width and height of this rectangle, in fractional units.
|
|
/// 1.0 will be as tall as the sprite, 0.5 will be half as tall
|
|
pub dim: Vector2<f32>,
|
|
}
|
|
|
|
pub(super) trait UiElement {
|
|
fn push_to_buffer_child(
|
|
&self,
|
|
input: &RenderInput,
|
|
state: &mut RenderState,
|
|
parent_pos: Point2<f32>,
|
|
parent_size: Vector2<f32>,
|
|
);
|
|
}
|