pub fn load_shader(
draw: &mut DrawContext,
graphics: &Graphics<Vertex>,
name: impl Into<Cow<'static, str>>,
vertex: &str,
fragment: &str,
)
Examples found in repository?
examples/path.rs (lines 64-70)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
fn enter(&mut self, context: GameContext) {
context.graphics.color = [0.2, 0.2, 0.2, 1.0];
context.graphics.main_camera.screen_alignment = 0.5.into();
context.graphics.main_camera.scaling = CameraScaling::FitVertical(300.0);
let pointer_x = InputAxisRef::default();
let pointer_y = InputAxisRef::default();
self.mouse_xy = Some(ArrayInputCombinator::new([
pointer_x.clone(),
pointer_y.clone(),
]));
context.input.push_mapping(
InputMapping::default()
.consume(InputConsume::Hit)
.axis(VirtualAxis::MousePositionX, pointer_x)
.axis(VirtualAxis::MousePositionY, pointer_y),
);
load_shader(
context.draw,
context.graphics,
"color",
Shader::COLORED_VERTEX_2D,
Shader::PASS_FRAGMENT,
);
}