Skip to content

Update default example #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ If you want to contribute code, here's a quick primer:
## usage

```rust
use scap::{
capturer::{Point, Area, Size, Capturer, Options},
frame::Frame,
};
use scap::capturer::{Capturer, Options};

fn main() {
// Check if the platform is supported
Expand Down Expand Up @@ -66,34 +63,33 @@ fn main() {

// Create Options
let options = Options {
fps: 60,
fps: 30,
target: None, // None captures the primary display
show_cursor: true,
show_highlight: true,
excluded_targets: None,
output_type: scap::frame::FrameType::BGRAFrame,
output_resolution: scap::capturer::Resolution::_720p,
source_rect: Some(Area {
origin: Point { x: 0.0, y: 0.0 },
size: Size {
width: 2000.0,
height: 1000.0,
},
}),
..Default::default()
};

// Create Capturer
let mut capturer = Capturer::new(options);
let capturer = Capturer::build(options);

// Start Capture
capturer.start_capture();
match capturer {
Ok(mut cap) => {
// Start Capture
cap.start_capture();

let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();

// Stop Capture
capturer.stop_capture();
// Stop Capture
cap.stop_capture();
}

Err(e) => println!("❌ Could not initialize capturer {}", e),
}
}
```

Expand Down