GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — libprocessing/examples/input.rs at python-api · processing/libprocessing

Expand file tree

/

input.rs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
71 lines (59 loc) · 1.82 KB
/

input.rs

Copy path

File metadata and controls

71 lines (59 loc) · 1.82 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
use processing_glfw::GlfwContext;
use processing::prelude::*;
use processing_render::render::command::DrawCommand;
fn main() {
match sketch() {
Ok(_) => {
eprintln!("Sketch completed successfully");
exit(0).unwrap();
}
Err(e) => {
eprintln!("Sketch error: {:?}", e);
exit(1).unwrap();
}
};
}
fn sketch() -> error::Result<()> {
let width = 400;
let height = 400;
let mut glfw_ctx = GlfwContext::new(width, height, false)?;
init(Config::default())?;
let surface = glfw_ctx.create_surface(width, height, false)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;
while glfw_ctx.poll_events() {
graphics_begin_draw(graphics)?;
let mx = input_mouse_x(surface)?;
let my = input_mouse_y(surface)?;
graphics_record_command(
graphics,
DrawCommand::BackgroundColor(bevy::color::Color::srgb(0.15, 0.15, 0.2)),
)?;
if input_mouse_is_pressed()? {
graphics_record_command(
graphics,
DrawCommand::Fill(bevy::color::Color::srgb(0.25, 0.15, 0.2)),
)?;
}
if input_mouse_is_pressed()? {
graphics_record_command(
graphics,
DrawCommand::Fill(bevy::color::Color::srgb(0.55, 0.25, 0.2)),
)?;
}
graphics_record_command(
graphics,
DrawCommand::Rect {
x: mx - 25.0,
y: my - 25.0,
w: 50.0,
h: 50.0,
radii: [0.0; 4],
},
)?;
if input_key_is_pressed()? && input_key_is_down(KeyCode::Escape)? {
break;
}
graphics_end_draw(graphics)?;
}
Ok(())
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.