aboutsummaryrefslogtreecommitdiff
path: root/examples/vec2f.hff
blob: 0a40b40928c1d8a89caa6c0316075b6ac4f6d227 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
struct Vec2f {
   x f32, y f32,

   fn x(v Vec2f) f32 {
      return (&v).x;
   }

   fn y(v *Vec2f) f32 {
      return v.y;
   }

}

extern fn add(l Vec2f, r Vec2f) Vec2f {
   return { l.x + r.x, l.y + r.y };
}