pub struct Graphics<'g, 'p, 'f, S: Surface> {
pub graphics2d: &'g Graphics2D,
pub draw_parameters: DrawParameters<'p>,
pub frame: &'f mut S,
}Expand description
Простой интерфейс для связи кадра и графических функций. Simple interface to connect graphics fuctions to the frame.
Fields§
§graphics2d: &'g Graphics2D§draw_parameters: DrawParameters<'p>§frame: &'f mut SImplementations§
Source§impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
Sourcepub fn clear_colour(&mut self, [r, g, b, a]: [f32; 4])
pub fn clear_colour(&mut self, [r, g, b, a]: [f32; 4])
Заполняет окно данным цветом.
Fills a window with the given colour.
Sourcepub fn draw_object(
&mut self,
index: usize,
object_type: ObjectType,
draw_type: DrawType,
) -> Result<(), DrawError>
pub fn draw_object( &mut self, index: usize, object_type: ObjectType, draw_type: DrawType, ) -> Result<(), DrawError>
Рисует сохранённый объект.
Draws an object.
Source§impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с простыми объектами. Functions to work with simple objects.
impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с простыми объектами. Functions to work with simple objects.
Sourcepub fn draw_simple<O, V, I>(&mut self, object: &O) -> Result<(), DrawError>
pub fn draw_simple<O, V, I>(&mut self, object: &O) -> Result<(), DrawError>
Рисует простой объект.
Draws a simple object.
Sourcepub fn draw_shift_simple<O, V, I>(
&mut self,
object: &O,
shift: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_shift_simple<O, V, I>( &mut self, object: &O, shift: [f32; 2], ) -> Result<(), DrawError>
Рисует сдвинутый простой объект.
Draws a shifted simple object.
Source§impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для отрисовки текстур. Texture rendering functions.
impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для отрисовки текстур. Texture rendering functions.
Sourcepub fn draw_texture<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
pub fn draw_texture<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
Рисует изображение.
Draws a texture.
Sourcepub fn draw_shift_texture<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
shift: [f32; 2],
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
pub fn draw_shift_texture<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
shift: [f32; 2],
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
Рисует сдвинутую текстуру.
Draws a shifted texture.
Sourcepub fn draw_rotate_texture<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
rotation_center: [f32; 2],
angle: f32,
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
pub fn draw_rotate_texture<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
rotation_center: [f32; 2],
angle: f32,
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
Рисует повёрнутую текстуру.
Draws a rotated texture.
angle - radians
Sourcepub fn draw_texture_general<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
draw_type: DrawType,
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
pub fn draw_texture_general<O, V, I>(
&mut self,
base: &O,
texture: &Texture,
draw_type: DrawType,
) -> Result<(), DrawError>where
O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>,
V: AsRef<[TexturedVertex2D]>,
I: AsRef<[u8]>,
Рисует текстуру.
Draws a texture.
Source§impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Фукнции для отрисовки глифов. Glyph rendering functions.
impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Фукнции для отрисовки глифов. Glyph rendering functions.
Sourcepub fn draw_glyph(
&mut self,
glyph: &OutlinedGlyph,
colour: Colour,
[x, y]: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_glyph( &mut self, glyph: &OutlinedGlyph, colour: Colour, [x, y]: [f32; 2], ) -> Result<(), DrawError>
Строит и выводит глиф.
Builds and draws a glyph.
Sourcepub fn draw_shift_glyph(
&mut self,
glyph: &OutlinedGlyph,
colour: Colour,
[x, y]: [f32; 2],
shift: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_shift_glyph( &mut self, glyph: &OutlinedGlyph, colour: Colour, [x, y]: [f32; 2], shift: [f32; 2], ) -> Result<(), DrawError>
Строит и выводит сдвинутый глиф.
Builds and draws a shifted glyph.
Sourcepub fn draw_rotate_glyph(
&mut self,
glyph: &OutlinedGlyph,
colour: Colour,
[x, y]: [f32; 2],
rotation_center: [f32; 2],
angle: f32,
) -> Result<(), DrawError>
pub fn draw_rotate_glyph( &mut self, glyph: &OutlinedGlyph, colour: Colour, [x, y]: [f32; 2], rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>
Строит и выводит повёрнутый глиф.
Builds and draws a rotated glyph.
Sourcepub fn draw_glyph_cache(
&mut self,
glyph: &TexturedGlyph<'_>,
colour: Colour,
[x, y]: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_glyph_cache( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], ) -> Result<(), DrawError>
Выводит уже построенный глиф.
Draws an already built glyph.
Sourcepub fn draw_shift_glyph_cache(
&mut self,
glyph: &TexturedGlyph<'_>,
colour: Colour,
[x, y]: [f32; 2],
shift: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_shift_glyph_cache( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], shift: [f32; 2], ) -> Result<(), DrawError>
Выводит сдвинутый уже построенный глиф.
Draws a shifted already built glyph.
Sourcepub fn draw_rotate_glyph_cache(
&mut self,
glyph: &TexturedGlyph<'_>,
colour: Colour,
[x, y]: [f32; 2],
rotation_center: [f32; 2],
angle: f32,
) -> Result<(), DrawError>
pub fn draw_rotate_glyph_cache( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>
Выводит повёрнутый уже построенный глиф.
Draws a rotated already built glyph.
Sourcepub fn draw_glyph_cache_general(
&mut self,
glyph: &TexturedGlyph<'_>,
colour: Colour,
[x, y]: [f32; 2],
draw_type: DrawType,
) -> Result<(), DrawError>
pub fn draw_glyph_cache_general( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], draw_type: DrawType, ) -> Result<(), DrawError>
Выводит уже построенный глиф.
Draws a already built glyph.
Source§impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с сохранёнными простыми объектами. Functions to work with saved simple objects.
impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с сохранёнными простыми объектами. Functions to work with saved simple objects.
Sourcepub fn draw_simple_object(&mut self, index: usize) -> Result<(), DrawError>
pub fn draw_simple_object(&mut self, index: usize) -> Result<(), DrawError>
Рисует простой объект.
Draws the saved simple object.
Sourcepub fn draw_shift_simple_object(
&mut self,
index: usize,
shift: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_shift_simple_object( &mut self, index: usize, shift: [f32; 2], ) -> Result<(), DrawError>
Рисует сдвинутый простой объект.
Draws the shifted saved simple object.
Source§impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с сохранёнными текстурными объектами. Functions to work with saved textured objects.
impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с сохранёнными текстурными объектами. Functions to work with saved textured objects.
Sourcepub fn draw_textured_object(&mut self, index: usize) -> Result<(), DrawError>
pub fn draw_textured_object(&mut self, index: usize) -> Result<(), DrawError>
Рисует сохранённый текстурный объект.
Draws a saved textured object.
Sourcepub fn draw_shift_textured_object(
&mut self,
index: usize,
shift: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_shift_textured_object( &mut self, index: usize, shift: [f32; 2], ) -> Result<(), DrawError>
Рисует сдвинутый сохранённый текстурный объект.
Draws a shifted saved textured object.
Source§impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с сохранёнными текстовыми объектами. Functions to work with saved text objects.
impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>
§Функции для работы с сохранёнными текстовыми объектами. Functions to work with saved text objects.
Sourcepub fn draw_text_object(&mut self, index: usize) -> Result<(), DrawError>
pub fn draw_text_object(&mut self, index: usize) -> Result<(), DrawError>
Рисует сохранённый текстовой объект.
Draws a saved text object.
Sourcepub fn draw_shift_text_object(
&mut self,
index: usize,
shift: [f32; 2],
) -> Result<(), DrawError>
pub fn draw_shift_text_object( &mut self, index: usize, shift: [f32; 2], ) -> Result<(), DrawError>
Рисует сохранённый текстовой объект.
Draws a saved text object.