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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! # Embedded graphics simulator
//!
//! 
//!
//! The simulator can be used to test and debug
//! [embedded-graphics](https://crates.io/crates/embedded-graphics) code, or produce snazzy examples
//! for people to try drivers out without needing physical hardware to run on.
//!
//! # Setup
//!
//! The simulator uses SDL and its development libraries which must be installed to build and run
//! it.
//!
//! ## Linux (`apt`)
//!
//! ```bash
//! sudo apt install libsdl2-dev
//! ```
//!
//! ## macOS (`brew`)
//!
//! ```bash
//! brew install sdl2
//! ```
//!
//! ## Windows
//!
//! The Windows install process is a bit more involved, but it _does_ work. See [the SDL2
//! wiki](https://wiki.libsdl.org/Installation#WinRT.2FWindows_8.2FWinPhone) for instructions.
//!
//! # Examples
//!
//! ## Simulate a 128x64 SSD1306 OLED
//!
//! ```rust,no_run
//! use embedded_graphics::pixelcolor::BinaryColor;
//! use embedded_graphics::prelude::*;
//! use embedded_graphics::{egcircle, egline, egtext, primitive_style, text_style};
//! use embedded_graphics::fonts::Font6x8;
//! use embedded_graphics_simulator::{
//! BinaryColorTheme, SimulatorDisplay, SimulatorEvent, Window, OutputSettingsBuilder,
//! };
//! use std::thread;
//! use std::time::Duration;
//!
//! fn main() {
//! let mut display: SimulatorDisplay<BinaryColor> = SimulatorDisplay::new(Size::new(128, 64));
//! let output_settings = OutputSettingsBuilder::new()
//! .theme(BinaryColorTheme::OledBlue)
//! .build();
//! let mut window = Window::new("Example", &output_settings);
//!
//! egtext!(text = "Hello World!", top_left = Point::zero(), style = text_style!(font = Font6x8, text_color = BinaryColor::On)).draw(&mut display);
//!
//! egcircle!(center = (96, 32), radius = 31, style = primitive_style!(stroke_color = BinaryColor::On)).draw(&mut display);
//!
//! egline!(start = (32, 32), end = (1, 32), style = primitive_style!(stroke_color = BinaryColor::On))
//! .translate(Point::new(64, 0))
//! .draw(&mut display);
//! egline!(start = (32, 32), end = (40, 40), style = primitive_style!(stroke_color = BinaryColor::On))
//! .translate(Point::new(64, 0))
//! .draw(&mut display);
//!
//! 'running: loop {
//! window.update(&display);
//!
//! for event in window.events() {
//! match event {
//! SimulatorEvent::MouseButtonUp { point, .. } => {
//! println!("Click event at ({}, {})", point.x, point.y);
//! }
//! SimulatorEvent::Quit => break 'running,
//! _ => {}
//! }
//!
//! thread::sleep(Duration::from_millis(200));
//! }
//! }
//! }
//! ```
pub use crate::;