Skip to content

Commit a0430c5

Browse files
committed
Added mouse press element to rust input example
1 parent 530e71e commit a0430c5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

examples/input.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ fn sketch() -> error::Result<()> {
3636
DrawCommand::BackgroundColor(bevy::color::Color::srgb(0.15, 0.15, 0.2)),
3737
)?;
3838

39+
if input_mouse_is_pressed()? {
40+
graphics_record_command(
41+
graphics,
42+
DrawCommand::Fill(bevy::color::Color::srgb(0.25, 0.15, 0.2)),
43+
)?;
44+
} else {
45+
}
46+
47+
if input_mouse_is_pressed()? {
48+
graphics_record_command(
49+
graphics,
50+
DrawCommand::Fill(bevy::color::Color::srgb(0.55, 0.25, 0.2)),
51+
)?;
52+
} else {
53+
}
54+
3955
graphics_record_command(
4056
graphics,
4157
DrawCommand::Rect {

0 commit comments

Comments
 (0)