1use miniquad::*;
2use quad_gl::*;
3
4struct Stage {
5 gl: QuadGl,
6}
7impl EventHandler for Stage {
8 fn update(&mut self, _ctx: &mut Context) {}
9
10 fn draw(&mut self, ctx: &mut Context) {
11 ctx.clear(Some((0., 1., 0., 1.)), None, None);
12
13 self.gl.draw_mode(DrawMode::Lines);
14 self.gl.geometry(
15 &[
16 Vertex::new(0., -0.5, 0., 0., 0., BLUE),
17 Vertex::new(0.5, 0.5, 0., 0., 0., RED),
18 Vertex::new(-0.5, 0.5, 0., 0., 0., GREEN),
19 ],
20 &[0, 1, 2, 0, 1, 2],
21 );
22 self.gl.draw(ctx);
23 }
24}
25
26fn main() {
27 miniquad::start(conf::Conf::default(), |mut ctx| {
28 UserData::owning(
29 Stage {
30 gl: QuadGl::new(&mut ctx),
31 },
32 ctx,
33 )
34 });
35}