Struct ascending_graphics::Text
source · pub struct Text {Show 15 fields
pub buffer: Buffer,
pub pos: Vec3,
pub size: Vec2,
pub scale: f32,
pub offsets: Vec2,
pub default_color: Color,
pub bounds: Option<Bounds>,
pub store_id: Index,
pub order: DrawOrder,
pub cursor: Cursor,
pub line: usize,
pub scroll: Scroll,
pub wrap: Wrap,
pub use_camera: bool,
pub changed: bool,
}Fields§
§buffer: Buffer§pos: Vec3§size: Vec2§scale: f32§offsets: Vec2§default_color: Color§bounds: Option<Bounds>§store_id: Index§order: DrawOrder§cursor: CursorCursor the shaping is set too.
line: usizeline the shaping is set too.
scroll: Scrollset scroll to render too.
wrap: WrapWord Wrap Type. Default is Wrap::Word.
use_camera: boolif the shader should render with the camera’s view.
changed: boolif anything got updated we need to update the buffers too.
Implementations§
source§impl Text
impl Text
pub fn create_quad( &mut self, cache: &mut SwashCache, atlas: &mut TextAtlas, renderer: &mut GpuRenderer ) -> Result<(), GraphicsError>
pub fn new( renderer: &mut GpuRenderer, metrics: Option<Metrics>, pos: Vec3, size: Vec2, scale: f32 ) -> Self
sourcepub fn set_text(
&mut self,
renderer: &mut GpuRenderer,
text: &str,
attrs: Attrs<'_>,
shaping: Shaping
) -> &mut Self
pub fn set_text( &mut self, renderer: &mut GpuRenderer, text: &str, attrs: Attrs<'_>, shaping: Shaping ) -> &mut Self
resets the TextRender bytes to empty for new bytes
sourcepub fn set_rich_text<'r, 's, I>(
&mut self,
renderer: &mut GpuRenderer,
spans: I,
default_attr: Attrs<'_>,
shaping: Shaping
) -> &mut Self
pub fn set_rich_text<'r, 's, I>( &mut self, renderer: &mut GpuRenderer, spans: I, default_attr: Attrs<'_>, shaping: Shaping ) -> &mut Self
resets the TextRender bytes to empty for new bytes
sourcepub fn get_text_buffer(&mut self) -> &mut Buffer
pub fn get_text_buffer(&mut self) -> &mut Buffer
For more advanced shaping and usage. Use set_changed() to set if you need it to make changes or not. This will not set the change to true. when changes are made you must set changed to true.
sourcepub fn shape_until_cursor(
&mut self,
renderer: &mut GpuRenderer,
cursor: Cursor
) -> &mut Self
pub fn shape_until_cursor( &mut self, renderer: &mut GpuRenderer, cursor: Cursor ) -> &mut Self
cursor shaping sets the scroll.
sourcepub fn shape_until(
&mut self,
renderer: &mut GpuRenderer,
line: usize
) -> &mut Self
pub fn shape_until( &mut self, renderer: &mut GpuRenderer, line: usize ) -> &mut Self
Line shaping does not use scroll or cursor for shaping.
sourcepub fn shape_until_scroll(&mut self, renderer: &mut GpuRenderer) -> &mut Self
pub fn shape_until_scroll(&mut self, renderer: &mut GpuRenderer) -> &mut Self
Does not use cursor or line but will use the last set scroll.
pub fn set_scroll( &mut self, renderer: &mut GpuRenderer, scroll: Scroll ) -> &mut Self
pub fn set_change(&mut self, changed: bool) -> &mut Self
pub fn set_wrap(&mut self, renderer: &mut GpuRenderer, wrap: Wrap) -> &mut Self
pub fn set_bounds(&mut self, bounds: Option<Bounds>) -> &mut Self
pub fn set_position(&mut self, position: Vec3) -> &mut Self
pub fn set_default_color(&mut self, color: Color) -> &mut Self
pub fn set_offset(&mut self, offsets: Vec2) -> &mut Self
pub fn set_buffer_size( &mut self, renderer: &mut GpuRenderer, width: i32, height: i32 ) -> &mut Self
sourcepub fn clear(&mut self, renderer: &mut GpuRenderer) -> &mut Self
pub fn clear(&mut self, renderer: &mut GpuRenderer) -> &mut Self
resets the TextRender bytes to empty for new bytes
sourcepub fn visible_lines(&self) -> i32
pub fn visible_lines(&self) -> i32
returns how many lines exist in the buffer.
sourcepub fn update(
&mut self,
cache: &mut SwashCache,
atlas: &mut TextAtlas,
renderer: &mut GpuRenderer
) -> Result<OrderedIndex, GraphicsError>
pub fn update( &mut self, cache: &mut SwashCache, atlas: &mut TextAtlas, renderer: &mut GpuRenderer ) -> Result<OrderedIndex, GraphicsError>
used to check and update the vertex array. must call build_layout before you can Call this.
pub fn check_mouse_bounds(&self, mouse_pos: Vec2) -> bool
pub fn measure(&self) -> Vec2
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.