Skip to content

Instantly share code, notes, and snippets.

@dharmatech
Created May 19, 2014 19:32
Show Gist options
  • Save dharmatech/4faec17c3640a89a8c39 to your computer and use it in GitHub Desktop.
Save dharmatech/4faec17c3640a89a8c39 to your computer and use it in GitHub Desktop.
fn render(&mut self) -> bool
{
let renderer = ui::Renderer::get();
renderer.begin();
if self.position.y < -self.tex_left.size.y as f32
{
renderer.end();
return false;
}
let right_pos =
match renderer.window.get_size()
{ (width, _height) => math::Vec2f::new((width as i32 - self.tex_right.size.x) as f32, self.position.y) };
let middle_pos = math::Vec2f::new(self.tex_left.size.x as f32, self.position.y);
let middle_size = math::Vec2f::new(right_pos.x - self.tex_left.size.x as f32, self.tex_middle.size.y as f32);
renderer
.. render_texture(&self.tex_left, &self.position)
.. render_texture(&self.tex_right, &right_pos)
.. render_texture_scale_clamp(&self.tex_middle, &middle_pos, &middle_size)
.. render_font(self.console.body, math::Vec2f::new(self.tex_left.size.x as f32, 0.0 + self.position.y), &self.font)
.. render_font
(
self.console.prefix,
math::Vec2f::new
(
self.tex_left.size.x as f32,
self.tex_left.size.y as f32 - 35.0 + self.position.y
),
&self.font
)
.. render_font
(
self.console.input,
math::Vec2f::new
(
self.tex_left.size.x as f32 + 20.0,
self.tex_left.size.y as f32 - 35.0 + self.position.y
),
&self.font
)
.. end();
false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment