├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── branding └── demo.jpg ├── buildroot.sh ├── lib ├── egui-bleeding │ ├── .github │ │ ├── ISSUE_TEMPLATE │ │ │ ├── bug_report.md │ │ │ ├── feature_request.md │ │ │ └── other.md │ │ ├── pull_request_template.md │ │ └── workflows │ │ │ └── rust.yml │ ├── .gitignore │ ├── ARCHITECTURE.md │ ├── CHANGELOG.md │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── Cargo.lock │ ├── Cargo.toml │ ├── Cranky.toml │ ├── FORK.md │ ├── LICENSE-APACHE │ ├── LICENSE-MIT │ ├── README.md │ ├── bacon.toml │ ├── crates │ │ ├── eframe │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── epi.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── native │ │ │ │ ├── epi_integration.rs │ │ │ │ ├── file_storage.rs │ │ │ │ ├── mod.rs │ │ │ │ └── run.rs │ │ │ │ └── web │ │ │ │ ├── backend.rs │ │ │ │ ├── events.rs │ │ │ │ ├── input.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── screen_reader.rs │ │ │ │ ├── storage.rs │ │ │ │ ├── text_agent.rs │ │ │ │ ├── web_painter.rs │ │ │ │ ├── web_painter_glow.rs │ │ │ │ └── web_painter_wgpu.rs │ │ ├── egui-wgpu │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── egui.wgsl │ │ │ │ ├── lib.rs │ │ │ │ ├── renderer.rs │ │ │ │ └── winit.rs │ │ ├── egui-winit │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── clipboard.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── screen_reader.rs │ │ │ │ └── window_settings.rs │ │ ├── egui │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ └── README.md │ │ │ └── src │ │ │ │ ├── animation_manager.rs │ │ │ │ ├── containers │ │ │ │ ├── area.rs │ │ │ │ ├── collapsing_header.rs │ │ │ │ ├── combo_box.rs │ │ │ │ ├── frame.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── panel.rs │ │ │ │ ├── popup.rs │ │ │ │ ├── resize.rs │ │ │ │ ├── scroll_area.rs │ │ │ │ └── window.rs │ │ │ │ ├── context.rs │ │ │ │ ├── data │ │ │ │ ├── input.rs │ │ │ │ ├── mod.rs │ │ │ │ └── output.rs │ │ │ │ ├── frame_state.rs │ │ │ │ ├── grid.rs │ │ │ │ ├── id.rs │ │ │ │ ├── input_state.rs │ │ │ │ ├── input_state │ │ │ │ └── touch_state.rs │ │ │ │ ├── introspection.rs │ │ │ │ ├── layers.rs │ │ │ │ ├── layout.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── memory.rs │ │ │ │ ├── menu.rs │ │ │ │ ├── painter.rs │ │ │ │ ├── placer.rs │ │ │ │ ├── response.rs │ │ │ │ ├── sense.rs │ │ │ │ ├── style.rs │ │ │ │ ├── ui.rs │ │ │ │ ├── util │ │ │ │ ├── cache.rs │ │ │ │ ├── fixed_cache.rs │ │ │ │ ├── history.rs │ │ │ │ ├── id_type_map.rs │ │ │ │ ├── mod.rs │ │ │ │ └── undoer.rs │ │ │ │ ├── widget_text.rs │ │ │ │ └── widgets │ │ │ │ ├── button.rs │ │ │ │ ├── color_picker.rs │ │ │ │ ├── drag_value.rs │ │ │ │ ├── hyperlink.rs │ │ │ │ ├── image.rs │ │ │ │ ├── label.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── plot │ │ │ │ ├── items │ │ │ │ │ ├── bar.rs │ │ │ │ │ ├── box_elem.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── rect_elem.rs │ │ │ │ │ └── values.rs │ │ │ │ ├── legend.rs │ │ │ │ ├── mod.rs │ │ │ │ └── transform.rs │ │ │ │ ├── progress_bar.rs │ │ │ │ ├── selected_label.rs │ │ │ │ ├── separator.rs │ │ │ │ ├── slider.rs │ │ │ │ ├── spinner.rs │ │ │ │ └── text_edit │ │ │ │ ├── builder.rs │ │ │ │ ├── cursor_range.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── output.rs │ │ │ │ ├── state.rs │ │ │ │ └── text_buffer.rs │ │ ├── egui_demo_app │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── apps │ │ │ │ ├── custom3d_glow.rs │ │ │ │ ├── custom3d_wgpu.rs │ │ │ │ ├── custom3d_wgpu_shader.wgsl │ │ │ │ ├── fractal_clock.rs │ │ │ │ ├── http_app.rs │ │ │ │ └── mod.rs │ │ │ │ ├── backend_panel.rs │ │ │ │ ├── frame_history.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── main.rs │ │ │ │ └── wrap_app.rs │ │ ├── egui_demo_lib │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── benches │ │ │ │ └── benchmark.rs │ │ │ └── src │ │ │ │ ├── color_test.rs │ │ │ │ ├── demo │ │ │ │ ├── about.rs │ │ │ │ ├── code_editor.rs │ │ │ │ ├── code_example.rs │ │ │ │ ├── context_menu.rs │ │ │ │ ├── dancing_strings.rs │ │ │ │ ├── demo_app_windows.rs │ │ │ │ ├── drag_and_drop.rs │ │ │ │ ├── font_book.rs │ │ │ │ ├── layout_test.rs │ │ │ │ ├── misc_demo_window.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── multi_touch.rs │ │ │ │ ├── paint_bezier.rs │ │ │ │ ├── painting.rs │ │ │ │ ├── password.rs │ │ │ │ ├── plot_demo.rs │ │ │ │ ├── scrolling.rs │ │ │ │ ├── sliders.rs │ │ │ │ ├── strip_demo.rs │ │ │ │ ├── table_demo.rs │ │ │ │ ├── tests.rs │ │ │ │ ├── text_edit.rs │ │ │ │ ├── toggle_switch.rs │ │ │ │ ├── widget_gallery.rs │ │ │ │ ├── window_options.rs │ │ │ │ └── window_with_panels.rs │ │ │ │ ├── easy_mark │ │ │ │ ├── easy_mark_editor.rs │ │ │ │ ├── easy_mark_highlighter.rs │ │ │ │ ├── easy_mark_parser.rs │ │ │ │ ├── easy_mark_viewer.rs │ │ │ │ └── mod.rs │ │ │ │ ├── lib.rs │ │ │ │ └── syntax_highlighting.rs │ │ ├── egui_extras │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── datepicker │ │ │ │ ├── button.rs │ │ │ │ ├── mod.rs │ │ │ │ └── popup.rs │ │ │ │ ├── image.rs │ │ │ │ ├── layout.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── sizing.rs │ │ │ │ ├── strip.rs │ │ │ │ └── table.rs │ │ ├── egui_glium │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ ├── native_texture.rs │ │ │ │ └── pure_glium.rs │ │ │ └── src │ │ │ │ ├── lib.rs │ │ │ │ ├── painter.rs │ │ │ │ └── shader │ │ │ │ ├── fragment_100es.glsl │ │ │ │ ├── fragment_120.glsl │ │ │ │ ├── fragment_140.glsl │ │ │ │ ├── fragment_300es.glsl │ │ │ │ ├── vertex_100es.glsl │ │ │ │ ├── vertex_120.glsl │ │ │ │ ├── vertex_140.glsl │ │ │ │ └── vertex_300es.glsl │ │ ├── egui_glow │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ └── pure_glow.rs │ │ │ └── src │ │ │ │ ├── lib.rs │ │ │ │ ├── misc_util.rs │ │ │ │ ├── painter.rs │ │ │ │ ├── shader │ │ │ │ ├── fragment.glsl │ │ │ │ └── vertex.glsl │ │ │ │ ├── shader_version.rs │ │ │ │ ├── vao.rs │ │ │ │ └── winit.rs │ │ ├── egui_web │ │ │ ├── CHANGELOG.md │ │ │ └── README.md │ │ ├── emath │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── align.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── numeric.rs │ │ │ │ ├── pos2.rs │ │ │ │ ├── rect.rs │ │ │ │ ├── rect_transform.rs │ │ │ │ ├── rot2.rs │ │ │ │ ├── smart_aim.rs │ │ │ │ └── vec2.rs │ │ └── epaint │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── benches │ │ │ └── benchmark.rs │ │ │ ├── fonts │ │ │ ├── Hack-Regular.ttf │ │ │ ├── Hack-Regular.txt │ │ │ ├── NotoEmoji-Regular.ttf │ │ │ ├── OFL.txt │ │ │ ├── UFL.txt │ │ │ ├── Ubuntu-Light.ttf │ │ │ ├── emoji-icon-font-mit-license.txt │ │ │ ├── emoji-icon-font.ttf │ │ │ └── list_fonts.py │ │ │ └── src │ │ │ ├── bezier.rs │ │ │ ├── color.rs │ │ │ ├── image.rs │ │ │ ├── lib.rs │ │ │ ├── mesh.rs │ │ │ ├── mutex.rs │ │ │ ├── shadow.rs │ │ │ ├── shape.rs │ │ │ ├── shape_transform.rs │ │ │ ├── stats.rs │ │ │ ├── stroke.rs │ │ │ ├── tessellator.rs │ │ │ ├── text │ │ │ ├── cursor.rs │ │ │ ├── font.rs │ │ │ ├── fonts.rs │ │ │ ├── mod.rs │ │ │ ├── text_layout.rs │ │ │ └── text_layout_types.rs │ │ │ ├── texture_atlas.rs │ │ │ ├── texture_handle.rs │ │ │ ├── textures.rs │ │ │ └── util │ │ │ ├── mod.rs │ │ │ └── ordered_float.rs │ ├── deny.toml │ ├── docs │ │ ├── CNAME │ │ ├── README.md │ │ ├── egui_demo_app.js │ │ ├── egui_demo_app_bg.wasm │ │ ├── example.html │ │ ├── favicon.ico │ │ ├── index.html │ │ └── multiple_apps.html │ ├── examples │ │ ├── README.md │ │ ├── confirm_exit │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_3d_glow │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_3d_three-d │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── index.html │ │ │ └── src │ │ │ │ ├── lib.rs │ │ │ │ └── main.rs │ │ ├── custom_font │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_font_style │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_window_frame │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── download_image │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── file_dialog │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── hello_world │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── puffin_profiler │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── retained_image │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── main.rs │ │ │ │ ├── rust-logo-256x256.png │ │ │ │ └── rust-logo-license.txt │ │ ├── screenshot │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── serial_windows │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ └── svg │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ ├── main.rs │ │ │ ├── rust-logo-license.txt │ │ │ └── rustacean-flat-happy.svg │ ├── rust-toolchain │ └── sh │ │ ├── build_demo_web.sh │ │ ├── check.sh │ │ ├── docs.sh │ │ ├── find_bloat.sh │ │ ├── setup_web.sh │ │ ├── start_server.sh │ │ ├── wasm_bindgen_check.sh │ │ └── wasm_size.sh ├── egui │ ├── .github │ │ ├── ISSUE_TEMPLATE │ │ │ ├── bug_report.md │ │ │ ├── feature_request.md │ │ │ └── other.md │ │ ├── pull_request_template.md │ │ └── workflows │ │ │ └── rust.yml │ ├── .gitignore │ ├── ARCHITECTURE.md │ ├── CHANGELOG.md │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── Cargo.lock │ ├── Cargo.toml │ ├── Cranky.toml │ ├── FORK.md │ ├── LICENSE-APACHE │ ├── LICENSE-MIT │ ├── README.md │ ├── bacon.toml │ ├── crates │ │ ├── eframe │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── epi.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── native │ │ │ │ ├── epi_integration.rs │ │ │ │ ├── file_storage.rs │ │ │ │ ├── mod.rs │ │ │ │ └── run.rs │ │ │ │ └── web │ │ │ │ ├── backend.rs │ │ │ │ ├── events.rs │ │ │ │ ├── glow_wrapping.rs │ │ │ │ ├── input.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── screen_reader.rs │ │ │ │ ├── storage.rs │ │ │ │ └── text_agent.rs │ │ ├── egui-wgpu │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── egui.wgsl │ │ │ │ ├── lib.rs │ │ │ │ ├── renderer.rs │ │ │ │ └── winit.rs │ │ ├── egui-winit │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── clipboard.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── screen_reader.rs │ │ │ │ └── window_settings.rs │ │ ├── egui │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ └── README.md │ │ │ └── src │ │ │ │ ├── animation_manager.rs │ │ │ │ ├── containers │ │ │ │ ├── area.rs │ │ │ │ ├── collapsing_header.rs │ │ │ │ ├── combo_box.rs │ │ │ │ ├── frame.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── panel.rs │ │ │ │ ├── popup.rs │ │ │ │ ├── resize.rs │ │ │ │ ├── scroll_area.rs │ │ │ │ └── window.rs │ │ │ │ ├── context.rs │ │ │ │ ├── data │ │ │ │ ├── input.rs │ │ │ │ ├── mod.rs │ │ │ │ └── output.rs │ │ │ │ ├── frame_state.rs │ │ │ │ ├── grid.rs │ │ │ │ ├── id.rs │ │ │ │ ├── input_state.rs │ │ │ │ ├── input_state │ │ │ │ └── touch_state.rs │ │ │ │ ├── introspection.rs │ │ │ │ ├── layers.rs │ │ │ │ ├── layout.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── memory.rs │ │ │ │ ├── menu.rs │ │ │ │ ├── painter.rs │ │ │ │ ├── placer.rs │ │ │ │ ├── response.rs │ │ │ │ ├── sense.rs │ │ │ │ ├── style.rs │ │ │ │ ├── ui.rs │ │ │ │ ├── util │ │ │ │ ├── cache.rs │ │ │ │ ├── fixed_cache.rs │ │ │ │ ├── history.rs │ │ │ │ ├── id_type_map.rs │ │ │ │ ├── mod.rs │ │ │ │ └── undoer.rs │ │ │ │ ├── widget_text.rs │ │ │ │ └── widgets │ │ │ │ ├── button.rs │ │ │ │ ├── color_picker.rs │ │ │ │ ├── drag_value.rs │ │ │ │ ├── hyperlink.rs │ │ │ │ ├── image.rs │ │ │ │ ├── label.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── plot │ │ │ │ ├── items │ │ │ │ │ ├── bar.rs │ │ │ │ │ ├── box_elem.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── rect_elem.rs │ │ │ │ │ └── values.rs │ │ │ │ ├── legend.rs │ │ │ │ ├── mod.rs │ │ │ │ └── transform.rs │ │ │ │ ├── progress_bar.rs │ │ │ │ ├── selected_label.rs │ │ │ │ ├── separator.rs │ │ │ │ ├── slider.rs │ │ │ │ ├── spinner.rs │ │ │ │ └── text_edit │ │ │ │ ├── builder.rs │ │ │ │ ├── cursor_range.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── output.rs │ │ │ │ ├── state.rs │ │ │ │ └── text_buffer.rs │ │ ├── egui_demo_app │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── apps │ │ │ │ ├── custom3d_glow.rs │ │ │ │ ├── custom3d_wgpu.rs │ │ │ │ ├── custom3d_wgpu_shader.wgsl │ │ │ │ ├── fractal_clock.rs │ │ │ │ ├── http_app.rs │ │ │ │ └── mod.rs │ │ │ │ ├── backend_panel.rs │ │ │ │ ├── frame_history.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── main.rs │ │ │ │ └── wrap_app.rs │ │ ├── egui_demo_lib │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── benches │ │ │ │ └── benchmark.rs │ │ │ └── src │ │ │ │ ├── color_test.rs │ │ │ │ ├── demo │ │ │ │ ├── about.rs │ │ │ │ ├── code_editor.rs │ │ │ │ ├── code_example.rs │ │ │ │ ├── context_menu.rs │ │ │ │ ├── dancing_strings.rs │ │ │ │ ├── demo_app_windows.rs │ │ │ │ ├── drag_and_drop.rs │ │ │ │ ├── font_book.rs │ │ │ │ ├── layout_test.rs │ │ │ │ ├── misc_demo_window.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── multi_touch.rs │ │ │ │ ├── paint_bezier.rs │ │ │ │ ├── painting.rs │ │ │ │ ├── password.rs │ │ │ │ ├── plot_demo.rs │ │ │ │ ├── scrolling.rs │ │ │ │ ├── sliders.rs │ │ │ │ ├── strip_demo.rs │ │ │ │ ├── table_demo.rs │ │ │ │ ├── tests.rs │ │ │ │ ├── text_edit.rs │ │ │ │ ├── toggle_switch.rs │ │ │ │ ├── widget_gallery.rs │ │ │ │ ├── window_options.rs │ │ │ │ └── window_with_panels.rs │ │ │ │ ├── easy_mark │ │ │ │ ├── easy_mark_editor.rs │ │ │ │ ├── easy_mark_highlighter.rs │ │ │ │ ├── easy_mark_parser.rs │ │ │ │ ├── easy_mark_viewer.rs │ │ │ │ └── mod.rs │ │ │ │ ├── lib.rs │ │ │ │ └── syntax_highlighting.rs │ │ ├── egui_extras │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── datepicker │ │ │ │ ├── button.rs │ │ │ │ ├── mod.rs │ │ │ │ └── popup.rs │ │ │ │ ├── image.rs │ │ │ │ ├── layout.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── sizing.rs │ │ │ │ ├── strip.rs │ │ │ │ └── table.rs │ │ ├── egui_glium │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ ├── native_texture.rs │ │ │ │ └── pure_glium.rs │ │ │ └── src │ │ │ │ ├── lib.rs │ │ │ │ ├── painter.rs │ │ │ │ └── shader │ │ │ │ ├── fragment_100es.glsl │ │ │ │ ├── fragment_120.glsl │ │ │ │ ├── fragment_140.glsl │ │ │ │ ├── fragment_300es.glsl │ │ │ │ ├── vertex_100es.glsl │ │ │ │ ├── vertex_120.glsl │ │ │ │ ├── vertex_140.glsl │ │ │ │ └── vertex_300es.glsl │ │ ├── egui_glow │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ └── pure_glow.rs │ │ │ └── src │ │ │ │ ├── lib.rs │ │ │ │ ├── misc_util.rs │ │ │ │ ├── painter.rs │ │ │ │ ├── post_process.rs │ │ │ │ ├── shader │ │ │ │ ├── fragment.glsl │ │ │ │ ├── post_fragment_100es.glsl │ │ │ │ ├── post_vertex_100es.glsl │ │ │ │ ├── vertex.glsl │ │ │ │ └── vertex_ttsim.glsl │ │ │ │ ├── shader_version.rs │ │ │ │ ├── vao.rs │ │ │ │ └── winit.rs │ │ ├── egui_web │ │ │ ├── CHANGELOG.md │ │ │ └── README.md │ │ ├── emath │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── align.rs │ │ │ │ ├── lib.rs │ │ │ │ ├── numeric.rs │ │ │ │ ├── pos2.rs │ │ │ │ ├── rect.rs │ │ │ │ ├── rect_transform.rs │ │ │ │ ├── rot2.rs │ │ │ │ ├── smart_aim.rs │ │ │ │ └── vec2.rs │ │ └── epaint │ │ │ ├── CHANGELOG.md │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── benches │ │ │ └── benchmark.rs │ │ │ ├── fonts │ │ │ ├── Hack-Regular.ttf │ │ │ ├── Hack-Regular.txt │ │ │ ├── NotoEmoji-Regular.ttf │ │ │ ├── OFL.txt │ │ │ ├── UFL.txt │ │ │ ├── Ubuntu-Light.ttf │ │ │ ├── emoji-icon-font-mit-license.txt │ │ │ ├── emoji-icon-font.ttf │ │ │ └── list_fonts.py │ │ │ └── src │ │ │ ├── bezier.rs │ │ │ ├── color.rs │ │ │ ├── image.rs │ │ │ ├── lib.rs │ │ │ ├── mesh.rs │ │ │ ├── mutex.rs │ │ │ ├── shadow.rs │ │ │ ├── shape.rs │ │ │ ├── shape_transform.rs │ │ │ ├── stats.rs │ │ │ ├── stroke.rs │ │ │ ├── tessellator.rs │ │ │ ├── text │ │ │ ├── cursor.rs │ │ │ ├── font.rs │ │ │ ├── fonts.rs │ │ │ ├── mod.rs │ │ │ ├── text_layout.rs │ │ │ └── text_layout_types.rs │ │ │ ├── texture_atlas.rs │ │ │ ├── texture_handle.rs │ │ │ ├── textures.rs │ │ │ └── util │ │ │ ├── mod.rs │ │ │ └── ordered_float.rs │ ├── deny.toml │ ├── docs │ │ ├── CNAME │ │ ├── README.md │ │ ├── egui_demo_app.js │ │ ├── egui_demo_app_bg.wasm │ │ ├── example.html │ │ ├── favicon.ico │ │ ├── index.html │ │ └── multiple_apps.html │ ├── examples │ │ ├── README.md │ │ ├── confirm_exit │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_3d_glow │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_3d_three-d │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ ├── index.html │ │ │ └── src │ │ │ │ ├── lib.rs │ │ │ │ └── main.rs │ │ ├── custom_font │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_font_style │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── custom_window_frame │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── download_image │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── file_dialog │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── hello_world │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── puffin_profiler │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── retained_image │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ ├── main.rs │ │ │ │ ├── rust-logo-256x256.png │ │ │ │ └── rust-logo-license.txt │ │ ├── screenshot │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── serial_windows │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ │ └── main.rs │ │ └── svg │ │ │ ├── Cargo.toml │ │ │ ├── README.md │ │ │ └── src │ │ │ ├── main.rs │ │ │ ├── rust-logo-license.txt │ │ │ └── rustacean-flat-happy.svg │ ├── rust-toolchain │ └── sh │ │ ├── build_demo_web.sh │ │ ├── check.sh │ │ ├── docs.sh │ │ ├── find_bloat.sh │ │ ├── setup_web.sh │ │ ├── start_server.sh │ │ ├── wasm_bindgen_check.sh │ │ └── wasm_size.sh ├── glutin-kms │ ├── .gitattributes │ ├── .github │ │ ├── PULL_REQUEST_TEMPLATE.md │ │ └── workflows │ │ │ ├── ci.yml │ │ │ └── publish.yml │ ├── .gitignore │ ├── .gitmodules │ ├── CHANGELOG.md │ ├── Cargo.toml │ ├── FORK.md │ ├── ISSUES.md │ ├── LICENSE │ ├── README.md │ ├── glutin │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ └── src │ │ │ ├── api │ │ │ ├── dlloader.rs │ │ │ ├── egl │ │ │ │ ├── make_current_guard.rs │ │ │ │ └── mod.rs │ │ │ ├── glx │ │ │ │ ├── make_current_guard.rs │ │ │ │ └── mod.rs │ │ │ ├── ios │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── osmesa │ │ │ │ └── mod.rs │ │ │ └── wgl │ │ │ │ ├── make_current_guard.rs │ │ │ │ └── mod.rs │ │ │ ├── context.rs │ │ │ ├── lib.rs │ │ │ ├── platform │ │ │ ├── android.rs │ │ │ ├── ios.rs │ │ │ ├── macos.rs │ │ │ ├── mod.rs │ │ │ ├── unix.rs │ │ │ └── windows.rs │ │ │ ├── platform_impl │ │ │ ├── android │ │ │ │ └── mod.rs │ │ │ ├── ios │ │ │ │ └── mod.rs │ │ │ ├── macos │ │ │ │ ├── helpers.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── unix │ │ │ │ ├── fbdev.rs │ │ │ │ ├── kms.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── wayland.rs │ │ │ │ ├── x11.rs │ │ │ │ └── x11 │ │ │ │ │ └── utils.rs │ │ │ └── windows │ │ │ │ └── mod.rs │ │ │ └── windowed.rs │ ├── glutin_egl_sys │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── build.rs │ │ └── src │ │ │ └── lib.rs │ ├── glutin_examples │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── build.rs │ │ ├── examples │ │ │ ├── buffer_age.rs │ │ │ ├── damage.rs │ │ │ ├── fullscreen.rs │ │ │ ├── headless.rs │ │ │ ├── multiwindow.rs │ │ │ ├── raw_context.rs │ │ │ ├── sharing.rs │ │ │ ├── support │ │ │ │ └── mod.rs │ │ │ ├── transparent.rs │ │ │ └── window.rs │ │ └── ios-example │ │ │ ├── .gitignore │ │ │ ├── GlutinExample.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── GlutinExample │ │ │ ├── Info.plist │ │ │ └── main.m │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ └── rust │ │ │ ├── .gitignore │ │ │ ├── Cargo.toml │ │ │ ├── Makefile │ │ │ ├── build.rs │ │ │ ├── glutin_ios_example.h │ │ │ ├── rust_logo.png │ │ │ └── src │ │ │ └── lib.rs │ ├── glutin_gles2_sys │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── build.rs │ │ └── src │ │ │ └── lib.rs │ ├── glutin_glx_sys │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── build.rs │ │ └── src │ │ │ └── lib.rs │ ├── glutin_wgl_sys │ │ ├── Cargo.toml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── build.rs │ │ └── src │ │ │ └── lib.rs │ └── rustfmt.toml └── winit-kms │ ├── .cargo │ └── config.toml │ ├── .gitattributes │ ├── .github │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── ci.yml │ │ └── publish.yml │ ├── .gitignore │ ├── .gitmodules │ ├── .idea │ ├── .gitignore │ ├── modules.xml │ ├── vcs.xml │ └── winit-kms.iml │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── Cargo.toml │ ├── FEATURES.md │ ├── FORK.md │ ├── HALL_OF_CHAMPIONS.md │ ├── LICENSE │ ├── README.md │ ├── examples │ ├── control_flow.rs │ ├── cursor.rs │ ├── cursor_grab.rs │ ├── custom_events.rs │ ├── drag_window.rs │ ├── fullscreen.rs │ ├── handling_close.rs │ ├── icon.png │ ├── ime.rs │ ├── min_max_size.rs │ ├── minimize.rs │ ├── monitor_list.rs │ ├── mouse_wheel.rs │ ├── multithreaded.rs │ ├── multiwindow.rs │ ├── request_redraw.rs │ ├── request_redraw_threaded.rs │ ├── resizable.rs │ ├── timer.rs │ ├── transparent.rs │ ├── video_modes.rs │ ├── web.rs │ ├── window.rs │ ├── window_debug.rs │ ├── window_icon.rs │ └── window_run_return.rs │ ├── run-wasm │ ├── Cargo.toml │ └── src │ │ └── main.rs │ ├── rustfmt.toml │ ├── src │ ├── dpi.rs │ ├── error.rs │ ├── event.rs │ ├── event_loop.rs │ ├── icon.rs │ ├── lib.rs │ ├── monitor.rs │ ├── platform │ │ ├── android.rs │ │ ├── ios.rs │ │ ├── macos.rs │ │ ├── mod.rs │ │ ├── run_return.rs │ │ ├── unix.rs │ │ ├── web.rs │ │ └── windows.rs │ ├── platform_impl │ │ ├── android │ │ │ └── mod.rs │ │ ├── ios │ │ │ ├── app_state.rs │ │ │ ├── event_loop.rs │ │ │ ├── ffi.rs │ │ │ ├── mod.rs │ │ │ ├── monitor.rs │ │ │ ├── view.rs │ │ │ └── window.rs │ │ ├── linux │ │ │ ├── fbdev │ │ │ │ ├── event_loop.rs │ │ │ │ ├── input.rs │ │ │ │ ├── mod.rs │ │ │ │ └── window.rs │ │ │ ├── kms │ │ │ │ ├── event_loop.rs │ │ │ │ ├── input.rs │ │ │ │ ├── mod.rs │ │ │ │ └── window.rs │ │ │ ├── mod.rs │ │ │ ├── wayland │ │ │ │ ├── env.rs │ │ │ │ ├── event_loop │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── proxy.rs │ │ │ │ │ ├── sink.rs │ │ │ │ │ └── state.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── output.rs │ │ │ │ ├── seat │ │ │ │ │ ├── keyboard │ │ │ │ │ │ ├── handlers.rs │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── pointer │ │ │ │ │ │ ├── data.rs │ │ │ │ │ │ ├── handlers.rs │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── text_input │ │ │ │ │ │ ├── handlers.rs │ │ │ │ │ │ └── mod.rs │ │ │ │ │ └── touch │ │ │ │ │ │ ├── handlers.rs │ │ │ │ │ │ └── mod.rs │ │ │ │ └── window │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── shim.rs │ │ │ ├── x11 │ │ │ │ ├── dnd.rs │ │ │ │ ├── event_processor.rs │ │ │ │ ├── events.rs │ │ │ │ ├── ffi.rs │ │ │ │ ├── ime │ │ │ │ │ ├── callbacks.rs │ │ │ │ │ ├── context.rs │ │ │ │ │ ├── inner.rs │ │ │ │ │ ├── input_method.rs │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── monitor.rs │ │ │ │ ├── util │ │ │ │ │ ├── atom.rs │ │ │ │ │ ├── client_msg.rs │ │ │ │ │ ├── cursor.rs │ │ │ │ │ ├── format.rs │ │ │ │ │ ├── geometry.rs │ │ │ │ │ ├── hint.rs │ │ │ │ │ ├── icon.rs │ │ │ │ │ ├── input.rs │ │ │ │ │ ├── keys.rs │ │ │ │ │ ├── memory.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── modifiers.rs │ │ │ │ │ ├── randr.rs │ │ │ │ │ ├── window_property.rs │ │ │ │ │ └── wm.rs │ │ │ │ ├── window.rs │ │ │ │ └── xdisplay.rs │ │ │ └── xkb_keymap.rs │ │ ├── macos │ │ │ ├── app.rs │ │ │ ├── app_delegate.rs │ │ │ ├── app_state.rs │ │ │ ├── event.rs │ │ │ ├── event_loop.rs │ │ │ ├── ffi.rs │ │ │ ├── menu.rs │ │ │ ├── mod.rs │ │ │ ├── monitor.rs │ │ │ ├── observer.rs │ │ │ ├── util │ │ │ │ ├── async.rs │ │ │ │ ├── cursor.rs │ │ │ │ └── mod.rs │ │ │ ├── view.rs │ │ │ ├── window.rs │ │ │ └── window_delegate.rs │ │ ├── mod.rs │ │ ├── web │ │ │ ├── device.rs │ │ │ ├── error.rs │ │ │ ├── event_loop │ │ │ │ ├── mod.rs │ │ │ │ ├── proxy.rs │ │ │ │ ├── runner.rs │ │ │ │ ├── state.rs │ │ │ │ └── window_target.rs │ │ │ ├── mod.rs │ │ │ ├── monitor.rs │ │ │ ├── web_sys │ │ │ │ ├── canvas.rs │ │ │ │ ├── canvas │ │ │ │ │ ├── mouse_handler.rs │ │ │ │ │ └── pointer_handler.rs │ │ │ │ ├── event.rs │ │ │ │ ├── event_handle.rs │ │ │ │ ├── media_query_handle.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── scaling.rs │ │ │ │ └── timeout.rs │ │ │ └── window.rs │ │ └── windows │ │ │ ├── dark_mode.rs │ │ │ ├── definitions.rs │ │ │ ├── dpi.rs │ │ │ ├── drop_handler.rs │ │ │ ├── event.rs │ │ │ ├── event_loop.rs │ │ │ ├── event_loop │ │ │ └── runner.rs │ │ │ ├── icon.rs │ │ │ ├── ime.rs │ │ │ ├── mod.rs │ │ │ ├── monitor.rs │ │ │ ├── raw_input.rs │ │ │ ├── util.rs │ │ │ ├── window.rs │ │ │ └── window_state.rs │ └── window.rs │ └── tests │ ├── send_objects.rs │ ├── serde_objects.rs │ └── sync_object.rs └── src └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /target 3 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tt" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | #egui = "0.19.0" 10 | #eframe = "0.19.0" 11 | egui = { path = 'lib/egui/crates/egui' } 12 | eframe = { path = 'lib/egui/crates/eframe' } 13 | 14 | # Lock winit, glutin and raw-window-handle to patch versions 15 | raw-window-handle = "0.4.3" 16 | #raw-window-handle = { version = "0.4.3", git = "https://github.com/rust-windowing/raw-window-handle", rev = "3290a311a6f80b3629bd42cf077b470744596e3a" } 17 | #raw-window-handle = { git = "https://github.com/rust-windowing/raw-window-handle", rev = "3290a311a6f80b3629bd42cf077b470744596e3a" } 18 | 19 | [patch.crates-io] 20 | winit = { path = 'lib/winit-kms' } 21 | glutin = { path = 'lib/glutin-kms/glutin' } 22 | raw-window-handle = { git = 'https://github.com/rust-windowing/raw-window-handle.git', rev = '3290a311a6f80b3629bd42cf077b470744596e3a' } 23 | 24 | [patch.'https://github.com/rust-windowing/raw-window-handle'] 25 | # https://github.com/rust-lang/cargo/issues/5478 26 | raw-window-handle = { git = 'https://github.com/rust-windowing//raw-window-handle.git', rev = '3290a311a6f80b3629bd42cf077b470744596e3a' } 27 | 28 | [patch.'https://github.com/StratusFearMe21/winit'] 29 | winit = { path = 'lib/winit-kms' } 30 | -------------------------------------------------------------------------------- /branding/demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/branding/demo.jpg -------------------------------------------------------------------------------- /lib/egui-bleeding/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature-request 6 | assignees: '' 7 | 8 | --- 9 | 10 | 13 | 14 | 15 | **Is your feature request related to a problem? Please describe.** 16 | 17 | 18 | **Describe the solution you'd like** 19 | 20 | 21 | **Describe alternatives you've considered** 22 | 23 | 24 | **Additional context** 25 | 26 | -------------------------------------------------------------------------------- /lib/egui-bleeding/.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: For issues that are neither bugs or feature requests 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | If you are asking a question, use [the egui discussions forum](https://github.com/emilk/egui/discussions/categories/q-a) instead! 11 | -------------------------------------------------------------------------------- /lib/egui-bleeding/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 14 | 15 | Closes . 16 | -------------------------------------------------------------------------------- /lib/egui-bleeding/.gitignore: -------------------------------------------------------------------------------- 1 | **/target 2 | /.*.json 3 | /.vscode 4 | /media/* 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /lib/egui-bleeding/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = [ 4 | "crates/egui_demo_app", 5 | "crates/egui_demo_lib", 6 | "crates/egui_extras", 7 | "crates/egui_glium", 8 | "crates/egui_glow", 9 | "crates/egui-wgpu", 10 | "crates/egui-winit", 11 | "crates/egui", 12 | "crates/emath", 13 | "crates/epaint", 14 | 15 | "examples/*", 16 | ] 17 | 18 | [profile.dev] 19 | split-debuginfo = "unpacked" # faster debug builds on mac 20 | 21 | [profile.release] 22 | # lto = true # VERY slightly smaller wasm 23 | # opt-level = 's' # 10-20% smaller wasm compared to `opt-level = 3` 24 | # opt-level = 1 # very slow and big wasm. Don't do this. 25 | opt-level = 2 # fast and small wasm, basically same as `opt-level = 's'` 26 | # opt-level = 3 # unecessarily large wasm for no performance gain 27 | 28 | # debug = true # include debug symbols, useful when profiling wasm 29 | -------------------------------------------------------------------------------- /lib/egui-bleeding/FORK.md: -------------------------------------------------------------------------------- 1 | Forked from: https://github.com/emilk/egui at commit 1fadc7396a1871ca9e73894f72cc478d79cd402e 2 | 3 | Currently not used 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2021 Emil Ernerfeldt 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/eframe/src/native/mod.rs: -------------------------------------------------------------------------------- 1 | mod epi_integration; 2 | pub mod run; 3 | 4 | /// File storage which can be used by native backends. 5 | #[cfg(feature = "persistence")] 6 | pub mod file_storage; 7 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/eframe/src/web/screen_reader.rs: -------------------------------------------------------------------------------- 1 | pub struct ScreenReader { 2 | #[cfg(feature = "tts")] 3 | tts: Option, 4 | } 5 | 6 | #[cfg(not(feature = "tts"))] 7 | #[allow(clippy::derivable_impls)] // False positive 8 | impl Default for ScreenReader { 9 | fn default() -> Self { 10 | Self {} 11 | } 12 | } 13 | 14 | #[cfg(feature = "tts")] 15 | impl Default for ScreenReader { 16 | fn default() -> Self { 17 | let tts = match tts::Tts::default() { 18 | Ok(screen_reader) => { 19 | tracing::debug!("Initialized screen reader."); 20 | Some(screen_reader) 21 | } 22 | Err(err) => { 23 | tracing::warn!("Failed to load screen reader: {}", err); 24 | None 25 | } 26 | }; 27 | Self { tts } 28 | } 29 | } 30 | 31 | impl ScreenReader { 32 | #[cfg(not(feature = "tts"))] 33 | #[allow(clippy::unused_self)] 34 | pub fn speak(&mut self, _text: &str) {} 35 | 36 | #[cfg(feature = "tts")] 37 | pub fn speak(&mut self, text: &str) { 38 | if text.is_empty() { 39 | return; 40 | } 41 | if let Some(tts) = &mut self.tts { 42 | tracing::debug!("Speaking: {:?}", text); 43 | let interrupt = true; 44 | if let Err(err) = tts.speak(text, interrupt) { 45 | tracing::warn!("Failed to read: {}", err); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/eframe/src/web/storage.rs: -------------------------------------------------------------------------------- 1 | fn local_storage() -> Option { 2 | web_sys::window()?.local_storage().ok()? 3 | } 4 | 5 | pub fn local_storage_get(key: &str) -> Option { 6 | local_storage().map(|storage| storage.get_item(key).ok())?? 7 | } 8 | 9 | pub fn local_storage_set(key: &str, value: &str) { 10 | local_storage().map(|storage| storage.set_item(key, value)); 11 | } 12 | 13 | #[cfg(feature = "persistence")] 14 | pub fn load_memory(ctx: &egui::Context) { 15 | if let Some(memory_string) = local_storage_get("egui_memory_ron") { 16 | match ron::from_str(&memory_string) { 17 | Ok(memory) => { 18 | *ctx.memory() = memory; 19 | } 20 | Err(err) => { 21 | tracing::error!("Failed to parse memory RON: {}", err); 22 | } 23 | } 24 | } 25 | } 26 | 27 | #[cfg(not(feature = "persistence"))] 28 | pub fn load_memory(_: &egui::Context) {} 29 | 30 | #[cfg(feature = "persistence")] 31 | pub fn save_memory(ctx: &egui::Context) { 32 | match ron::to_string(&*ctx.memory()) { 33 | Ok(ron) => { 34 | local_storage_set("egui_memory_ron", &ron); 35 | } 36 | Err(err) => { 37 | tracing::error!("Failed to serialize memory as RON: {}", err); 38 | } 39 | } 40 | } 41 | 42 | #[cfg(not(feature = "persistence"))] 43 | pub fn save_memory(_: &egui::Context) {} 44 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/eframe/src/web/web_painter.rs: -------------------------------------------------------------------------------- 1 | use egui::Rgba; 2 | use wasm_bindgen::JsValue; 3 | 4 | /// Renderer for a browser canvas. 5 | /// As of writing we're not allowing to decide on the painter at runtime, 6 | /// therefore this trait is merely there for specifying and documenting the interface. 7 | pub(crate) trait WebPainter { 8 | // Create a new web painter targeting a given canvas. 9 | // fn new(canvas_id: &str, options: &WebOptions) -> Result 10 | // where 11 | // Self: Sized; 12 | 13 | /// Id of the canvas in use. 14 | fn canvas_id(&self) -> &str; 15 | 16 | /// Maximum size of a texture in one direction. 17 | fn max_texture_side(&self) -> usize; 18 | 19 | /// Update all internal textures and paint gui. 20 | fn paint_and_update_textures( 21 | &mut self, 22 | clear_color: Rgba, 23 | clipped_primitives: &[egui::ClippedPrimitive], 24 | pixels_per_point: f32, 25 | textures_delta: &egui::TexturesDelta, 26 | ) -> Result<(), JsValue>; 27 | 28 | /// Destroy all resources. 29 | fn destroy(&mut self); 30 | } 31 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui-wgpu/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for egui-wgpu 2 | All notable changes to the `egui-wgpu` integration will be noted in this file. 3 | 4 | 5 | ## Unreleased 6 | * Renamed `RenderPass` to `Renderer`. 7 | * Renamed `RenderPass::execute` to `RenderPass::render`. 8 | * Renamed `RenderPass::execute_with_renderpass` to `Renderer::render` (replacing existing `Renderer::render`) 9 | * Reexported `Renderer`. 10 | * `Renderer` no longer handles pass creation and depth buffer creation ([#2136](https://github.com/emilk/egui/pull/2136)) 11 | * `PrepareCallback` now passes `wgpu::CommandEncoder` ([#2136](https://github.com/emilk/egui/pull/2136)) 12 | * Only a single vertex & index buffer is now created and resized when necessary (previously, vertex/index buffers were allocated for every mesh) ([#2148](https://github.com/emilk/egui/pull/2148)). 13 | 14 | ## 0.19.0 - 2022-08-20 15 | * Enables deferred render + surface state initialization for Android ([#1634](https://github.com/emilk/egui/pull/1634)). 16 | * Make `RenderPass` `Send` and `Sync` ([#1883](https://github.com/emilk/egui/pull/1883)). 17 | 18 | 19 | ## 0.18.0 - 2022-05-15 20 | First published version since moving the code into the `egui` repository from . 21 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui-wgpu/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "egui-wgpu" 3 | version = "0.19.0" 4 | description = "Bindings for using egui natively using the wgpu library" 5 | authors = [ 6 | "Nils Hasenbanck ", 7 | "embotech ", 8 | "Emil Ernerfeldt ", 9 | ] 10 | edition = "2021" 11 | rust-version = "1.61" 12 | homepage = "https://github.com/emilk/egui/tree/master/crates/egui-wgpu" 13 | license = "MIT OR Apache-2.0" 14 | readme = "README.md" 15 | repository = "https://github.com/emilk/egui/tree/master/crates/egui-wgpu" 16 | categories = ["gui", "game-development"] 17 | keywords = ["wgpu", "egui", "gui", "gamedev"] 18 | include = [ 19 | "../LICENSE-APACHE", 20 | "../LICENSE-MIT", 21 | "**/*.rs", 22 | "**/*.wgsl", 23 | "Cargo.toml", 24 | ] 25 | 26 | [package.metadata.docs.rs] 27 | all-features = true 28 | 29 | 30 | [features] 31 | ## Enable [`winit`](https://docs.rs/winit) integration. 32 | winit = ["dep:pollster", "dep:winit"] 33 | 34 | 35 | [dependencies] 36 | egui = { version = "0.19.0", path = "../egui", default-features = false, features = [ 37 | "bytemuck", 38 | ] } 39 | 40 | bytemuck = "1.7" 41 | tracing = { version = "0.1", default-features = false, features = ["std"] } 42 | type-map = "0.5.0" 43 | wgpu = "0.14" 44 | 45 | #! ### Optional dependencies 46 | ## Enable this when generating docs. 47 | document-features = { version = "0.2", optional = true } 48 | 49 | pollster = { version = "0.2", optional = true } 50 | winit = { version = "0.27.2", optional = true } 51 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui-wgpu/README.md: -------------------------------------------------------------------------------- 1 | # egui-wgpu 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui-wgpu.svg)](https://crates.io/crates/egui-wgpu) 4 | [![Documentation](https://docs.rs/egui-wgpu/badge.svg)](https://docs.rs/egui-wgpu) 5 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 6 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 7 | 8 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [wgpu](https://crates.io/crates/wgpu). 9 | 10 | This was originally hosted at https://github.com/hasenbanck/egui_wgpu_backend 11 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui-wgpu/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [wgpu](https://crates.io/crates/wgpu). 2 | //! 3 | //! ## Feature flags 4 | #![cfg_attr(feature = "document-features", doc = document_features::document_features!())] 5 | //! 6 | 7 | #![allow(unsafe_code)] 8 | 9 | pub use wgpu; 10 | 11 | /// Low-level painting of [`egui`] on [`wgpu`]. 12 | pub mod renderer; 13 | pub use renderer::CallbackFn; 14 | pub use renderer::Renderer; 15 | 16 | /// Module for painting [`egui`] with [`wgpu`] on [`winit`]. 17 | #[cfg(feature = "winit")] 18 | pub mod winit; 19 | 20 | use egui::mutex::RwLock; 21 | use std::sync::Arc; 22 | 23 | /// Access to the render state for egui, which can be useful in combination with 24 | /// [`egui::PaintCallback`]s for custom rendering using WGPU. 25 | #[derive(Clone)] 26 | pub struct RenderState { 27 | pub device: Arc, 28 | pub queue: Arc, 29 | pub target_format: wgpu::TextureFormat, 30 | pub renderer: Arc>, 31 | } 32 | 33 | /// Find the framebuffer format that egui prefers 34 | pub fn preferred_framebuffer_format(formats: &[wgpu::TextureFormat]) -> wgpu::TextureFormat { 35 | for &format in formats { 36 | if matches!( 37 | format, 38 | wgpu::TextureFormat::Rgba8Unorm | wgpu::TextureFormat::Bgra8Unorm 39 | ) { 40 | return format; 41 | } 42 | } 43 | formats[0] // take the first 44 | } 45 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui-winit/README.md: -------------------------------------------------------------------------------- 1 | # egui-winit 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui-winit.svg)](https://crates.io/crates/egui-winit) 4 | [![Documentation](https://docs.rs/egui-winit/badge.svg)](https://docs.rs/egui-winit) 5 | [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) 6 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 7 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 8 | 9 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [`winit`](https://crates.io/crates/winit). 10 | 11 | The library translates winit events to egui, handled copy/paste, updates the cursor, open links clicked in egui, etc. 12 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui-winit/src/screen_reader.rs: -------------------------------------------------------------------------------- 1 | pub struct ScreenReader { 2 | #[cfg(feature = "tts")] 3 | tts: Option, 4 | } 5 | 6 | #[cfg(not(feature = "tts"))] 7 | #[allow(clippy::derivable_impls)] // False positive 8 | impl Default for ScreenReader { 9 | fn default() -> Self { 10 | Self {} 11 | } 12 | } 13 | 14 | #[cfg(feature = "tts")] 15 | impl Default for ScreenReader { 16 | fn default() -> Self { 17 | let tts = match tts::Tts::default() { 18 | Ok(screen_reader) => { 19 | tracing::debug!("Initialized screen reader."); 20 | Some(screen_reader) 21 | } 22 | Err(err) => { 23 | tracing::warn!("Failed to load screen reader: {}", err); 24 | None 25 | } 26 | }; 27 | Self { tts } 28 | } 29 | } 30 | 31 | impl ScreenReader { 32 | #[cfg(not(feature = "tts"))] 33 | #[allow(clippy::unused_self)] 34 | pub fn speak(&mut self, _text: &str) {} 35 | 36 | #[cfg(feature = "tts")] 37 | pub fn speak(&mut self, text: &str) { 38 | if text.is_empty() { 39 | return; 40 | } 41 | if let Some(tts) = &mut self.tts { 42 | tracing::debug!("Speaking: {:?}", text); 43 | let interrupt = true; 44 | if let Err(err) = tts.speak(text, interrupt) { 45 | tracing::warn!("Failed to read: {}", err); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/README.md: -------------------------------------------------------------------------------- 1 | # GUI implementation 2 | This is the core library crate egui. It is fully platform independent without any backend. You give the egui library input each frame (mouse pos etc), and it outputs a triangle mesh for you to paint. 3 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/examples/README.md: -------------------------------------------------------------------------------- 1 | There are no stand-alone egui examples, because egui is not stand-alone! 2 | 3 | See the top-level [examples](https://github.com/emilk/egui/tree/master/examples/) folder instead. 4 | 5 | There are also plenty of examples in [the online demo](https://www.egui.rs/#demo). You can find the source code for it at . 6 | 7 | To learn how to set up `eframe` for web and native, go to and follow the instructions there! 8 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/src/containers/mod.rs: -------------------------------------------------------------------------------- 1 | //! Containers are pieces of the UI which wraps other pieces of UI. Examples: [`Window`], [`ScrollArea`], [`Resize`], [`SidePanel`], etc. 2 | //! 3 | //! For instance, a [`Frame`] adds a frame and background to some contained UI. 4 | 5 | pub(crate) mod area; 6 | pub mod collapsing_header; 7 | mod combo_box; 8 | pub(crate) mod frame; 9 | pub mod panel; 10 | pub mod popup; 11 | pub(crate) mod resize; 12 | pub mod scroll_area; 13 | pub(crate) mod window; 14 | 15 | pub use { 16 | area::Area, 17 | collapsing_header::{CollapsingHeader, CollapsingResponse}, 18 | combo_box::*, 19 | frame::Frame, 20 | panel::{CentralPanel, SidePanel, TopBottomPanel}, 21 | popup::*, 22 | resize::Resize, 23 | scroll_area::ScrollArea, 24 | window::Window, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/src/data/mod.rs: -------------------------------------------------------------------------------- 1 | //! All the data sent between egui and the backend 2 | 3 | pub mod input; 4 | pub mod output; 5 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/src/util/fixed_cache.rs: -------------------------------------------------------------------------------- 1 | use epaint::util::hash; 2 | 3 | const FIXED_CACHE_SIZE: usize = 1024; // must be small for web/WASM build (for unknown reason) 4 | 5 | /// Very stupid/simple key-value cache. TODO(emilk): improve 6 | #[derive(Clone)] 7 | pub(crate) struct FixedCache([Option<(K, V)>; FIXED_CACHE_SIZE]); 8 | 9 | impl Default for FixedCache 10 | where 11 | K: Copy, 12 | V: Copy, 13 | { 14 | fn default() -> Self { 15 | Self([None; FIXED_CACHE_SIZE]) 16 | } 17 | } 18 | 19 | impl std::fmt::Debug for FixedCache { 20 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 21 | write!(f, "Cache") 22 | } 23 | } 24 | 25 | impl FixedCache 26 | where 27 | K: std::hash::Hash + PartialEq, 28 | { 29 | pub fn get(&self, key: &K) -> Option<&V> { 30 | let bucket = (hash(key) % (FIXED_CACHE_SIZE as u64)) as usize; 31 | match &self.0[bucket] { 32 | Some((k, v)) if k == key => Some(v), 33 | _ => None, 34 | } 35 | } 36 | 37 | pub fn set(&mut self, key: K, value: V) { 38 | let bucket = (hash(&key) % (FIXED_CACHE_SIZE as u64)) as usize; 39 | self.0[bucket] = Some((key, value)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/src/util/mod.rs: -------------------------------------------------------------------------------- 1 | //! Miscellaneous tools used by the rest of egui. 2 | 3 | pub mod cache; 4 | pub(crate) mod fixed_cache; 5 | mod history; 6 | pub mod id_type_map; 7 | pub mod undoer; 8 | 9 | pub use history::History; 10 | pub use id_type_map::IdTypeMap; 11 | 12 | pub use epaint::util::{hash, hash_with}; 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/src/widgets/text_edit/mod.rs: -------------------------------------------------------------------------------- 1 | mod builder; 2 | mod cursor_range; 3 | mod output; 4 | mod state; 5 | mod text_buffer; 6 | 7 | pub use { 8 | builder::TextEdit, cursor_range::*, output::TextEditOutput, state::TextEditState, 9 | text_buffer::TextBuffer, 10 | }; 11 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui/src/widgets/text_edit/output.rs: -------------------------------------------------------------------------------- 1 | use std::sync::Arc; 2 | 3 | /// The output from a [`TextEdit`](crate::TextEdit). 4 | pub struct TextEditOutput { 5 | /// The interaction response. 6 | pub response: crate::Response, 7 | 8 | /// How the text was displayed. 9 | pub galley: Arc, 10 | 11 | /// Where the text in [`Self::galley`] ended up on the screen. 12 | pub text_draw_pos: crate::Pos2, 13 | 14 | /// The text was clipped to this rectangle when painted. 15 | pub text_clip_rect: crate::Rect, 16 | 17 | /// The state we stored after the run. 18 | pub state: super::TextEditState, 19 | 20 | /// Where the text cursor is. 21 | pub cursor_range: Option, 22 | } 23 | 24 | // TODO(emilk): add `output.paint` and `output.store` and split out that code from `TextEdit::show`. 25 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_demo_app/README.md: -------------------------------------------------------------------------------- 1 | # egui demo app 2 | This app demonstrates [`egui`](https://github.com/emilk/egui/) and [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe). 3 | 4 | View the demo app online at . 5 | 6 | Run it locally with `cargo run --release -p egui_demo_app`. 7 | 8 | `egui_demo_app` can be compiled to WASM and viewed in a browser locally with: 9 | 10 | ```sh 11 | ./sh/start_server.sh & 12 | ./sh/build_demo_web.sh --open 13 | ``` 14 | 15 | `egui_demo_app` uses [`egui_demo_lib`](https://github.com/emilk/egui/tree/master/crates/egui_demo_lib). 16 | 17 | 18 | ## Running with `wgpu` backend 19 | `(cd egui_demo_app && cargo r --features wgpu)` 20 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_demo_app/src/apps/custom3d_wgpu_shader.wgsl: -------------------------------------------------------------------------------- 1 | struct VertexOut { 2 | @location(0) color: vec4, 3 | @builtin(position) position: vec4, 4 | }; 5 | 6 | struct Uniforms { 7 | @size(16) angle: f32, // pad to 16 bytes 8 | }; 9 | 10 | @group(0) @binding(0) 11 | var uniforms: Uniforms; 12 | 13 | var v_positions: array, 3> = array, 3>( 14 | vec2(0.0, 1.0), 15 | vec2(1.0, -1.0), 16 | vec2(-1.0, -1.0), 17 | ); 18 | 19 | var v_colors: array, 3> = array, 3>( 20 | vec4(1.0, 0.0, 0.0, 1.0), 21 | vec4(0.0, 1.0, 0.0, 1.0), 22 | vec4(0.0, 0.0, 1.0, 1.0), 23 | ); 24 | 25 | @vertex 26 | fn vs_main(@builtin(vertex_index) v_idx: u32) -> VertexOut { 27 | var out: VertexOut; 28 | 29 | out.position = vec4(v_positions[v_idx], 0.0, 1.0); 30 | out.position.x = out.position.x * cos(uniforms.angle); 31 | out.color = v_colors[v_idx]; 32 | 33 | return out; 34 | } 35 | 36 | @fragment 37 | fn fs_main(in: VertexOut) -> @location(0) vec4 { 38 | return in.color; 39 | } 40 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_demo_app/src/apps/mod.rs: -------------------------------------------------------------------------------- 1 | #[cfg(all(feature = "glow", not(feature = "wgpu")))] 2 | mod custom3d_glow; 3 | 4 | #[cfg(feature = "wgpu")] 5 | mod custom3d_wgpu; 6 | 7 | mod fractal_clock; 8 | 9 | #[cfg(feature = "http")] 10 | mod http_app; 11 | 12 | #[cfg(all(feature = "glow", not(feature = "wgpu")))] 13 | pub use custom3d_glow::Custom3d; 14 | 15 | #[cfg(feature = "wgpu")] 16 | pub use custom3d_wgpu::Custom3d; 17 | 18 | pub use fractal_clock::FractalClock; 19 | 20 | #[cfg(feature = "http")] 21 | pub use http_app::HttpApp; 22 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_demo_app/src/main.rs: -------------------------------------------------------------------------------- 1 | //! Demo app for egui 2 | 3 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release 4 | 5 | // When compiling natively: 6 | fn main() { 7 | // Log to stdout (if you run with `RUST_LOG=debug`). 8 | tracing_subscriber::fmt::init(); 9 | 10 | let options = eframe::NativeOptions { 11 | drag_and_drop_support: true, 12 | 13 | initial_window_size: Some([1280.0, 1024.0].into()), 14 | 15 | #[cfg(feature = "wgpu")] 16 | renderer: eframe::Renderer::Wgpu, 17 | 18 | ..Default::default() 19 | }; 20 | eframe::run_native( 21 | "egui demo app", 22 | options, 23 | Box::new(|cc| Box::new(egui_demo_app::WrapApp::new(cc))), 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_demo_lib/README.md: -------------------------------------------------------------------------------- 1 | # [`egui`](https://github.com/emilk/egui) demo library 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_demo_lib.svg)](https://crates.io/crates/egui_demo_lib) 4 | [![Documentation](https://docs.rs/egui_demo_lib/badge.svg)](https://docs.rs/egui_demo_lib) 5 | [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) 6 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 7 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 8 | 9 | This crate contains example code for [`egui`](https://github.com/emilk/egui). 10 | 11 | The demo library is a separate crate for three reasons: 12 | 13 | * To ensure it only uses the public `egui` api. 14 | * To remove the amount of code in `egui` proper. 15 | * To make it easy for 3rd party egui integrations to use it for tests. 16 | - See for instance https://github.com/not-fl3/egui-miniquad/blob/master/examples/demo.rs 17 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_demo_lib/src/demo/mod.rs: -------------------------------------------------------------------------------- 1 | //! Demo-code for showing how egui is used. 2 | //! 3 | //! The demo-code is also used in benchmarks and tests. 4 | 5 | // ---------------------------------------------------------------------------- 6 | 7 | pub mod about; 8 | pub mod code_editor; 9 | pub mod code_example; 10 | pub mod context_menu; 11 | pub mod dancing_strings; 12 | pub mod demo_app_windows; 13 | pub mod drag_and_drop; 14 | pub mod font_book; 15 | pub mod layout_test; 16 | pub mod misc_demo_window; 17 | pub mod multi_touch; 18 | pub mod paint_bezier; 19 | pub mod painting; 20 | pub mod password; 21 | pub mod plot_demo; 22 | pub mod scrolling; 23 | pub mod sliders; 24 | pub mod strip_demo; 25 | pub mod table_demo; 26 | pub mod tests; 27 | pub mod text_edit; 28 | pub mod toggle_switch; 29 | pub mod widget_gallery; 30 | pub mod window_options; 31 | pub mod window_with_panels; 32 | 33 | pub use { 34 | about::About, demo_app_windows::DemoWindows, misc_demo_window::MiscDemoWindow, 35 | widget_gallery::WidgetGallery, 36 | }; 37 | 38 | // ---------------------------------------------------------------------------- 39 | 40 | /// Something to view in the demo windows 41 | pub trait View { 42 | fn ui(&mut self, ui: &mut egui::Ui); 43 | } 44 | 45 | /// Something to view 46 | pub trait Demo { 47 | /// `&'static` so we can also use it as a key to store open/close state. 48 | fn name(&self) -> &'static str; 49 | 50 | /// Show windows, etc 51 | fn show(&mut self, ctx: &egui::Context, open: &mut bool); 52 | } 53 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_demo_lib/src/easy_mark/mod.rs: -------------------------------------------------------------------------------- 1 | //! Experimental markup language 2 | 3 | mod easy_mark_editor; 4 | mod easy_mark_highlighter; 5 | pub mod easy_mark_parser; 6 | mod easy_mark_viewer; 7 | 8 | pub use easy_mark_editor::EasyMarkEditor; 9 | pub use easy_mark_highlighter::MemoizedEasymarkHighlighter; 10 | pub use easy_mark_parser as parser; 11 | pub use easy_mark_viewer::easy_mark; 12 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_extras/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for egui_extras 2 | All notable changes to the `egui_extras` integration will be noted in this file. 3 | 4 | 5 | ## Unreleased 6 | * Added `TableBuilder::vertical_scroll_offset`: method to set vertical scroll offset position for a table ([#1946](https://github.com/emilk/egui/pull/1946)). 7 | 8 | ## 0.19.0 - 2022-08-20 9 | * MSRV (Minimum Supported Rust Version) is now `1.61.0` ([#1846](https://github.com/emilk/egui/pull/1846)). 10 | * You can now specify a texture filter for `RetainedImage` ([#1636](https://github.com/emilk/egui/pull/1636)). 11 | * Fixed uneven `Table` striping ([#1680](https://github.com/emilk/egui/pull/1680)). 12 | 13 | 14 | ## 0.18.0 - 2022-04-30 15 | * Added `Strip`, `Table` and `DatePicker` ([#963](https://github.com/emilk/egui/pull/963)). 16 | * MSRV (Minimum Supported Rust Version) is now `1.60.0` ([#1467](https://github.com/emilk/egui/pull/1467)). 17 | * Renamed feature "persistence" to "serde" ([#1540](https://github.com/emilk/egui/pull/1540)). 18 | 19 | 20 | ## 0.17.0 - 2022-02-22 21 | * `RetainedImage`: convenience for loading svg, png, jpeg etc and showing them in egui. 22 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_extras/README.md: -------------------------------------------------------------------------------- 1 | # egui_extras 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_extras.svg)](https://crates.io/crates/egui_extras) 4 | [![Documentation](https://docs.rs/egui_extras/badge.svg)](https://docs.rs/egui_extras) 5 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 6 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 7 | 8 | This is a crate that adds some features on top top of [`egui`](https://github.com/emilk/egui). This crate is for experimental features, and features that require big dependencies that do not belong in `egui`. 9 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_extras/src/datepicker/mod.rs: -------------------------------------------------------------------------------- 1 | mod button; 2 | mod popup; 3 | 4 | pub use button::DatePickerButton; 5 | use chrono::{Date, Datelike, Duration, NaiveDate, Utc, Weekday}; 6 | 7 | #[derive(Debug)] 8 | struct Week { 9 | number: u8, 10 | days: Vec>, 11 | } 12 | 13 | fn month_data(year: i32, month: u32) -> Vec { 14 | let first = Date::from_utc(NaiveDate::from_ymd(year, month, 1), Utc); 15 | let mut start = first; 16 | while start.weekday() != Weekday::Mon { 17 | start = start.checked_sub_signed(Duration::days(1)).unwrap(); 18 | } 19 | let mut weeks = vec![]; 20 | let mut week = vec![]; 21 | while start < first || start.month() == first.month() || start.weekday() != Weekday::Mon { 22 | week.push(start); 23 | 24 | if start.weekday() == Weekday::Sun { 25 | weeks.push(Week { 26 | number: start.iso_week().week() as u8, 27 | days: week.drain(..).collect(), 28 | }); 29 | } 30 | start = start.checked_add_signed(Duration::days(1)).unwrap(); 31 | } 32 | 33 | weeks 34 | } 35 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/README.md: -------------------------------------------------------------------------------- 1 | # egui_glium 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_glium.svg)](https://crates.io/crates/egui_glium) 4 | [![Documentation](https://docs.rs/egui_glium/badge.svg)](https://docs.rs/egui_glium) 5 | [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) 6 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 7 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 8 | 9 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [glium](https://crates.io/crates/glium) which allows you to write GUI code using egui and compile it and run it natively, cross platform. 10 | 11 | To use on Linux, first run: 12 | 13 | ``` 14 | sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev 15 | ``` 16 | 17 | This crate depends on [`egui-winit`](https://github.com/emilk/egui/tree/master/crates/egui-winit). 18 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/fragment_100es.glsl: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | uniform sampler2D u_sampler; 5 | varying vec4 v_rgba_gamma; // 0-1 gamma sRGBA 6 | varying vec2 v_tc; 7 | 8 | // 0-255 sRGB from 0-1 linear 9 | vec3 srgb_from_linear(vec3 rgb) { 10 | bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); 11 | vec3 lower = rgb * vec3(3294.6); 12 | vec3 higher = vec3(269.025) * pow(rgb, vec3(1.0 / 2.4)) - vec3(14.025); 13 | return mix(higher, lower, vec3(cutoff)); 14 | } 15 | 16 | vec4 srgba_from_linear(vec4 rgba) { 17 | return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a); 18 | } 19 | 20 | // 0-1 linear from 0-255 sRGB 21 | vec3 linear_from_srgb(vec3 srgb) { 22 | bvec3 cutoff = lessThan(srgb, vec3(10.31475)); 23 | vec3 lower = srgb / vec3(3294.6); 24 | vec3 higher = pow((srgb + vec3(14.025)) / vec3(269.025), vec3(2.4)); 25 | return mix(higher, lower, vec3(cutoff)); 26 | } 27 | 28 | vec4 linear_from_srgba(vec4 srgba) { 29 | return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0); 30 | } 31 | 32 | void main() { 33 | // WebGL doesn't come with sRGBA textures: 34 | vec4 texture_in_gamma = texture2D(u_sampler, v_tc); 35 | 36 | // Multiply vertex color with texture color (in gamma space). 37 | gl_FragColor = v_rgba_gamma * texture_in_gamma; 38 | } 39 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/fragment_120.glsl: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D u_sampler; 4 | varying vec4 v_rgba_gamma; // 0-1 gamma sRGBA 5 | varying vec2 v_tc; 6 | 7 | // 0-255 sRGB from 0-1 linear 8 | vec3 srgb_from_linear(vec3 rgb) { 9 | bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); 10 | vec3 lower = rgb * vec3(3294.6); 11 | vec3 higher = vec3(269.025) * pow(rgb, vec3(1.0 / 2.4)) - vec3(14.025); 12 | return mix(higher, lower, vec3(cutoff)); 13 | } 14 | 15 | // 0-255 sRGBA from 0-1 linear 16 | vec4 srgba_from_linear(vec4 rgba) { 17 | return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a); 18 | } 19 | 20 | // 0-1 gamma from 0-1 linear 21 | vec4 gamma_from_linear_rgba(vec4 linear_rgba) { 22 | return vec4(srgb_from_linear(linear_rgba.rgb) / 255.0, linear_rgba.a); 23 | } 24 | 25 | void main() { 26 | // The texture is set up with `SRGB8_ALPHA8` 27 | vec4 texture_in_gamma = gamma_from_linear_rgba(texture2D(u_sampler, v_tc)); 28 | 29 | // Multiply vertex color with texture color (in gamma space). 30 | gl_FragColor = v_rgba_gamma * texture_in_gamma; 31 | } 32 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/fragment_140.glsl: -------------------------------------------------------------------------------- 1 | #version 140 2 | 3 | uniform sampler2D u_sampler; 4 | in vec4 v_rgba_gamma; 5 | in vec2 v_tc; 6 | out vec4 f_color; 7 | 8 | // 0-255 sRGB from 0-1 linear 9 | vec3 srgb_from_linear(vec3 rgb) { 10 | bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); 11 | vec3 lower = rgb * vec3(3294.6); 12 | vec3 higher = vec3(269.025) * pow(rgb, vec3(1.0 / 2.4)) - vec3(14.025); 13 | return mix(higher, lower, vec3(cutoff)); 14 | } 15 | 16 | // 0-255 sRGBA from 0-1 linear 17 | vec4 srgba_from_linear(vec4 rgba) { 18 | return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a); 19 | } 20 | 21 | // 0-1 gamma from 0-1 linear 22 | vec4 gamma_from_linear_rgba(vec4 linear_rgba) { 23 | return vec4(srgb_from_linear(linear_rgba.rgb) / 255.0, linear_rgba.a); 24 | } 25 | 26 | void main() { 27 | // The texture is set up with `SRGB8_ALPHA8` 28 | vec4 texture_in_gamma = gamma_from_linear_rgba(texture(u_sampler, v_tc)); 29 | 30 | // Multiply vertex color with texture color (in gamma space). 31 | f_color = v_rgba_gamma * texture_in_gamma; 32 | } 33 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/fragment_300es.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | precision mediump float; 4 | uniform sampler2D u_sampler; 5 | varying vec4 v_rgba_gamma; // 0-1 gamma sRGBA 6 | varying vec2 v_tc; 7 | 8 | // 0-255 sRGB from 0-1 linear 9 | vec3 srgb_from_linear(vec3 rgb) { 10 | bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); 11 | vec3 lower = rgb * vec3(3294.6); 12 | vec3 higher = vec3(269.025) * pow(rgb, vec3(1.0 / 2.4)) - vec3(14.025); 13 | return mix(higher, lower, vec3(cutoff)); 14 | } 15 | 16 | // 0-255 sRGBA from 0-1 linear 17 | vec4 srgba_from_linear(vec4 rgba) { 18 | return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a); 19 | } 20 | 21 | // 0-1 gamma from 0-1 linear 22 | vec4 gamma_from_linear_rgba(vec4 linear_rgba) { 23 | return vec4(srgb_from_linear(linear_rgba.rgb) / 255.0, linear_rgba.a); 24 | } 25 | 26 | void main() { 27 | // The texture is set up with `SRGB8_ALPHA8` 28 | vec4 texture_in_gamma = gamma_from_linear_rgba(texture2D(u_sampler, v_tc)); 29 | 30 | // Multiply vertex color with texture color (in gamma space). 31 | gl_FragColor = v_rgba_gamma * texture_in_gamma; 32 | } 33 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/vertex_100es.glsl: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | uniform vec2 u_screen_size; 5 | attribute vec2 a_pos; 6 | attribute vec2 a_tc; 7 | attribute vec4 a_srgba; 8 | varying vec4 v_rgba_gamma; // 0-1 gamma sRGBA 9 | varying vec2 v_tc; 10 | 11 | void main() { 12 | gl_Position = vec4( 13 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 14 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 15 | 0.0, 16 | 1.0); 17 | v_rgba_gamma = a_srgba / 255.0; 18 | v_tc = a_tc; 19 | } 20 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/vertex_120.glsl: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform vec2 u_screen_size; 4 | attribute vec2 a_pos; 5 | attribute vec4 a_srgba; // 0-255 sRGB 6 | attribute vec2 a_tc; 7 | varying vec4 v_rgba_gamma; // 0-1 gamma sRGBA 8 | varying vec2 v_tc; 9 | 10 | void main() { 11 | gl_Position = vec4( 12 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 13 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 14 | 0.0, 15 | 1.0); 16 | v_rgba_gamma = a_srgba / 255.0; 17 | v_tc = a_tc; 18 | } 19 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/vertex_140.glsl: -------------------------------------------------------------------------------- 1 | #version 140 2 | 3 | uniform vec2 u_screen_size; 4 | in vec2 a_pos; 5 | in vec4 a_srgba; // 0-255 sRGB 6 | in vec2 a_tc; 7 | out vec4 v_rgba_gamma; 8 | out vec2 v_tc; 9 | 10 | void main() { 11 | gl_Position = vec4( 12 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 13 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 14 | 0.0, 15 | 1.0); 16 | v_rgba_gamma = a_srgba / 255.0; 17 | v_tc = a_tc; 18 | } 19 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glium/src/shader/vertex_300es.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | precision mediump float; 4 | uniform vec2 u_screen_size; 5 | attribute vec2 a_pos; 6 | attribute vec2 a_tc; 7 | attribute vec4 a_srgba; 8 | varying vec4 v_rgba_gamma; // 0-1 gamma sRGBA 9 | varying vec2 v_tc; 10 | 11 | void main() { 12 | gl_Position = vec4( 13 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 14 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 15 | 0.0, 16 | 1.0); 17 | v_rgba_gamma = a_srgba / 255.0; 18 | v_tc = a_tc; 19 | } 20 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glow/README.md: -------------------------------------------------------------------------------- 1 | # egui_glow 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_glow.svg)](https://crates.io/crates/egui_glow) 4 | [![Documentation](https://docs.rs/egui_glow/badge.svg)](https://docs.rs/egui_glow) 5 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 6 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 7 | 8 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [glow](https://crates.io/crates/glow) which allows you to: 9 | * Render egui using glow on both native and web. 10 | * Write cross platform native egui apps (with the `winit` feature). 11 | 12 | To write web apps using `glow` you can use [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe) (which uses `egui_glow` for rendering). 13 | 14 | To use on Linux, first run: 15 | 16 | ``` 17 | sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev 18 | ``` 19 | 20 | This crate optionally depends on [`egui-winit`](https://github.com/emilk/egui/tree/master/crates/egui-winit). 21 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glow/src/misc_util.rs: -------------------------------------------------------------------------------- 1 | #![allow(unsafe_code)] 2 | 3 | use glow::HasContext as _; 4 | 5 | pub(crate) unsafe fn compile_shader( 6 | gl: &glow::Context, 7 | shader_type: u32, 8 | source: &str, 9 | ) -> Result { 10 | let shader = gl.create_shader(shader_type)?; 11 | 12 | gl.shader_source(shader, source); 13 | 14 | gl.compile_shader(shader); 15 | 16 | if gl.get_shader_compile_status(shader) { 17 | Ok(shader) 18 | } else { 19 | Err(gl.get_shader_info_log(shader)) 20 | } 21 | } 22 | 23 | pub(crate) unsafe fn link_program<'a, T: IntoIterator>( 24 | gl: &glow::Context, 25 | shaders: T, 26 | ) -> Result { 27 | let program = gl.create_program()?; 28 | 29 | for shader in shaders { 30 | gl.attach_shader(program, *shader); 31 | } 32 | 33 | gl.link_program(program); 34 | 35 | if gl.get_program_link_status(program) { 36 | Ok(program) 37 | } else { 38 | Err(gl.get_program_info_log(program)) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glow/src/shader/fragment.glsl: -------------------------------------------------------------------------------- 1 | #ifdef GL_ES 2 | precision mediump float; 3 | #endif 4 | 5 | uniform sampler2D u_sampler; 6 | //const float rotation_angle = -90.0; 7 | 8 | #if NEW_SHADER_INTERFACE 9 | in vec4 v_rgba_in_gamma; 10 | in vec2 v_tc; 11 | out vec4 f_color; 12 | // a dirty hack applied to support webGL2 13 | #define gl_FragColor f_color 14 | #define texture2D texture 15 | #else 16 | varying vec4 v_rgba_in_gamma; 17 | varying vec2 v_tc; 18 | #endif 19 | 20 | // 0-1 sRGB gamma from 0-1 linear 21 | vec3 srgb_gamma_from_linear(vec3 rgb) { 22 | bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); 23 | vec3 lower = rgb * vec3(12.92); 24 | vec3 higher = vec3(1.055) * pow(rgb, vec3(1.0 / 2.4)) - vec3(0.055); 25 | return mix(higher, lower, vec3(cutoff)); 26 | } 27 | 28 | // 0-1 sRGBA gamma from 0-1 linear 29 | vec4 srgba_gamma_from_linear(vec4 rgba) { 30 | return vec4(srgb_gamma_from_linear(rgba.rgb), rgba.a); 31 | } 32 | 33 | void main() { 34 | #if SRGB_TEXTURES 35 | vec4 texture_in_gamma = srgba_gamma_from_linear(texture2D(u_sampler, v_tc)); 36 | #else 37 | vec4 texture_in_gamma = texture2D(u_sampler, v_tc); 38 | #endif 39 | 40 | // We multiply the colors in gamma space, because that's the only way to get text to look right. 41 | gl_FragColor = v_rgba_in_gamma * texture_in_gamma; 42 | } 43 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_glow/src/shader/vertex.glsl: -------------------------------------------------------------------------------- 1 | #if NEW_SHADER_INTERFACE 2 | #define I in 3 | #define O out 4 | #define V(x) x 5 | #else 6 | #define I attribute 7 | #define O varying 8 | #define V(x) vec3(x) 9 | #endif 10 | 11 | #ifdef GL_ES 12 | precision mediump float; 13 | #endif 14 | 15 | uniform vec2 u_screen_size; 16 | I vec2 a_pos; 17 | I vec4 a_srgba; // 0-255 sRGB 18 | I vec2 a_tc; 19 | O vec4 v_rgba_in_gamma; 20 | O vec2 v_tc; 21 | 22 | void main() { 23 | gl_Position = vec4( 24 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 25 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 26 | 0.0, 27 | 1.0); 28 | v_rgba_in_gamma = a_srgba / 255.0; 29 | v_tc = a_tc; 30 | } 31 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/egui_web/README.md: -------------------------------------------------------------------------------- 1 | `egui_web` used to be a standalone crate, but has now been moved into [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe). 2 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/emath/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "emath" 3 | version = "0.19.0" 4 | authors = ["Emil Ernerfeldt "] 5 | description = "Minimal 2D math library for GUI work" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | homepage = "https://github.com/emilk/egui/tree/master/crates/emath" 9 | license = "MIT OR Apache-2.0" 10 | readme = "README.md" 11 | repository = "https://github.com/emilk/egui/tree/master/crates/emath" 12 | categories = ["mathematics", "gui"] 13 | keywords = ["math", "gui"] 14 | include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] 15 | 16 | [package.metadata.docs.rs] 17 | all-features = true 18 | 19 | [lib] 20 | 21 | 22 | [features] 23 | default = [] 24 | 25 | ## Enable additional checks if debug assertions are enabled (debug builds). 26 | extra_debug_asserts = [] 27 | ## Always enable additional checks. 28 | extra_asserts = [] 29 | 30 | 31 | [dependencies] 32 | #! ### Optional dependencies 33 | 34 | ## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast `emath` types to `&[u8]`. 35 | bytemuck = { version = "1.7.2", optional = true, features = ["derive"] } 36 | 37 | ## Enable this when generating docs. 38 | document-features = { version = "0.2", optional = true } 39 | 40 | ## [`mint`](https://docs.rs/mint) enables interopability with other math libraries such as [`glam`](https://docs.rs/glam) and [`nalgebra`](https://docs.rs/nalgebra). 41 | mint = { version = "0.5.6", optional = true } 42 | 43 | ## Allow serialization using [`serde`](https://docs.rs/serde). 44 | serde = { version = "1", optional = true, features = ["derive"] } 45 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/emath/README.md: -------------------------------------------------------------------------------- 1 | # emath - egui math library 2 | 3 | A bare-bones 2D math library with types and functions useful for GUI building. 4 | 5 | Made for [`egui`](https://github.com/emilk/egui/). 6 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/README.md: -------------------------------------------------------------------------------- 1 | # epaint - egui paint library 2 | 3 | A bare-bones 2D graphics library for turning simple 2D shapes and text into textured triangles. 4 | 5 | Made for [`egui`](https://github.com/emilk/egui/). 6 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/fonts/Hack-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui-bleeding/crates/epaint/fonts/Hack-Regular.ttf -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/fonts/NotoEmoji-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui-bleeding/crates/epaint/fonts/NotoEmoji-Regular.ttf -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/fonts/Ubuntu-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui-bleeding/crates/epaint/fonts/Ubuntu-Light.ttf -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/fonts/emoji-icon-font-mit-license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014 John Slegers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/fonts/emoji-icon-font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui-bleeding/crates/epaint/fonts/emoji-icon-font.ttf -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/fonts/list_fonts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from fontTools.ttLib import TTFont 3 | from fontTools.unicode import Unicode 4 | from itertools import chain 5 | import sys 6 | 7 | ttf = TTFont(sys.argv[1], 0, verbose=0, allowVID=0, 8 | ignoreDecompileErrors=True, 9 | fontNumber=-1) 10 | 11 | chars = chain.from_iterable([y + (Unicode[y[0]],) 12 | for y in x.cmap.items()] for x in ttf["cmap"].tables) 13 | 14 | 15 | all_codepoints = {} 16 | 17 | for entry in chars: 18 | codepoint = entry[0] 19 | short_name = entry[1] 20 | long_name = entry[2].lower() 21 | if False: 22 | print(f'(0x{codepoint:02X}, "{short_name}", "{long_name}"),') 23 | else: 24 | name = short_name if long_name == "????" else long_name 25 | # print(f'(0x{codepoint:02X}, "{name}"),') 26 | all_codepoints[codepoint] = name 27 | 28 | for codepoint in sorted(all_codepoints.keys()): 29 | name = all_codepoints[codepoint] 30 | print(f'(0x{codepoint:02X}, \'{chr(codepoint)}\', "{name}"),') 31 | 32 | ttf.close() 33 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/src/text/mod.rs: -------------------------------------------------------------------------------- 1 | //! Everything related to text, fonts, text layout, cursors etc. 2 | 3 | pub mod cursor; 4 | mod font; 5 | mod fonts; 6 | mod text_layout; 7 | mod text_layout_types; 8 | 9 | /// One `\t` character is this many spaces wide. 10 | pub const TAB_SIZE: usize = 4; 11 | 12 | pub use { 13 | fonts::{FontData, FontDefinitions, FontFamily, FontId, FontTweak, Fonts, FontsImpl}, 14 | text_layout::layout, 15 | text_layout_types::*, 16 | }; 17 | 18 | /// Suggested character to use to replace those in password text fields. 19 | pub const PASSWORD_REPLACEMENT_CHAR: char = '•'; 20 | -------------------------------------------------------------------------------- /lib/egui-bleeding/crates/epaint/src/util/mod.rs: -------------------------------------------------------------------------------- 1 | mod ordered_float; 2 | 3 | pub use ordered_float::*; 4 | 5 | /// Hash the given value with a predictable hasher. 6 | #[inline] 7 | pub fn hash(value: impl std::hash::Hash) -> u64 { 8 | use std::hash::Hasher as _; 9 | let mut hasher = ahash::AHasher::default(); 10 | value.hash(&mut hasher); 11 | hasher.finish() 12 | } 13 | 14 | /// Hash the given value with the given hasher. 15 | #[inline] 16 | pub fn hash_with(value: impl std::hash::Hash, mut hasher: impl std::hash::Hasher) -> u64 { 17 | value.hash(&mut hasher); 18 | hasher.finish() 19 | } 20 | -------------------------------------------------------------------------------- /lib/egui-bleeding/docs/CNAME: -------------------------------------------------------------------------------- 1 | www.egui.rs -------------------------------------------------------------------------------- /lib/egui-bleeding/docs/README.md: -------------------------------------------------------------------------------- 1 | This folder contains the files required for the egui web demo hosted at . 2 | 3 | The reason the folder is called "docs" is because that is the name that GitHub requires in order to host a web page from the `master` branch of a repository. 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/docs/egui_demo_app_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui-bleeding/docs/egui_demo_app_bg.wasm -------------------------------------------------------------------------------- /lib/egui-bleeding/docs/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui-bleeding/docs/favicon.ico -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/README.md: -------------------------------------------------------------------------------- 1 | # `egui` and `eframe` examples 2 | All the examples in this folder uses [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe) to set up a window for [`egui`](https://github.com/emilk/egui/). Some examples are specific to `eframe`, but many are applicable to any `egui` integration. 3 | 4 | There are a lot more examples at , and it has links to the source code of each example. 5 | 6 | Also check out the official docs at and . 7 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/confirm_exit/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "confirm_exit" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/confirm_exit/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p confirm_exit 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_3d_glow/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_3d_glow" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe", features = ["glow"] } 13 | egui_glow = { path = "../../crates/egui_glow" } 14 | glow = "0.11" 15 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_3d_glow/README.md: -------------------------------------------------------------------------------- 1 | This demo shows how to embed 3D rendering using [`glow`](https://github.com/grovesNL/glow) in `eframe`. 2 | 3 | This is very advanced usage, and you need to be careful. 4 | 5 | If you want an easier way to show 3D graphics with egui, take a look at the `custom_3d_three-d.rs` example. 6 | 7 | If you are content of having egui sit on top of a 3D background, take a look at: 8 | 9 | * [`bevy_egui`](https://github.com/mvlabat/bevy_egui) 10 | * [`three-d`](https://github.com/asny/three-d) 11 | 12 | 13 | ```sh 14 | cargo run -p custom_3d_glow 15 | ``` 16 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_3d_three-d/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_3d_three-d" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | [lib] 11 | crate-type = ["cdylib", "rlib"] 12 | 13 | [dependencies] 14 | eframe = { path = "../../crates/eframe", features = ["glow"] } 15 | egui_glow = { path = "../../crates/egui_glow" } 16 | glow = "0.11" 17 | three-d = { version = "0.13", default-features = false } 18 | 19 | [target.'cfg(target_arch = "wasm32")'.dependencies] # Web dependencies 20 | wasm-bindgen = "0.2" # Core bindings 21 | wasm-bindgen-futures = "0.4" # Core bindings 22 | console_error_panic_hook = "0.1" # For logging 23 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_3d_three-d/README.md: -------------------------------------------------------------------------------- 1 | This demo shows how to embed 3D rendering using [`three-d`](https://github.com/asny/three-d) in `eframe`. 2 | 3 | Any 3D library built on top of [`glow`](https://github.com/grovesNL/glow) can be used in `eframe`. 4 | 5 | Alternatively you can render 3D stuff to a texture and display it using [`egui::Ui::image`]. 6 | 7 | If you are content of having egui sit on top of a 3D background, take a look at: 8 | 9 | * [`bevy_egui`](https://github.com/mvlabat/bevy_egui) 10 | * [`three-d`](https://github.com/asny/three-d) 11 | 12 | 13 | 14 | ```sh 15 | cargo run -p custom_3d_three-d 16 | ``` 17 | 18 | ``` 19 | wasm-pack build examples/custom_3d_three-d --target web 20 | ``` 21 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_3d_three-d/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod main; 2 | 3 | // Entry point for wasm 4 | #[cfg(target_arch = "wasm32")] 5 | use wasm_bindgen::prelude::*; 6 | 7 | #[cfg(target_arch = "wasm32")] 8 | #[wasm_bindgen(start)] 9 | pub async fn start() -> Result<(), JsValue> { 10 | std::panic::set_hook(Box::new(console_error_panic_hook::hook)); 11 | 12 | let web_options = eframe::WebOptions::default(); 13 | eframe::start_web( 14 | "my", 15 | web_options, 16 | Box::new(|cc| Box::new(main::MyApp::new(cc))), 17 | )?; 18 | Ok(()) 19 | } 20 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_font/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_font" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_font/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p custom_font 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_font_style/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_font_style" 3 | version = "0.1.0" 4 | authors = ["tami5 "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_font_style/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p custom_font_style 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_window_frame/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_window_frame" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/custom_window_frame/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p custom_window_frame 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/download_image/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "download_image" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["image"] } 14 | ehttp = "0.2" 15 | image = { version = "0.24", default-features = false, features = ["jpeg"] } 16 | poll-promise = "0.1" 17 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/download_image/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p download_image 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/file_dialog/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "file_dialog" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | rfd = "0.10" 14 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/file_dialog/README.md: -------------------------------------------------------------------------------- 1 | How to show a file dialog using [`rfd`](https://github.com/PolyMeilex/rfd). 2 | 3 | ```sh 4 | cargo run -p file_dialog 5 | ``` 6 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/hello_world/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_world" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/hello_world/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p hello_world 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/hello_world/src/main.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release 2 | 3 | use eframe::egui; 4 | 5 | fn main() { 6 | let options = eframe::NativeOptions::default(); 7 | eframe::run_native( 8 | "My egui App", 9 | options, 10 | Box::new(|_cc| Box::new(MyApp::default())), 11 | ); 12 | } 13 | 14 | struct MyApp { 15 | name: String, 16 | age: u32, 17 | } 18 | 19 | impl Default for MyApp { 20 | fn default() -> Self { 21 | Self { 22 | name: "Arthur".to_owned(), 23 | age: 42, 24 | } 25 | } 26 | } 27 | 28 | impl eframe::App for MyApp { 29 | fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { 30 | egui::CentralPanel::default().show(ctx, |ui| { 31 | ui.heading("My egui Application"); 32 | ui.horizontal(|ui| { 33 | ui.label("Your name: "); 34 | ui.text_edit_singleline(&mut self.name); 35 | }); 36 | ui.add(egui::Slider::new(&mut self.age, 0..=120).text("age")); 37 | if ui.button("Click each year").clicked() { 38 | self.age += 1; 39 | } 40 | ui.label(format!("Hello '{}', age {}", self.name, self.age)); 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/puffin_profiler/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "puffin_profiler" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe", features = ["puffin"] } 13 | puffin = "0.13" 14 | puffin_http = "0.10" 15 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/puffin_profiler/README.md: -------------------------------------------------------------------------------- 1 | Example how to use the [puffin profiler](https://github.com/EmbarkStudios/puffin) with an `eframe` app. 2 | 3 | 4 | ```sh 5 | cargo run -p puffin_profiler & 6 | 7 | cargo install puffin_viewer 8 | puffin_viewer --url 127.0.0.1:8585 9 | ``` 10 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/retained_image/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "retained_image" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["image"] } 14 | image = { version = "0.24", default-features = false, features = ["png"] } 15 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/retained_image/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p retained_image 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/retained_image/src/rust-logo-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui-bleeding/examples/retained_image/src/rust-logo-256x256.png -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/retained_image/src/rust-logo-license.txt: -------------------------------------------------------------------------------- 1 | Rust logo by Mozilla, from https://github.com/rust-lang/rust-artwork 2 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/screenshot/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "screenshot" 3 | version = "0.1.0" 4 | authors = ["René Rössler "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["image"] } 14 | itertools = "0.10.3" 15 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/screenshot/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p screenshot 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/serial_windows/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "serial_windows" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/serial_windows/README.md: -------------------------------------------------------------------------------- 1 | Demonstrates how to open several windows after each other. 2 | 3 | NOTE: this doesn't work on Mac due to . 4 | See also . 5 | 6 | ```sh 7 | cargo run -p serial_windows 8 | ``` 9 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/svg/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "svg" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["svg"] } 14 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/svg/README.md: -------------------------------------------------------------------------------- 1 | Example how to show an SVG image. 2 | 3 | 4 | ```sh 5 | cargo run -p svg 6 | ``` 7 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/svg/src/main.rs: -------------------------------------------------------------------------------- 1 | //! A good way of displaying an SVG image in egui. 2 | //! 3 | //! Requires the dependency `egui_extras` with the `svg` feature. 4 | 5 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release 6 | 7 | use eframe::egui; 8 | 9 | fn main() { 10 | let options = eframe::NativeOptions { 11 | initial_window_size: Some(egui::vec2(1000.0, 700.0)), 12 | ..Default::default() 13 | }; 14 | eframe::run_native( 15 | "svg example", 16 | options, 17 | Box::new(|_cc| Box::new(MyApp::default())), 18 | ); 19 | } 20 | 21 | struct MyApp { 22 | svg_image: egui_extras::RetainedImage, 23 | } 24 | 25 | impl Default for MyApp { 26 | fn default() -> Self { 27 | Self { 28 | svg_image: egui_extras::RetainedImage::from_svg_bytes( 29 | "rustacean-flat-happy.svg", 30 | include_bytes!("rustacean-flat-happy.svg"), 31 | ) 32 | .unwrap(), 33 | } 34 | } 35 | } 36 | 37 | impl eframe::App for MyApp { 38 | fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { 39 | egui::CentralPanel::default().show(ctx, |ui| { 40 | ui.heading("SVG example"); 41 | ui.label("The SVG is rasterized and displayed as a texture."); 42 | 43 | ui.separator(); 44 | 45 | let max_size = ui.available_size(); 46 | self.svg_image.show_max_size(ui, max_size); 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/egui-bleeding/examples/svg/src/rust-logo-license.txt: -------------------------------------------------------------------------------- 1 | Rust logo by Mozilla, from https://github.com/rust-lang/rust-artwork 2 | -------------------------------------------------------------------------------- /lib/egui-bleeding/rust-toolchain: -------------------------------------------------------------------------------- 1 | # If you see this, run "rustup self update" to get rustup 1.23 or newer. 2 | 3 | # NOTE: above comment is for older `rustup` (before TOML support was added), 4 | # which will treat the first line as the toolchain name, and therefore show it 5 | # to the user in the error, instead of "error: invalid channel name '[toolchain]'". 6 | 7 | [toolchain] 8 | channel = "1.61.0" 9 | components = [ "rustfmt", "clippy" ] 10 | targets = [ "wasm32-unknown-unknown" ] 11 | -------------------------------------------------------------------------------- /lib/egui-bleeding/sh/docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | cargo doc -p eframe --target wasm32-unknown-unknown --lib --no-deps 7 | cargo doc -p emath -p epaint -p egui -p eframe -p egui-winit -p egui_extras -p egui_glium -p egui_glow --lib --no-deps --all-features --open 8 | 9 | # cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features' 10 | -------------------------------------------------------------------------------- /lib/egui-bleeding/sh/find_bloat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | cargo bloat --release --bin egui_demo_app -n 200 | rg "egui " 7 | 8 | cargo llvm-lines -p egui_demo_lib | rg egui | head -30 9 | -------------------------------------------------------------------------------- /lib/egui-bleeding/sh/setup_web.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | # Pre-requisites: 7 | rustup target add wasm32-unknown-unknown 8 | cargo install wasm-bindgen-cli --version 0.2.83 9 | -------------------------------------------------------------------------------- /lib/egui-bleeding/sh/start_server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | # Starts a local web-server that serves the contents of the `doc/` folder, 7 | # i.e. the web-version of `egui_demo_app`. 8 | 9 | PORT=8888 10 | 11 | echo "ensuring basic-http-server is installed…" 12 | cargo install basic-http-server 13 | 14 | echo "starting server…" 15 | echo "serving at http://localhost:${PORT}" 16 | 17 | (cd docs && basic-http-server --addr 127.0.0.1:${PORT} .) 18 | # (cd docs && python3 -m http.server ${PORT} --bind 127.0.0.1) 19 | -------------------------------------------------------------------------------- /lib/egui-bleeding/sh/wasm_bindgen_check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | if [[ $* == --skip-setup ]] 7 | then 8 | echo "Skipping setup_web.sh" 9 | else 10 | echo "Running setup_web.sh" 11 | ./sh/setup_web.sh 12 | fi 13 | 14 | CRATE_NAME="egui_demo_app" 15 | FEATURES="glow,http,persistence,screen_reader" 16 | 17 | # This is required to enable the web_sys clipboard API which eframe web uses 18 | # https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html 19 | # https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html 20 | export RUSTFLAGS=--cfg=web_sys_unstable_apis 21 | 22 | echo "Building rust…" 23 | BUILD=debug # debug builds are faster 24 | 25 | (cd crates/$CRATE_NAME && 26 | cargo build \ 27 | --lib \ 28 | --target wasm32-unknown-unknown \ 29 | --no-default-features \ 30 | --features ${FEATURES} 31 | ) 32 | 33 | TARGET="target" 34 | 35 | echo "Generating JS bindings for wasm…" 36 | 37 | rm -f "${CRATE_NAME}_bg.wasm" # Remove old output (if any) 38 | 39 | TARGET_NAME="${CRATE_NAME}.wasm" 40 | wasm-bindgen "${TARGET}/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \ 41 | --out-dir . --no-modules --no-typescript 42 | 43 | # Remove output: 44 | rm -f "${CRATE_NAME}_bg.wasm" 45 | rm -f "${CRATE_NAME}.js" 46 | -------------------------------------------------------------------------------- /lib/egui-bleeding/sh/wasm_size.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path" 5 | 6 | ./build_demo_web.sh && ls -lh ../docs/*.wasm 7 | -------------------------------------------------------------------------------- /lib/egui/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature-request 6 | assignees: '' 7 | 8 | --- 9 | 10 | 13 | 14 | 15 | **Is your feature request related to a problem? Please describe.** 16 | 17 | 18 | **Describe the solution you'd like** 19 | 20 | 21 | **Describe alternatives you've considered** 22 | 23 | 24 | **Additional context** 25 | 26 | -------------------------------------------------------------------------------- /lib/egui/.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: For issues that are neither bugs or feature requests 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | If you are asking a question, use [the egui discussions forum](https://github.com/emilk/egui/discussions/categories/q-a) instead! 11 | -------------------------------------------------------------------------------- /lib/egui/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 14 | 15 | Closes . 16 | -------------------------------------------------------------------------------- /lib/egui/.gitignore: -------------------------------------------------------------------------------- 1 | **/target 2 | /.*.json 3 | /.vscode 4 | /media/* 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /lib/egui/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = [ 4 | "crates/egui_demo_app", 5 | "crates/egui_demo_lib", 6 | "crates/egui_extras", 7 | "crates/egui_glium", 8 | "crates/egui_glow", 9 | "crates/egui-wgpu", 10 | "crates/egui-winit", 11 | "crates/egui", 12 | "crates/emath", 13 | "crates/epaint", 14 | 15 | "examples/*", 16 | ] 17 | 18 | [profile.dev] 19 | split-debuginfo = "unpacked" # faster debug builds on mac 20 | 21 | [profile.release] 22 | # lto = true # VERY slightly smaller wasm 23 | # opt-level = 's' # 10-20% smaller wasm compared to `opt-level = 3` 24 | # opt-level = 1 # very slow and big wasm. Don't do this. 25 | opt-level = 2 # fast and small wasm, basically same as `opt-level = 's'` 26 | # opt-level = 3 # unecessarily large wasm for no performance gain 27 | 28 | # debug = true # include debug symbols, useful when profiling wasm 29 | -------------------------------------------------------------------------------- /lib/egui/FORK.md: -------------------------------------------------------------------------------- 1 | Forked from: https://github.com/emilk/egui at commit 97ce10320980ea4e8f415b000b322881eb5ec51f 2 | -------------------------------------------------------------------------------- /lib/egui/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2021 Emil Ernerfeldt 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /lib/egui/crates/eframe/src/native/mod.rs: -------------------------------------------------------------------------------- 1 | mod epi_integration; 2 | pub mod run; 3 | 4 | /// File storage which can be used by native backends. 5 | #[cfg(feature = "persistence")] 6 | pub mod file_storage; 7 | -------------------------------------------------------------------------------- /lib/egui/crates/eframe/src/web/screen_reader.rs: -------------------------------------------------------------------------------- 1 | pub struct ScreenReader { 2 | #[cfg(feature = "tts")] 3 | tts: Option, 4 | } 5 | 6 | #[cfg(not(feature = "tts"))] 7 | #[allow(clippy::derivable_impls)] // False positive 8 | impl Default for ScreenReader { 9 | fn default() -> Self { 10 | Self {} 11 | } 12 | } 13 | 14 | #[cfg(feature = "tts")] 15 | impl Default for ScreenReader { 16 | fn default() -> Self { 17 | let tts = match tts::Tts::default() { 18 | Ok(screen_reader) => { 19 | tracing::debug!("Initialized screen reader."); 20 | Some(screen_reader) 21 | } 22 | Err(err) => { 23 | tracing::warn!("Failed to load screen reader: {}", err); 24 | None 25 | } 26 | }; 27 | Self { tts } 28 | } 29 | } 30 | 31 | impl ScreenReader { 32 | #[cfg(not(feature = "tts"))] 33 | #[allow(clippy::unused_self)] 34 | pub fn speak(&mut self, _text: &str) {} 35 | 36 | #[cfg(feature = "tts")] 37 | pub fn speak(&mut self, text: &str) { 38 | if text.is_empty() { 39 | return; 40 | } 41 | if let Some(tts) = &mut self.tts { 42 | tracing::debug!("Speaking: {:?}", text); 43 | let interrupt = true; 44 | if let Err(err) = tts.speak(text, interrupt) { 45 | tracing::warn!("Failed to read: {}", err); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/egui/crates/eframe/src/web/storage.rs: -------------------------------------------------------------------------------- 1 | fn local_storage() -> Option { 2 | web_sys::window()?.local_storage().ok()? 3 | } 4 | 5 | pub fn local_storage_get(key: &str) -> Option { 6 | local_storage().map(|storage| storage.get_item(key).ok())?? 7 | } 8 | 9 | pub fn local_storage_set(key: &str, value: &str) { 10 | local_storage().map(|storage| storage.set_item(key, value)); 11 | } 12 | 13 | #[cfg(feature = "persistence")] 14 | pub fn load_memory(ctx: &egui::Context) { 15 | if let Some(memory_string) = local_storage_get("egui_memory_ron") { 16 | match ron::from_str(&memory_string) { 17 | Ok(memory) => { 18 | *ctx.memory() = memory; 19 | } 20 | Err(err) => { 21 | tracing::error!("Failed to parse memory RON: {}", err); 22 | } 23 | } 24 | } 25 | } 26 | 27 | #[cfg(not(feature = "persistence"))] 28 | pub fn load_memory(_: &egui::Context) {} 29 | 30 | #[cfg(feature = "persistence")] 31 | pub fn save_memory(ctx: &egui::Context) { 32 | match ron::to_string(&*ctx.memory()) { 33 | Ok(ron) => { 34 | local_storage_set("egui_memory_ron", &ron); 35 | } 36 | Err(err) => { 37 | tracing::error!("Failed to serialize memory as RON: {}", err); 38 | } 39 | } 40 | } 41 | 42 | #[cfg(not(feature = "persistence"))] 43 | pub fn save_memory(_: &egui::Context) {} 44 | -------------------------------------------------------------------------------- /lib/egui/crates/egui-wgpu/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for egui-wgpu 2 | All notable changes to the `egui-wgpu` integration will be noted in this file. 3 | 4 | 5 | ## Unreleased 6 | 7 | 8 | ## 0.19.0 - 2022-08-20 9 | * Enables deferred render + surface state initialization for Android ([#1634](https://github.com/emilk/egui/pull/1634)). 10 | * Make `RenderPass` `Send` and `Sync` ([#1883](https://github.com/emilk/egui/pull/1883)). 11 | 12 | 13 | ## 0.18.0 - 2022-05-15 14 | First published version since moving the code into the `egui` repository from . 15 | -------------------------------------------------------------------------------- /lib/egui/crates/egui-wgpu/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "egui-wgpu" 3 | version = "0.19.0" 4 | description = "Bindings for using egui natively using the wgpu library" 5 | authors = [ 6 | "Nils Hasenbanck ", 7 | "embotech ", 8 | "Emil Ernerfeldt ", 9 | ] 10 | edition = "2021" 11 | rust-version = "1.61" 12 | homepage = "https://github.com/emilk/egui/tree/master/crates/egui-wgpu" 13 | license = "MIT OR Apache-2.0" 14 | readme = "README.md" 15 | repository = "https://github.com/emilk/egui/tree/master/crates/egui-wgpu" 16 | categories = ["gui", "game-development"] 17 | keywords = ["wgpu", "egui", "gui", "gamedev"] 18 | include = [ 19 | "../LICENSE-APACHE", 20 | "../LICENSE-MIT", 21 | "**/*.rs", 22 | "**/*.wgsl", 23 | "Cargo.toml", 24 | ] 25 | 26 | [package.metadata.docs.rs] 27 | all-features = true 28 | 29 | 30 | [features] 31 | ## Enable [`winit`](https://docs.rs/winit) integration. 32 | winit = ["dep:pollster", "dep:winit"] 33 | 34 | 35 | [dependencies] 36 | egui = { version = "0.19.0", path = "../egui", default-features = false, features = [ 37 | "bytemuck", 38 | ] } 39 | 40 | bytemuck = "1.7" 41 | tracing = { version = "0.1", default-features = false, features = ["std"] } 42 | type-map = "0.5.0" 43 | wgpu = "0.13" 44 | 45 | #! ### Optional dependencies 46 | ## Enable this when generating docs. 47 | document-features = { version = "0.2", optional = true } 48 | 49 | pollster = { version = "0.2", optional = true } 50 | winit = { version = "0.27.2", optional = true } 51 | -------------------------------------------------------------------------------- /lib/egui/crates/egui-wgpu/README.md: -------------------------------------------------------------------------------- 1 | # egui-wgpu 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui-wgpu.svg)](https://crates.io/crates/egui-wgpu) 4 | [![Documentation](https://docs.rs/egui-wgpu/badge.svg)](https://docs.rs/egui-wgpu) 5 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 6 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 7 | 8 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [wgpu](https://crates.io/crates/wgpu). 9 | 10 | This was originally hosted at https://github.com/hasenbanck/egui_wgpu_backend 11 | -------------------------------------------------------------------------------- /lib/egui/crates/egui-wgpu/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [wgpu](https://crates.io/crates/wgpu). 2 | //! 3 | //! ## Feature flags 4 | #![cfg_attr(feature = "document-features", doc = document_features::document_features!())] 5 | //! 6 | 7 | #![allow(unsafe_code)] 8 | 9 | pub use wgpu; 10 | 11 | /// Low-level painting of [`egui`] on [`wgpu`]. 12 | pub mod renderer; 13 | pub use renderer::CallbackFn; 14 | 15 | /// Module for painting [`egui`] with [`wgpu`] on [`winit`]. 16 | #[cfg(feature = "winit")] 17 | pub mod winit; 18 | 19 | #[cfg(feature = "winit")] 20 | pub use crate::winit::RenderState; 21 | -------------------------------------------------------------------------------- /lib/egui/crates/egui-winit/README.md: -------------------------------------------------------------------------------- 1 | # egui-winit 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui-winit.svg)](https://crates.io/crates/egui-winit) 4 | [![Documentation](https://docs.rs/egui-winit/badge.svg)](https://docs.rs/egui-winit) 5 | [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) 6 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 7 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 8 | 9 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [`winit`](https://crates.io/crates/winit). 10 | 11 | The library translates winit events to egui, handled copy/paste, updates the cursor, open links clicked in egui, etc. 12 | -------------------------------------------------------------------------------- /lib/egui/crates/egui-winit/src/screen_reader.rs: -------------------------------------------------------------------------------- 1 | pub struct ScreenReader { 2 | #[cfg(feature = "tts")] 3 | tts: Option, 4 | } 5 | 6 | #[cfg(not(feature = "tts"))] 7 | #[allow(clippy::derivable_impls)] // False positive 8 | impl Default for ScreenReader { 9 | fn default() -> Self { 10 | Self {} 11 | } 12 | } 13 | 14 | #[cfg(feature = "tts")] 15 | impl Default for ScreenReader { 16 | fn default() -> Self { 17 | let tts = match tts::Tts::default() { 18 | Ok(screen_reader) => { 19 | tracing::debug!("Initialized screen reader."); 20 | Some(screen_reader) 21 | } 22 | Err(err) => { 23 | tracing::warn!("Failed to load screen reader: {}", err); 24 | None 25 | } 26 | }; 27 | Self { tts } 28 | } 29 | } 30 | 31 | impl ScreenReader { 32 | #[cfg(not(feature = "tts"))] 33 | #[allow(clippy::unused_self)] 34 | pub fn speak(&mut self, _text: &str) {} 35 | 36 | #[cfg(feature = "tts")] 37 | pub fn speak(&mut self, text: &str) { 38 | if text.is_empty() { 39 | return; 40 | } 41 | if let Some(tts) = &mut self.tts { 42 | tracing::debug!("Speaking: {:?}", text); 43 | let interrupt = true; 44 | if let Err(err) = tts.speak(text, interrupt) { 45 | tracing::warn!("Failed to read: {}", err); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/README.md: -------------------------------------------------------------------------------- 1 | # GUI implementation 2 | This is the core library crate egui. It is fully platform independent without any backend. You give the egui library input each frame (mouse pos etc), and it outputs a triangle mesh for you to paint. 3 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/examples/README.md: -------------------------------------------------------------------------------- 1 | There are no stand-alone egui examples, because egui is not stand-alone! 2 | 3 | See the top-level [examples](https://github.com/emilk/egui/tree/master/examples/) folder instead. 4 | 5 | There are also plenty of examples in [the online demo](https://www.egui.rs/#demo). You can find the source code for it at . 6 | 7 | To learn how to set up `eframe` for web and native, go to and follow the instructions there! 8 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/src/containers/mod.rs: -------------------------------------------------------------------------------- 1 | //! Containers are pieces of the UI which wraps other pieces of UI. Examples: [`Window`], [`ScrollArea`], [`Resize`], [`SidePanel`], etc. 2 | //! 3 | //! For instance, a [`Frame`] adds a frame and background to some contained UI. 4 | 5 | pub(crate) mod area; 6 | pub mod collapsing_header; 7 | mod combo_box; 8 | pub(crate) mod frame; 9 | pub mod panel; 10 | pub mod popup; 11 | pub(crate) mod resize; 12 | pub(crate) mod scroll_area; 13 | pub(crate) mod window; 14 | 15 | pub use { 16 | area::Area, 17 | collapsing_header::{CollapsingHeader, CollapsingResponse}, 18 | combo_box::*, 19 | frame::Frame, 20 | panel::{CentralPanel, SidePanel, TopBottomPanel}, 21 | popup::*, 22 | resize::Resize, 23 | scroll_area::ScrollArea, 24 | window::Window, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/src/data/mod.rs: -------------------------------------------------------------------------------- 1 | //! All the data sent between egui and the backend 2 | 3 | pub mod input; 4 | pub mod output; 5 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/src/util/fixed_cache.rs: -------------------------------------------------------------------------------- 1 | use epaint::util::hash; 2 | 3 | const FIXED_CACHE_SIZE: usize = 1024; // must be small for web/WASM build (for unknown reason) 4 | 5 | /// Very stupid/simple key-value cache. TODO(emilk): improve 6 | #[derive(Clone)] 7 | pub(crate) struct FixedCache([Option<(K, V)>; FIXED_CACHE_SIZE]); 8 | 9 | impl Default for FixedCache 10 | where 11 | K: Copy, 12 | V: Copy, 13 | { 14 | fn default() -> Self { 15 | Self([None; FIXED_CACHE_SIZE]) 16 | } 17 | } 18 | 19 | impl std::fmt::Debug for FixedCache { 20 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 21 | write!(f, "Cache") 22 | } 23 | } 24 | 25 | impl FixedCache 26 | where 27 | K: std::hash::Hash + PartialEq, 28 | { 29 | pub fn get(&self, key: &K) -> Option<&V> { 30 | let bucket = (hash(key) % (FIXED_CACHE_SIZE as u64)) as usize; 31 | match &self.0[bucket] { 32 | Some((k, v)) if k == key => Some(v), 33 | _ => None, 34 | } 35 | } 36 | 37 | pub fn set(&mut self, key: K, value: V) { 38 | let bucket = (hash(&key) % (FIXED_CACHE_SIZE as u64)) as usize; 39 | self.0[bucket] = Some((key, value)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/src/util/mod.rs: -------------------------------------------------------------------------------- 1 | //! Miscellaneous tools used by the rest of egui. 2 | 3 | pub mod cache; 4 | pub(crate) mod fixed_cache; 5 | mod history; 6 | pub mod id_type_map; 7 | pub mod undoer; 8 | 9 | pub use history::History; 10 | pub use id_type_map::IdTypeMap; 11 | 12 | pub use epaint::util::{hash, hash_with}; 13 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/src/widgets/text_edit/mod.rs: -------------------------------------------------------------------------------- 1 | mod builder; 2 | mod cursor_range; 3 | mod output; 4 | mod state; 5 | mod text_buffer; 6 | 7 | pub use { 8 | builder::TextEdit, cursor_range::*, output::TextEditOutput, state::TextEditState, 9 | text_buffer::TextBuffer, 10 | }; 11 | -------------------------------------------------------------------------------- /lib/egui/crates/egui/src/widgets/text_edit/output.rs: -------------------------------------------------------------------------------- 1 | use std::sync::Arc; 2 | 3 | /// The output from a [`TextEdit`](crate::TextEdit). 4 | pub struct TextEditOutput { 5 | /// The interaction response. 6 | pub response: crate::Response, 7 | 8 | /// How the text was displayed. 9 | pub galley: Arc, 10 | 11 | /// Where the text in [`Self::galley`] ended up on the screen. 12 | pub text_draw_pos: crate::Pos2, 13 | 14 | /// The text was clipped to this rectangle when painted. 15 | pub text_clip_rect: crate::Rect, 16 | 17 | /// The state we stored after the run. 18 | pub state: super::TextEditState, 19 | 20 | /// Where the text cursor is. 21 | pub cursor_range: Option, 22 | } 23 | 24 | // TODO(emilk): add `output.paint` and `output.store` and split out that code from `TextEdit::show`. 25 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_demo_app/README.md: -------------------------------------------------------------------------------- 1 | # egui demo app 2 | This app demonstrates [`egui`](https://github.com/emilk/egui/) and [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe). 3 | 4 | View the demo app online at . 5 | 6 | Run it locally with `cargo run --release -p egui_demo_app`. 7 | 8 | `egui_demo_app` can be compiled to WASM and viewed in a browser locally with: 9 | 10 | ```sh 11 | ./sh/start_server.sh & 12 | ./sh/build_demo_web.sh --open 13 | ``` 14 | 15 | `egui_demo_app` uses [`egui_demo_lib`](https://github.com/emilk/egui/tree/master/crates/egui_demo_lib). 16 | 17 | 18 | ## Running with `wgpu` backend 19 | `(cd egui_demo_app && cargo r --features wgpu)` 20 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_demo_app/src/apps/custom3d_wgpu_shader.wgsl: -------------------------------------------------------------------------------- 1 | struct VertexOut { 2 | @location(0) color: vec4, 3 | @builtin(position) position: vec4, 4 | }; 5 | 6 | struct Uniforms { 7 | angle: f32, 8 | }; 9 | 10 | @group(0) @binding(0) 11 | var uniforms: Uniforms; 12 | 13 | var v_positions: array, 3> = array, 3>( 14 | vec2(0.0, 1.0), 15 | vec2(1.0, -1.0), 16 | vec2(-1.0, -1.0), 17 | ); 18 | 19 | var v_colors: array, 3> = array, 3>( 20 | vec4(1.0, 0.0, 0.0, 1.0), 21 | vec4(0.0, 1.0, 0.0, 1.0), 22 | vec4(0.0, 0.0, 1.0, 1.0), 23 | ); 24 | 25 | @vertex 26 | fn vs_main(@builtin(vertex_index) v_idx: u32) -> VertexOut { 27 | var out: VertexOut; 28 | 29 | out.position = vec4(v_positions[v_idx], 0.0, 1.0); 30 | out.position.x = out.position.x * cos(uniforms.angle); 31 | out.color = v_colors[v_idx]; 32 | 33 | return out; 34 | } 35 | 36 | @fragment 37 | fn fs_main(in: VertexOut) -> @location(0) vec4 { 38 | return in.color; 39 | } 40 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_demo_app/src/apps/mod.rs: -------------------------------------------------------------------------------- 1 | #[cfg(all(feature = "glow", not(feature = "wgpu")))] 2 | mod custom3d_glow; 3 | 4 | #[cfg(feature = "wgpu")] 5 | mod custom3d_wgpu; 6 | 7 | mod fractal_clock; 8 | 9 | #[cfg(feature = "http")] 10 | mod http_app; 11 | 12 | #[cfg(all(feature = "glow", not(feature = "wgpu")))] 13 | pub use custom3d_glow::Custom3d; 14 | 15 | #[cfg(feature = "wgpu")] 16 | pub use custom3d_wgpu::Custom3d; 17 | 18 | pub use fractal_clock::FractalClock; 19 | 20 | #[cfg(feature = "http")] 21 | pub use http_app::HttpApp; 22 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_demo_app/src/main.rs: -------------------------------------------------------------------------------- 1 | //! Demo app for egui 2 | 3 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release 4 | 5 | // When compiling natively: 6 | fn main() { 7 | // Log to stdout (if you run with `RUST_LOG=debug`). 8 | tracing_subscriber::fmt::init(); 9 | 10 | let options = eframe::NativeOptions { 11 | drag_and_drop_support: true, 12 | 13 | initial_window_size: Some([1280.0, 1024.0].into()), 14 | 15 | #[cfg(feature = "wgpu")] 16 | renderer: eframe::Renderer::Wgpu, 17 | 18 | ..Default::default() 19 | }; 20 | eframe::run_native( 21 | "egui demo app", 22 | options, 23 | Box::new(|cc| Box::new(egui_demo_app::WrapApp::new(cc))), 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_demo_lib/README.md: -------------------------------------------------------------------------------- 1 | # [`egui`](https://github.com/emilk/egui) demo library 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_demo_lib.svg)](https://crates.io/crates/egui_demo_lib) 4 | [![Documentation](https://docs.rs/egui_demo_lib/badge.svg)](https://docs.rs/egui_demo_lib) 5 | [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) 6 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 7 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 8 | 9 | This crate contains example code for [`egui`](https://github.com/emilk/egui). 10 | 11 | The demo library is a separate crate for three reasons: 12 | 13 | * To ensure it only uses the public `egui` api. 14 | * To remove the amount of code in `egui` proper. 15 | * To make it easy for 3rd party egui integrations to use it for tests. 16 | - See for instance https://github.com/not-fl3/egui-miniquad/blob/master/examples/demo.rs 17 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_demo_lib/src/demo/mod.rs: -------------------------------------------------------------------------------- 1 | //! Demo-code for showing how egui is used. 2 | //! 3 | //! The demo-code is also used in benchmarks and tests. 4 | 5 | // ---------------------------------------------------------------------------- 6 | 7 | pub mod about; 8 | pub mod code_editor; 9 | pub mod code_example; 10 | pub mod context_menu; 11 | pub mod dancing_strings; 12 | pub mod demo_app_windows; 13 | pub mod drag_and_drop; 14 | pub mod font_book; 15 | pub mod layout_test; 16 | pub mod misc_demo_window; 17 | pub mod multi_touch; 18 | pub mod paint_bezier; 19 | pub mod painting; 20 | pub mod password; 21 | pub mod plot_demo; 22 | pub mod scrolling; 23 | pub mod sliders; 24 | pub mod strip_demo; 25 | pub mod table_demo; 26 | pub mod tests; 27 | pub mod text_edit; 28 | pub mod toggle_switch; 29 | pub mod widget_gallery; 30 | pub mod window_options; 31 | pub mod window_with_panels; 32 | 33 | pub use { 34 | about::About, demo_app_windows::DemoWindows, misc_demo_window::MiscDemoWindow, 35 | widget_gallery::WidgetGallery, 36 | }; 37 | 38 | // ---------------------------------------------------------------------------- 39 | 40 | /// Something to view in the demo windows 41 | pub trait View { 42 | fn ui(&mut self, ui: &mut egui::Ui); 43 | } 44 | 45 | /// Something to view 46 | pub trait Demo { 47 | /// `&'static` so we can also use it as a key to store open/close state. 48 | fn name(&self) -> &'static str; 49 | 50 | /// Show windows, etc 51 | fn show(&mut self, ctx: &egui::Context, open: &mut bool); 52 | } 53 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_demo_lib/src/easy_mark/mod.rs: -------------------------------------------------------------------------------- 1 | //! Experimental markup language 2 | 3 | mod easy_mark_editor; 4 | mod easy_mark_highlighter; 5 | pub mod easy_mark_parser; 6 | mod easy_mark_viewer; 7 | 8 | pub use easy_mark_editor::EasyMarkEditor; 9 | pub use easy_mark_highlighter::MemoizedEasymarkHighlighter; 10 | pub use easy_mark_parser as parser; 11 | pub use easy_mark_viewer::easy_mark; 12 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_extras/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for egui_extras 2 | All notable changes to the `egui_extras` integration will be noted in this file. 3 | 4 | 5 | ## Unreleased 6 | 7 | 8 | ## 0.19.0 - 2022-08-20 9 | * MSRV (Minimum Supported Rust Version) is now `1.61.0` ([#1846](https://github.com/emilk/egui/pull/1846)). 10 | * You can now specify a texture filter for `RetainedImage` ([#1636](https://github.com/emilk/egui/pull/1636)). 11 | * Fixed uneven `Table` striping ([#1680](https://github.com/emilk/egui/pull/1680)). 12 | 13 | 14 | ## 0.18.0 - 2022-04-30 15 | * Added `Strip`, `Table` and `DatePicker` ([#963](https://github.com/emilk/egui/pull/963)). 16 | * MSRV (Minimum Supported Rust Version) is now `1.60.0` ([#1467](https://github.com/emilk/egui/pull/1467)). 17 | * Renamed feature "persistence" to "serde" ([#1540](https://github.com/emilk/egui/pull/1540)). 18 | 19 | 20 | ## 0.17.0 - 2022-02-22 21 | * `RetainedImage`: convenience for loading svg, png, jpeg etc and showing them in egui. 22 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_extras/README.md: -------------------------------------------------------------------------------- 1 | # egui_extras 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_extras.svg)](https://crates.io/crates/egui_extras) 4 | [![Documentation](https://docs.rs/egui_extras/badge.svg)](https://docs.rs/egui_extras) 5 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 6 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 7 | 8 | This is a crate that adds some features on top top of [`egui`](https://github.com/emilk/egui). This crate is for experimental features, and features that require big dependencies that do not belong in `egui`. 9 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_extras/src/datepicker/mod.rs: -------------------------------------------------------------------------------- 1 | mod button; 2 | mod popup; 3 | 4 | pub use button::DatePickerButton; 5 | use chrono::{Date, Datelike, Duration, NaiveDate, Utc, Weekday}; 6 | 7 | #[derive(Debug)] 8 | struct Week { 9 | number: u8, 10 | days: Vec>, 11 | } 12 | 13 | fn month_data(year: i32, month: u32) -> Vec { 14 | let first = Date::from_utc(NaiveDate::from_ymd(year, month, 1), Utc); 15 | let mut start = first; 16 | while start.weekday() != Weekday::Mon { 17 | start = start.checked_sub_signed(Duration::days(1)).unwrap(); 18 | } 19 | let mut weeks = vec![]; 20 | let mut week = vec![]; 21 | while start < first || start.month() == first.month() || start.weekday() != Weekday::Mon { 22 | week.push(start); 23 | 24 | if start.weekday() == Weekday::Sun { 25 | weeks.push(Week { 26 | number: start.iso_week().week() as u8, 27 | days: week.drain(..).collect(), 28 | }); 29 | } 30 | start = start.checked_add_signed(Duration::days(1)).unwrap(); 31 | } 32 | 33 | weeks 34 | } 35 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/README.md: -------------------------------------------------------------------------------- 1 | # egui_glium 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_glium.svg)](https://crates.io/crates/egui_glium) 4 | [![Documentation](https://docs.rs/egui_glium/badge.svg)](https://docs.rs/egui_glium) 5 | [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) 6 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 7 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 8 | 9 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [glium](https://crates.io/crates/glium) which allows you to write GUI code using egui and compile it and run it natively, cross platform. 10 | 11 | To use on Linux, first run: 12 | 13 | ``` 14 | sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev 15 | ``` 16 | 17 | This crate depends on [`egui-winit`](https://github.com/emilk/egui/tree/master/crates/egui-winit). 18 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/src/shader/fragment_120.glsl: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform sampler2D u_sampler; 4 | varying vec4 v_rgba; 5 | varying vec2 v_tc; 6 | 7 | void main() { 8 | // The texture sampler is sRGB aware, and glium already expects linear rgba output 9 | // so no need for any sRGB conversions here: 10 | gl_FragColor = v_rgba * texture2D(u_sampler, v_tc); 11 | } 12 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/src/shader/fragment_140.glsl: -------------------------------------------------------------------------------- 1 | #version 140 2 | 3 | uniform sampler2D u_sampler; 4 | in vec4 v_rgba; 5 | in vec2 v_tc; 6 | out vec4 f_color; 7 | 8 | void main() { 9 | // The texture sampler is sRGB aware, and glium already expects linear rgba output 10 | // so no need for any sRGB conversions here: 11 | f_color = v_rgba * texture(u_sampler, v_tc); 12 | } 13 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/src/shader/fragment_300es.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | precision mediump float; 4 | uniform sampler2D u_sampler; 5 | varying vec4 v_rgba; 6 | varying vec2 v_tc; 7 | 8 | // 0-255 sRGB from 0-1 linear 9 | vec3 srgb_from_linear(vec3 rgb) { 10 | bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); 11 | vec3 lower = rgb * vec3(3294.6); 12 | vec3 higher = vec3(269.025) * pow(rgb, vec3(1.0 / 2.4)) - vec3(14.025); 13 | return mix(higher, lower, vec3(cutoff)); 14 | } 15 | 16 | vec4 srgba_from_linear(vec4 rgba) { 17 | return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a); 18 | } 19 | 20 | void main() { 21 | // The texture is set up with `SRGB8_ALPHA8`, so no need to decode here! 22 | vec4 texture_rgba = texture2D(u_sampler, v_tc); 23 | 24 | /// Multiply vertex color with texture color (in linear space). 25 | gl_FragColor = v_rgba * texture_rgba; 26 | 27 | // We must gamma-encode again since WebGL doesn't support linear blending in the framebuffer. 28 | gl_FragColor = srgba_from_linear(v_rgba * texture_rgba) / 255.0; 29 | 30 | // WebGL doesn't support linear blending in the framebuffer, 31 | // so we apply this hack to at least get a bit closer to the desired blending: 32 | gl_FragColor.a = pow(gl_FragColor.a, 1.6); // Empiric nonsense 33 | } 34 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/src/shader/vertex_100es.glsl: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | uniform vec2 u_screen_size; 5 | attribute vec2 a_pos; 6 | attribute vec2 a_tc; 7 | attribute vec4 a_srgba; 8 | varying vec4 v_rgba; 9 | varying vec2 v_tc; 10 | 11 | // 0-1 linear from 0-255 sRGB 12 | vec3 linear_from_srgb(vec3 srgb) { 13 | bvec3 cutoff = lessThan(srgb, vec3(10.31475)); 14 | vec3 lower = srgb / vec3(3294.6); 15 | vec3 higher = pow((srgb + vec3(14.025)) / vec3(269.025), vec3(2.4)); 16 | return mix(higher, lower, vec3(cutoff)); 17 | } 18 | 19 | vec4 linear_from_srgba(vec4 srgba) { 20 | return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0); 21 | } 22 | 23 | void main() { 24 | gl_Position = vec4( 25 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 26 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 27 | 0.0, 28 | 1.0); 29 | // egui encodes vertex colors in gamma spaces, so we must decode the colors here: 30 | v_rgba = linear_from_srgba(a_srgba); 31 | v_tc = a_tc; 32 | } 33 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/src/shader/vertex_120.glsl: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | uniform vec2 u_screen_size; 4 | attribute vec2 a_pos; 5 | attribute vec4 a_srgba; // 0-255 sRGB 6 | attribute vec2 a_tc; 7 | varying vec4 v_rgba; 8 | varying vec2 v_tc; 9 | 10 | // 0-1 linear from 0-255 sRGB 11 | vec3 linear_from_srgb(vec3 srgb) { 12 | bvec3 cutoff = lessThan(srgb, vec3(10.31475)); 13 | vec3 lower = srgb / vec3(3294.6); 14 | vec3 higher = pow((srgb + vec3(14.025)) / vec3(269.025), vec3(2.4)); 15 | return mix(higher, lower, vec3(cutoff)); 16 | } 17 | 18 | vec4 linear_from_srgba(vec4 srgba) { 19 | return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0); 20 | } 21 | 22 | void main() { 23 | gl_Position = vec4( 24 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 25 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 26 | 0.0, 27 | 1.0); 28 | // egui encodes vertex colors in gamma spaces, so we must decode the colors here: 29 | v_rgba = linear_from_srgba(a_srgba); 30 | v_tc = a_tc; 31 | } 32 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/src/shader/vertex_140.glsl: -------------------------------------------------------------------------------- 1 | #version 140 2 | 3 | uniform vec2 u_screen_size; 4 | in vec2 a_pos; 5 | in vec4 a_srgba; // 0-255 sRGB 6 | in vec2 a_tc; 7 | out vec4 v_rgba; 8 | out vec2 v_tc; 9 | 10 | // 0-1 linear from 0-255 sRGB 11 | vec3 linear_from_srgb(vec3 srgb) { 12 | bvec3 cutoff = lessThan(srgb, vec3(10.31475)); 13 | vec3 lower = srgb / vec3(3294.6); 14 | vec3 higher = pow((srgb + vec3(14.025)) / vec3(269.025), vec3(2.4)); 15 | return mix(higher, lower, cutoff); 16 | } 17 | 18 | vec4 linear_from_srgba(vec4 srgba) { 19 | return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0); 20 | } 21 | 22 | void main() { 23 | gl_Position = vec4( 24 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 25 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 26 | 0.0, 27 | 1.0); 28 | // egui encodes vertex colors in gamma spaces, so we must decode the colors here: 29 | v_rgba = linear_from_srgba(a_srgba); 30 | v_tc = a_tc; 31 | } 32 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glium/src/shader/vertex_300es.glsl: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | precision mediump float; 4 | uniform vec2 u_screen_size; 5 | attribute vec2 a_pos; 6 | attribute vec2 a_tc; 7 | attribute vec4 a_srgba; 8 | varying vec4 v_rgba; 9 | varying vec2 v_tc; 10 | 11 | // 0-1 linear from 0-255 sRGB 12 | vec3 linear_from_srgb(vec3 srgb) { 13 | bvec3 cutoff = lessThan(srgb, vec3(10.31475)); 14 | vec3 lower = srgb / vec3(3294.6); 15 | vec3 higher = pow((srgb + vec3(14.025)) / vec3(269.025), vec3(2.4)); 16 | return mix(higher, lower, vec3(cutoff)); 17 | } 18 | 19 | vec4 linear_from_srgba(vec4 srgba) { 20 | return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0); 21 | } 22 | 23 | void main() { 24 | gl_Position = vec4( 25 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 26 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 27 | 0.0, 28 | 1.0); 29 | // egui encodes vertex colors in gamma spaces, so we must decode the colors here: 30 | v_rgba = linear_from_srgba(a_srgba); 31 | v_tc = a_tc; 32 | } 33 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glow/README.md: -------------------------------------------------------------------------------- 1 | # egui_glow 2 | 3 | [![Latest version](https://img.shields.io/crates/v/egui_glow.svg)](https://crates.io/crates/egui_glow) 4 | [![Documentation](https://docs.rs/egui_glow/badge.svg)](https://docs.rs/egui_glow) 5 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 6 | ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) 7 | 8 | This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [glow](https://crates.io/crates/glow) which allows you to: 9 | * Render egui using glow on both native and web. 10 | * Write cross platform native egui apps (with the `winit` feature). 11 | 12 | To write web apps using `glow` you can use [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe) (which uses `egui_glow` for rendering). 13 | 14 | To use on Linux, first run: 15 | 16 | ``` 17 | sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev 18 | ``` 19 | 20 | This crate optionally depends on [`egui-winit`](https://github.com/emilk/egui/tree/master/crates/egui-winit). 21 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glow/src/misc_util.rs: -------------------------------------------------------------------------------- 1 | #![allow(unsafe_code)] 2 | 3 | use glow::HasContext as _; 4 | 5 | pub(crate) unsafe fn compile_shader( 6 | gl: &glow::Context, 7 | shader_type: u32, 8 | source: &str, 9 | ) -> Result { 10 | let shader = gl.create_shader(shader_type)?; 11 | 12 | gl.shader_source(shader, source); 13 | 14 | gl.compile_shader(shader); 15 | 16 | if gl.get_shader_compile_status(shader) { 17 | Ok(shader) 18 | } else { 19 | Err(gl.get_shader_info_log(shader)) 20 | } 21 | } 22 | 23 | pub(crate) unsafe fn link_program<'a, T: IntoIterator>( 24 | gl: &glow::Context, 25 | shaders: T, 26 | ) -> Result { 27 | let program = gl.create_program()?; 28 | 29 | for shader in shaders { 30 | gl.attach_shader(program, *shader); 31 | } 32 | 33 | gl.link_program(program); 34 | 35 | if gl.get_program_link_status(program) { 36 | Ok(program) 37 | } else { 38 | Err(gl.get_program_info_log(program)) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glow/src/shader/post_fragment_100es.glsl: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | uniform sampler2D u_sampler; 3 | varying vec2 v_tc; 4 | 5 | // 0-255 sRGB from 0-1 linear 6 | vec3 srgb_from_linear(vec3 rgb) { 7 | bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); 8 | vec3 lower = rgb * vec3(3294.6); 9 | vec3 higher = vec3(269.025) * pow(rgb, vec3(1.0 / 2.4)) - vec3(14.025); 10 | return mix(higher, lower, vec3(cutoff)); 11 | } 12 | 13 | // 0-255 sRGBA from 0-1 linear 14 | vec4 srgba_from_linear(vec4 rgba) { 15 | return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a); 16 | } 17 | 18 | void main() { 19 | gl_FragColor = texture2D(u_sampler, v_tc); 20 | 21 | gl_FragColor = srgba_from_linear(gl_FragColor) / 255.0; 22 | 23 | #ifdef APPLY_BRIGHTENING_GAMMA 24 | gl_FragColor = vec4(pow(gl_FragColor.rgb, vec3(1.0/2.2)), gl_FragColor.a); 25 | #endif 26 | } 27 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glow/src/shader/post_vertex_100es.glsl: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | attribute vec2 a_pos; 3 | varying vec2 v_tc; 4 | 5 | void main() { 6 | gl_Position = vec4(a_pos * 2. - 1., 0.0, 1.0); 7 | v_tc = a_pos; 8 | } 9 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_glow/src/shader/vertex_ttsim.glsl: -------------------------------------------------------------------------------- 1 | #ifdef NEW_SHADER_INTERFACE 2 | #define I in 3 | #define O out 4 | #define V(x) x 5 | #else 6 | #define I attribute 7 | #define O varying 8 | #define V(x) vec3(x) 9 | #endif 10 | 11 | #ifdef GL_ES 12 | precision mediump float; 13 | #endif 14 | 15 | uniform vec2 u_screen_size; 16 | I vec2 a_pos; 17 | I vec4 a_srgba; // 0-255 sRGB 18 | I vec2 a_tc; 19 | O vec4 v_rgba; 20 | O vec2 v_tc; 21 | 22 | // 0-1 linear from 0-255 sRGB 23 | vec3 linear_from_srgb(vec3 srgb) { 24 | bvec3 cutoff = lessThan(srgb, vec3(10.31475)); 25 | vec3 lower = srgb / vec3(3294.6); 26 | vec3 higher = pow((srgb + vec3(14.025)) / vec3(269.025), vec3(2.4)); 27 | return mix(higher, lower, V(cutoff)); 28 | } 29 | 30 | vec4 linear_from_srgba(vec4 srgba) { 31 | return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0); 32 | } 33 | 34 | void main() { 35 | gl_Position = vec4( 36 | 2.0 * a_pos.x / u_screen_size.x - 1.0, 37 | 1.0 - 2.0 * a_pos.y / u_screen_size.y, 38 | 0.0, 39 | 1.0); 40 | // egui encodes vertex colors in gamma space, so we must decode the colors here: 41 | v_rgba = linear_from_srgba(a_srgba); 42 | v_tc = a_tc; 43 | } 44 | -------------------------------------------------------------------------------- /lib/egui/crates/egui_web/README.md: -------------------------------------------------------------------------------- 1 | `egui_web` used to be a standalone crate, but has now been moved into [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe). 2 | -------------------------------------------------------------------------------- /lib/egui/crates/emath/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "emath" 3 | version = "0.19.0" 4 | authors = ["Emil Ernerfeldt "] 5 | description = "Minimal 2D math library for GUI work" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | homepage = "https://github.com/emilk/egui/tree/master/crates/emath" 9 | license = "MIT OR Apache-2.0" 10 | readme = "README.md" 11 | repository = "https://github.com/emilk/egui/tree/master/crates/emath" 12 | categories = ["mathematics", "gui"] 13 | keywords = ["math", "gui"] 14 | include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] 15 | 16 | [package.metadata.docs.rs] 17 | all-features = true 18 | 19 | [lib] 20 | 21 | 22 | [features] 23 | default = [] 24 | 25 | ## Enable additional checks if debug assertions are enabled (debug builds). 26 | extra_debug_asserts = [] 27 | ## Always enable additional checks. 28 | extra_asserts = [] 29 | 30 | 31 | [dependencies] 32 | #! ### Optional dependencies 33 | 34 | ## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast `emath` types to `&[u8]`. 35 | bytemuck = { version = "1.7.2", optional = true, features = ["derive"] } 36 | 37 | ## Enable this when generating docs. 38 | document-features = { version = "0.2", optional = true } 39 | 40 | ## [`mint`](https://docs.rs/mint) enables interopability with other math libraries such as [`glam`](https://docs.rs/glam) and [`nalgebra`](https://docs.rs/nalgebra). 41 | mint = { version = "0.5.6", optional = true } 42 | 43 | ## Allow serialization using [`serde`](https://docs.rs/serde). 44 | serde = { version = "1", optional = true, features = ["derive"] } 45 | -------------------------------------------------------------------------------- /lib/egui/crates/emath/README.md: -------------------------------------------------------------------------------- 1 | # emath - egui math library 2 | 3 | A bare-bones 2D math library with types and functions useful for GUI building. 4 | 5 | Made for [`egui`](https://github.com/emilk/egui/). 6 | -------------------------------------------------------------------------------- /lib/egui/crates/epaint/README.md: -------------------------------------------------------------------------------- 1 | # epaint - egui paint library 2 | 3 | A bare-bones 2D graphics library for turning simple 2D shapes and text into textured triangles. 4 | 5 | Made for [`egui`](https://github.com/emilk/egui/). 6 | -------------------------------------------------------------------------------- /lib/egui/crates/epaint/fonts/Hack-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui/crates/epaint/fonts/Hack-Regular.ttf -------------------------------------------------------------------------------- /lib/egui/crates/epaint/fonts/NotoEmoji-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui/crates/epaint/fonts/NotoEmoji-Regular.ttf -------------------------------------------------------------------------------- /lib/egui/crates/epaint/fonts/Ubuntu-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui/crates/epaint/fonts/Ubuntu-Light.ttf -------------------------------------------------------------------------------- /lib/egui/crates/epaint/fonts/emoji-icon-font-mit-license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014 John Slegers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /lib/egui/crates/epaint/fonts/emoji-icon-font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui/crates/epaint/fonts/emoji-icon-font.ttf -------------------------------------------------------------------------------- /lib/egui/crates/epaint/fonts/list_fonts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from fontTools.ttLib import TTFont 3 | from fontTools.unicode import Unicode 4 | from itertools import chain 5 | import sys 6 | 7 | ttf = TTFont(sys.argv[1], 0, verbose=0, allowVID=0, 8 | ignoreDecompileErrors=True, 9 | fontNumber=-1) 10 | 11 | chars = chain.from_iterable([y + (Unicode[y[0]],) 12 | for y in x.cmap.items()] for x in ttf["cmap"].tables) 13 | 14 | 15 | all_codepoints = {} 16 | 17 | for entry in chars: 18 | codepoint = entry[0] 19 | short_name = entry[1] 20 | long_name = entry[2].lower() 21 | if False: 22 | print(f'(0x{codepoint:02X}, "{short_name}", "{long_name}"),') 23 | else: 24 | name = short_name if long_name == "????" else long_name 25 | # print(f'(0x{codepoint:02X}, "{name}"),') 26 | all_codepoints[codepoint] = name 27 | 28 | for codepoint in sorted(all_codepoints.keys()): 29 | name = all_codepoints[codepoint] 30 | print(f'(0x{codepoint:02X}, \'{chr(codepoint)}\', "{name}"),') 31 | 32 | ttf.close() 33 | -------------------------------------------------------------------------------- /lib/egui/crates/epaint/src/stroke.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::derive_hash_xor_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine 2 | 3 | use super::*; 4 | 5 | /// Describes the width and color of a line. 6 | /// 7 | /// The default stroke is the same as [`Stroke::none`]. 8 | #[derive(Clone, Copy, Debug, Default, PartialEq)] 9 | #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] 10 | pub struct Stroke { 11 | pub width: f32, 12 | pub color: Color32, 13 | } 14 | 15 | impl Stroke { 16 | /// Same as [`Stroke::default`]. 17 | #[inline(always)] 18 | pub fn none() -> Self { 19 | Self::new(0.0, Color32::TRANSPARENT) 20 | } 21 | 22 | #[inline] 23 | pub fn new(width: impl Into, color: impl Into) -> Self { 24 | Self { 25 | width: width.into(), 26 | color: color.into(), 27 | } 28 | } 29 | 30 | /// True if width is zero or color is transparent 31 | #[inline] 32 | pub fn is_empty(&self) -> bool { 33 | self.width <= 0.0 || self.color == Color32::TRANSPARENT 34 | } 35 | } 36 | 37 | impl From<(f32, Color)> for Stroke 38 | where 39 | Color: Into, 40 | { 41 | #[inline(always)] 42 | fn from((width, color): (f32, Color)) -> Stroke { 43 | Stroke::new(width, color) 44 | } 45 | } 46 | 47 | impl std::hash::Hash for Stroke { 48 | #[inline(always)] 49 | fn hash(&self, state: &mut H) { 50 | let Self { width, color } = *self; 51 | crate::f32_hash(state, width); 52 | color.hash(state); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/egui/crates/epaint/src/text/mod.rs: -------------------------------------------------------------------------------- 1 | //! Everything related to text, fonts, text layout, cursors etc. 2 | 3 | pub mod cursor; 4 | mod font; 5 | mod fonts; 6 | mod text_layout; 7 | mod text_layout_types; 8 | 9 | /// One `\t` character is this many spaces wide. 10 | pub const TAB_SIZE: usize = 4; 11 | 12 | pub use { 13 | fonts::{FontData, FontDefinitions, FontFamily, FontId, FontTweak, Fonts, FontsImpl}, 14 | text_layout::layout, 15 | text_layout_types::*, 16 | }; 17 | 18 | /// Suggested character to use to replace those in password text fields. 19 | pub const PASSWORD_REPLACEMENT_CHAR: char = '•'; 20 | -------------------------------------------------------------------------------- /lib/egui/crates/epaint/src/util/mod.rs: -------------------------------------------------------------------------------- 1 | mod ordered_float; 2 | 3 | pub use ordered_float::*; 4 | 5 | /// Hash the given value with a predictable hasher. 6 | #[inline] 7 | pub fn hash(value: impl std::hash::Hash) -> u64 { 8 | use std::hash::Hasher as _; 9 | let mut hasher = ahash::AHasher::default(); 10 | value.hash(&mut hasher); 11 | hasher.finish() 12 | } 13 | 14 | /// Hash the given value with the given hasher. 15 | #[inline] 16 | pub fn hash_with(value: impl std::hash::Hash, mut hasher: impl std::hash::Hasher) -> u64 { 17 | value.hash(&mut hasher); 18 | hasher.finish() 19 | } 20 | -------------------------------------------------------------------------------- /lib/egui/docs/CNAME: -------------------------------------------------------------------------------- 1 | www.egui.rs -------------------------------------------------------------------------------- /lib/egui/docs/README.md: -------------------------------------------------------------------------------- 1 | This folder contains the files required for the egui web demo hosted at . 2 | 3 | The reason the folder is called "docs" is because that is the name that GitHub requires in order to host a web page from the `master` branch of a repository. 4 | -------------------------------------------------------------------------------- /lib/egui/docs/egui_demo_app_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui/docs/egui_demo_app_bg.wasm -------------------------------------------------------------------------------- /lib/egui/docs/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/egui/docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui/docs/favicon.ico -------------------------------------------------------------------------------- /lib/egui/examples/README.md: -------------------------------------------------------------------------------- 1 | # `egui` and `eframe` examples 2 | All the examples in this folder uses [`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe) to set up a window for [`egui`](https://github.com/emilk/egui/). Some examples are specific to `eframe`, but many are applicable to any `egui` integration. 3 | 4 | There are a lot more examples at , and it has links to the source code of each example. 5 | 6 | Also check out the official docs at and . 7 | -------------------------------------------------------------------------------- /lib/egui/examples/confirm_exit/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "confirm_exit" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui/examples/confirm_exit/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p confirm_exit 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_3d_glow/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_3d_glow" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe", features = ["glow"] } 13 | egui_glow = { path = "../../crates/egui_glow" } 14 | glow = "0.11" 15 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_3d_glow/README.md: -------------------------------------------------------------------------------- 1 | This demo shows how to embed 3D rendering using [`glow`](https://github.com/grovesNL/glow) in `eframe`. 2 | 3 | This is very advanced usage, and you need to be careful. 4 | 5 | If you want an easier way to show 3D graphics with egui, take a look at the `custom_3d_three-d.rs` example. 6 | 7 | If you are content of having egui sit on top of a 3D background, take a look at: 8 | 9 | * [`bevy_egui`](https://github.com/mvlabat/bevy_egui) 10 | * [`three-d`](https://github.com/asny/three-d) 11 | 12 | 13 | ```sh 14 | cargo run -p custom_3d_glow 15 | ``` 16 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_3d_three-d/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_3d_three-d" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | [lib] 11 | crate-type = ["cdylib", "rlib"] 12 | 13 | [dependencies] 14 | eframe = { path = "../../crates/eframe", features = ["glow"] } 15 | egui_glow = { path = "../../crates/egui_glow" } 16 | glow = "0.11" 17 | three-d = { version = "0.13", default-features = false } 18 | 19 | [target.'cfg(target_arch = "wasm32")'.dependencies] # Web dependencies 20 | wasm-bindgen = "0.2" # Core bindings 21 | wasm-bindgen-futures = "0.4" # Core bindings 22 | console_error_panic_hook = "0.1" # For logging 23 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_3d_three-d/README.md: -------------------------------------------------------------------------------- 1 | This demo shows how to embed 3D rendering using [`three-d`](https://github.com/asny/three-d) in `eframe`. 2 | 3 | Any 3D library built on top of [`glow`](https://github.com/grovesNL/glow) can be used in `eframe`. 4 | 5 | Alternatively you can render 3D stuff to a texture and display it using [`egui::Ui::image`]. 6 | 7 | If you are content of having egui sit on top of a 3D background, take a look at: 8 | 9 | * [`bevy_egui`](https://github.com/mvlabat/bevy_egui) 10 | * [`three-d`](https://github.com/asny/three-d) 11 | 12 | 13 | 14 | ```sh 15 | cargo run -p custom_3d_three-d 16 | ``` 17 | 18 | ``` 19 | wasm-pack build examples/custom_3d_three-d --target web 20 | ``` 21 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_3d_three-d/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod main; 2 | 3 | // Entry point for wasm 4 | #[cfg(target_arch = "wasm32")] 5 | use wasm_bindgen::prelude::*; 6 | 7 | #[cfg(target_arch = "wasm32")] 8 | #[wasm_bindgen(start)] 9 | pub async fn start() -> Result<(), JsValue> { 10 | std::panic::set_hook(Box::new(console_error_panic_hook::hook)); 11 | 12 | let web_options = eframe::WebOptions::default(); 13 | eframe::start_web( 14 | "my", 15 | web_options, 16 | Box::new(|cc| Box::new(main::MyApp::new(cc))), 17 | )?; 18 | Ok(()) 19 | } 20 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_font/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_font" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_font/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p custom_font 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_font_style/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_font_style" 3 | version = "0.1.0" 4 | authors = ["tami5 "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_font_style/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p custom_font_style 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_window_frame/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "custom_window_frame" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui/examples/custom_window_frame/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p custom_window_frame 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/download_image/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "download_image" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["image"] } 14 | ehttp = "0.2" 15 | image = { version = "0.24", default-features = false, features = ["jpeg"] } 16 | poll-promise = "0.1" 17 | -------------------------------------------------------------------------------- /lib/egui/examples/download_image/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p download_image 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/file_dialog/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "file_dialog" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | rfd = "0.10" 14 | -------------------------------------------------------------------------------- /lib/egui/examples/file_dialog/README.md: -------------------------------------------------------------------------------- 1 | How to show a file dialog using [`rfd`](https://github.com/PolyMeilex/rfd). 2 | 3 | ```sh 4 | cargo run -p file_dialog 5 | ``` 6 | -------------------------------------------------------------------------------- /lib/egui/examples/hello_world/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello_world" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui/examples/hello_world/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p hello_world 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/hello_world/src/main.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release 2 | 3 | use eframe::egui; 4 | 5 | fn main() { 6 | let options = eframe::NativeOptions::default(); 7 | eframe::run_native( 8 | "My egui App", 9 | options, 10 | Box::new(|_cc| Box::new(MyApp::default())), 11 | ); 12 | } 13 | 14 | struct MyApp { 15 | name: String, 16 | age: u32, 17 | } 18 | 19 | impl Default for MyApp { 20 | fn default() -> Self { 21 | Self { 22 | name: "Arthur".to_owned(), 23 | age: 42, 24 | } 25 | } 26 | } 27 | 28 | impl eframe::App for MyApp { 29 | fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { 30 | egui::CentralPanel::default().show(ctx, |ui| { 31 | ui.heading("My egui Application"); 32 | ui.horizontal(|ui| { 33 | ui.label("Your name: "); 34 | ui.text_edit_singleline(&mut self.name); 35 | }); 36 | ui.add(egui::Slider::new(&mut self.age, 0..=120).text("age")); 37 | if ui.button("Click each year").clicked() { 38 | self.age += 1; 39 | } 40 | ui.label(format!("Hello '{}', age {}", self.name, self.age)); 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/egui/examples/puffin_profiler/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "puffin_profiler" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe", features = ["puffin"] } 13 | puffin = "0.13" 14 | puffin_http = "0.10" 15 | -------------------------------------------------------------------------------- /lib/egui/examples/puffin_profiler/README.md: -------------------------------------------------------------------------------- 1 | Example how to use the [puffin profiler](https://github.com/EmbarkStudios/puffin) with an `eframe` app. 2 | 3 | 4 | ```sh 5 | cargo run -p puffin_profiler & 6 | 7 | cargo install puffin_viewer 8 | puffin_viewer --url 127.0.0.1:8585 9 | ``` 10 | -------------------------------------------------------------------------------- /lib/egui/examples/retained_image/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "retained_image" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["image"] } 14 | image = { version = "0.24", default-features = false, features = ["png"] } 15 | -------------------------------------------------------------------------------- /lib/egui/examples/retained_image/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p retained_image 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/retained_image/src/rust-logo-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/egui/examples/retained_image/src/rust-logo-256x256.png -------------------------------------------------------------------------------- /lib/egui/examples/retained_image/src/rust-logo-license.txt: -------------------------------------------------------------------------------- 1 | Rust logo by Mozilla, from https://github.com/rust-lang/rust-artwork 2 | -------------------------------------------------------------------------------- /lib/egui/examples/screenshot/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "screenshot" 3 | version = "0.1.0" 4 | authors = ["René Rössler "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["image"] } 14 | itertools = "0.10.3" 15 | -------------------------------------------------------------------------------- /lib/egui/examples/screenshot/README.md: -------------------------------------------------------------------------------- 1 | ```sh 2 | cargo run -p screenshot 3 | ``` 4 | -------------------------------------------------------------------------------- /lib/egui/examples/serial_windows/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "serial_windows" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | -------------------------------------------------------------------------------- /lib/egui/examples/serial_windows/README.md: -------------------------------------------------------------------------------- 1 | Demonstrates how to open several windows after each other. 2 | 3 | NOTE: this doesn't work on Mac due to . 4 | See also . 5 | 6 | ```sh 7 | cargo run -p serial_windows 8 | ``` 9 | -------------------------------------------------------------------------------- /lib/egui/examples/svg/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "svg" 3 | version = "0.1.0" 4 | authors = ["Emil Ernerfeldt "] 5 | license = "MIT OR Apache-2.0" 6 | edition = "2021" 7 | rust-version = "1.61" 8 | publish = false 9 | 10 | 11 | [dependencies] 12 | eframe = { path = "../../crates/eframe" } 13 | egui_extras = { path = "../../crates/egui_extras", features = ["svg"] } 14 | -------------------------------------------------------------------------------- /lib/egui/examples/svg/README.md: -------------------------------------------------------------------------------- 1 | Example how to show an SVG image. 2 | 3 | 4 | ```sh 5 | cargo run -p svg 6 | ``` 7 | -------------------------------------------------------------------------------- /lib/egui/examples/svg/src/main.rs: -------------------------------------------------------------------------------- 1 | //! A good way of displaying an SVG image in egui. 2 | //! 3 | //! Requires the dependency `egui_extras` with the `svg` feature. 4 | 5 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release 6 | 7 | use eframe::egui; 8 | 9 | fn main() { 10 | let options = eframe::NativeOptions { 11 | initial_window_size: Some(egui::vec2(1000.0, 700.0)), 12 | ..Default::default() 13 | }; 14 | eframe::run_native( 15 | "svg example", 16 | options, 17 | Box::new(|_cc| Box::new(MyApp::default())), 18 | ); 19 | } 20 | 21 | struct MyApp { 22 | svg_image: egui_extras::RetainedImage, 23 | } 24 | 25 | impl Default for MyApp { 26 | fn default() -> Self { 27 | Self { 28 | svg_image: egui_extras::RetainedImage::from_svg_bytes( 29 | "rustacean-flat-happy.svg", 30 | include_bytes!("rustacean-flat-happy.svg"), 31 | ) 32 | .unwrap(), 33 | } 34 | } 35 | } 36 | 37 | impl eframe::App for MyApp { 38 | fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { 39 | egui::CentralPanel::default().show(ctx, |ui| { 40 | ui.heading("SVG example"); 41 | ui.label("The SVG is rasterized and displayed as a texture."); 42 | 43 | ui.separator(); 44 | 45 | let max_size = ui.available_size(); 46 | self.svg_image.show_max_size(ui, max_size); 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/egui/examples/svg/src/rust-logo-license.txt: -------------------------------------------------------------------------------- 1 | Rust logo by Mozilla, from https://github.com/rust-lang/rust-artwork 2 | -------------------------------------------------------------------------------- /lib/egui/rust-toolchain: -------------------------------------------------------------------------------- 1 | # If you see this, run "rustup self update" to get rustup 1.23 or newer. 2 | 3 | # NOTE: above comment is for older `rustup` (before TOML support was added), 4 | # which will treat the first line as the toolchain name, and therefore show it 5 | # to the user in the error, instead of "error: invalid channel name '[toolchain]'". 6 | 7 | [toolchain] 8 | channel = "1.61.0" 9 | components = [ "rustfmt", "clippy" ] 10 | targets = [ "wasm32-unknown-unknown" ] 11 | -------------------------------------------------------------------------------- /lib/egui/sh/docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | cargo doc -p eframe --target wasm32-unknown-unknown --lib --no-deps 7 | cargo doc -p emath -p epaint -p egui -p eframe -p egui-winit -p egui_extras -p egui_glium -p egui_glow --lib --no-deps --all-features --open 8 | 9 | # cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features' 10 | -------------------------------------------------------------------------------- /lib/egui/sh/find_bloat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | cargo bloat --release --bin egui_demo_app -n 200 | rg "egui " 7 | 8 | cargo llvm-lines -p egui_demo_lib | rg egui | head -30 9 | -------------------------------------------------------------------------------- /lib/egui/sh/setup_web.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | # Pre-requisites: 7 | rustup target add wasm32-unknown-unknown 8 | cargo install wasm-bindgen-cli --version 0.2.82 9 | -------------------------------------------------------------------------------- /lib/egui/sh/start_server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | # Starts a local web-server that serves the contents of the `doc/` folder, 7 | # i.e. the web-version of `egui_demo_app`. 8 | 9 | PORT=8888 10 | 11 | echo "ensuring basic-http-server is installed…" 12 | cargo install basic-http-server 13 | 14 | echo "starting server…" 15 | echo "serving at http://localhost:${PORT}" 16 | 17 | (cd docs && basic-http-server --addr 127.0.0.1:${PORT} .) 18 | # (cd docs && python3 -m http.server ${PORT} --bind 127.0.0.1) 19 | -------------------------------------------------------------------------------- /lib/egui/sh/wasm_bindgen_check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path/.." 5 | 6 | ./sh/setup_web.sh 7 | 8 | CRATE_NAME="egui_demo_app" 9 | FEATURES="glow,http,persistence,screen_reader" 10 | 11 | # This is required to enable the web_sys clipboard API which eframe web uses 12 | # https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html 13 | # https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html 14 | export RUSTFLAGS=--cfg=web_sys_unstable_apis 15 | 16 | echo "Building rust…" 17 | BUILD=debug # debug builds are faster 18 | 19 | (cd crates/$CRATE_NAME && 20 | cargo build \ 21 | --lib \ 22 | --target wasm32-unknown-unknown \ 23 | --no-default-features \ 24 | --features ${FEATURES} 25 | ) 26 | 27 | TARGET="target" 28 | 29 | echo "Generating JS bindings for wasm…" 30 | 31 | rm -f "${CRATE_NAME}_bg.wasm" # Remove old output (if any) 32 | 33 | TARGET_NAME="${CRATE_NAME}.wasm" 34 | wasm-bindgen "${TARGET}/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \ 35 | --out-dir . --no-modules --no-typescript 36 | 37 | # Remove output: 38 | rm -f "${CRATE_NAME}_bg.wasm" 39 | rm -f "${CRATE_NAME}.js" 40 | -------------------------------------------------------------------------------- /lib/egui/sh/wasm_size.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 4 | cd "$script_path" 5 | 6 | ./build_demo_web.sh && ls -lh ../docs/*.wasm 7 | -------------------------------------------------------------------------------- /lib/glutin-kms/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /lib/glutin-kms/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] Tested on all platforms changed 2 | - [ ] Compilation warnings were addressed 3 | - [ ] `cargo fmt` has been run on this branch 4 | - [ ] `cargo doc` builds successfully 5 | - [ ] Added an entry to `CHANGELOG.md` if knowledge of this change could be valuable to users 6 | - [ ] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior 7 | - [ ] Created or updated an example program if it would help users understand this functionality 8 | -------------------------------------------------------------------------------- /lib/glutin-kms/.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | paths: 7 | - '**/Cargo.toml' 8 | - '.github/workflows/publish.yml' 9 | 10 | jobs: 11 | Publish: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v1 15 | - uses: hecrj/setup-rust-action@v1 16 | with: 17 | rust-version: stable 18 | components: rustfmt 19 | 20 | - name: Publish glutin_egl_sys to crates.io 21 | continue-on-error: true 22 | run: cd glutin_egl_sys && cargo publish --token ${{ secrets.cratesio_token }} 23 | 24 | - name: Publish glutin_gles2_sys to crates.io 25 | continue-on-error: true 26 | run: cd glutin_gles2_sys && cargo publish --token ${{ secrets.cratesio_token }} 27 | 28 | - name: Publish glutin_glx_sys to crates.io 29 | continue-on-error: true 30 | run: cd glutin_glx_sys && cargo publish --token ${{ secrets.cratesio_token }} 31 | 32 | - name: Publish glutin_wgl_sys to crates.io 33 | continue-on-error: true 34 | run: cd glutin_wgl_sys && cargo publish --token ${{ secrets.cratesio_token }} 35 | 36 | - name: Publish glutin to crates.io 37 | continue-on-error: true 38 | run: cd glutin && cargo publish --token ${{ secrets.cratesio_token }} 39 | -------------------------------------------------------------------------------- /lib/glutin-kms/.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | target/ 3 | .DS_Store 4 | *~ 5 | #*# 6 | headless.png 7 | -------------------------------------------------------------------------------- /lib/glutin-kms/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/apk-builder"] 2 | path = deps/apk-builder 3 | url = https://github.com/rust-windowing/android-rs-glue 4 | -------------------------------------------------------------------------------- /lib/glutin-kms/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "glutin", 4 | "glutin_examples", 5 | "glutin_examples/ios-example/rust", 6 | "glutin_egl_sys", 7 | "glutin_glx_sys", 8 | "glutin_wgl_sys", 9 | "glutin_gles2_sys", 10 | ] 11 | -------------------------------------------------------------------------------- /lib/glutin-kms/FORK.md: -------------------------------------------------------------------------------- 1 | Forked from: https://github.com/null-dev/glutin-kms-0.29 at commit a0506cb3b8165deefbacf4687b2dc2f4d6ece340 2 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/api/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod dlloader; 2 | pub mod egl; 3 | pub mod glx; 4 | pub mod ios; 5 | pub mod osmesa; 6 | pub mod wgl; 7 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/platform/android.rs: -------------------------------------------------------------------------------- 1 | #![cfg(target_os = "android")] 2 | 3 | use crate::platform::ContextTraitExt; 4 | use crate::{Context, ContextCurrentState}; 5 | pub use glutin_egl_sys::EGLContext; 6 | 7 | pub use winit::platform::android::*; 8 | 9 | use std::os::raw; 10 | 11 | impl ContextTraitExt for Context { 12 | type Handle = EGLContext; 13 | 14 | #[inline] 15 | unsafe fn raw_handle(&self) -> Self::Handle { 16 | self.context.raw_handle() 17 | } 18 | 19 | #[inline] 20 | unsafe fn get_egl_display(&self) -> Option<*const raw::c_void> { 21 | Some(self.context.get_egl_display()) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/platform/ios.rs: -------------------------------------------------------------------------------- 1 | #![cfg(target_os = "ios")] 2 | 3 | use crate::platform::ContextTraitExt; 4 | use crate::{Context, ContextCurrentState}; 5 | 6 | pub use winit::platform::ios::*; 7 | 8 | use std::os::raw; 9 | 10 | impl ContextTraitExt for Context { 11 | type Handle = *mut raw::c_void; 12 | #[inline] 13 | unsafe fn raw_handle(&self) -> Self::Handle { 14 | self.context.raw_handle() 15 | } 16 | 17 | #[inline] 18 | unsafe fn get_egl_display(&self) -> Option<*const raw::c_void> { 19 | None 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/platform/macos.rs: -------------------------------------------------------------------------------- 1 | #![cfg(target_os = "macos")] 2 | 3 | use crate::platform::ContextTraitExt; 4 | use crate::{Context, ContextCurrentState}; 5 | 6 | pub use winit::platform::macos::*; 7 | 8 | use std::os::raw; 9 | 10 | impl ContextTraitExt for Context { 11 | type Handle = *mut raw::c_void; 12 | 13 | #[inline] 14 | unsafe fn raw_handle(&self) -> Self::Handle { 15 | self.context.raw_handle() 16 | } 17 | 18 | #[inline] 19 | unsafe fn get_egl_display(&self) -> Option<*const raw::c_void> { 20 | None 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/platform/unix.rs: -------------------------------------------------------------------------------- 1 | #![cfg(any( 2 | target_os = "linux", 3 | target_os = "dragonfly", 4 | target_os = "freebsd", 5 | target_os = "netbsd", 6 | target_os = "openbsd", 7 | ))] 8 | 9 | use crate::platform::ContextTraitExt; 10 | pub use crate::platform_impl::{HeadlessContextExt, RawContextExt, RawHandle}; 11 | use crate::{Context, ContextCurrentState}; 12 | pub use glutin_egl_sys::EGLContext; 13 | #[cfg(feature = "x11")] 14 | pub use glutin_glx_sys::GLXContext; 15 | 16 | pub use winit::platform::unix::*; 17 | 18 | use std::os::raw; 19 | 20 | impl ContextTraitExt for Context { 21 | type Handle = RawHandle; 22 | 23 | #[inline] 24 | unsafe fn raw_handle(&self) -> Self::Handle { 25 | self.context.raw_handle() 26 | } 27 | 28 | #[inline] 29 | unsafe fn get_egl_display(&self) -> Option<*const raw::c_void> { 30 | self.context.get_egl_display() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/platform/windows.rs: -------------------------------------------------------------------------------- 1 | #![cfg(target_os = "windows")] 2 | 3 | use crate::platform::ContextTraitExt; 4 | pub use crate::platform_impl::{RawContextExt, RawHandle}; 5 | use crate::{Context, ContextCurrentState}; 6 | pub use glutin_egl_sys::EGLContext; 7 | 8 | pub use winapi::shared::windef::HGLRC; 9 | pub use winit::platform::windows::*; 10 | 11 | use std::os::raw; 12 | 13 | impl ContextTraitExt for Context { 14 | type Handle = RawHandle; 15 | 16 | #[inline] 17 | unsafe fn raw_handle(&self) -> Self::Handle { 18 | self.context.raw_handle() 19 | } 20 | 21 | #[inline] 22 | unsafe fn get_egl_display(&self) -> Option<*const raw::c_void> { 23 | self.context.get_egl_display() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/platform_impl/ios/mod.rs: -------------------------------------------------------------------------------- 1 | #![cfg(target_os = "ios")] 2 | 3 | pub use crate::api::ios::*; 4 | pub use glutin_gles2_sys::id; 5 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin/src/platform_impl/mod.rs: -------------------------------------------------------------------------------- 1 | pub use self::platform::*; 2 | 3 | #[cfg(target_os = "windows")] 4 | #[path = "windows/mod.rs"] 5 | mod platform; 6 | #[cfg(any( 7 | target_os = "linux", 8 | target_os = "dragonfly", 9 | target_os = "freebsd", 10 | target_os = "netbsd", 11 | target_os = "openbsd", 12 | ))] 13 | #[path = "unix/mod.rs"] 14 | mod platform; 15 | #[cfg(target_os = "macos")] 16 | #[path = "macos/mod.rs"] 17 | mod platform; 18 | #[cfg(target_os = "android")] 19 | #[path = "android/mod.rs"] 20 | mod platform; 21 | #[cfg(target_os = "ios")] 22 | #[path = "ios/mod.rs"] 23 | mod platform; 24 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_egl_sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "glutin_egl_sys" 3 | version = "0.1.6" 4 | authors = ["The glutin contributors", "Hal Gentz "] 5 | description = "The egl bindings for glutin" 6 | repository = "https://github.com/rust-windowing/glutin" 7 | license = "Apache-2.0" 8 | readme = "README.md" 9 | build = "build.rs" 10 | edition = "2018" 11 | 12 | [build-dependencies] 13 | gl_generator = "0.14.0" 14 | 15 | [target.'cfg(target_os = "windows")'.dependencies.winapi] 16 | version = "0.3.9" 17 | features = [ 18 | "winnt", 19 | "winuser", 20 | "wingdi", 21 | "libloaderapi", 22 | ] 23 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_egl_sys/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_egl_sys/README.md: -------------------------------------------------------------------------------- 1 | # glutin_egl_sys 2 | 3 | Glutin's egl bindings. 4 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "glutin_examples" 3 | version = "0.1.2" 4 | authors = ["The glutin contributors", "Hal Gentz "] 5 | description = "Examples for glutin" 6 | repository = "https://github.com/rust-windowing/glutin" 7 | license = "Apache-2.0" 8 | readme = "../README.md" 9 | build = "build.rs" 10 | edition = "2018" 11 | publish = false 12 | 13 | [dependencies] 14 | glutin = { path = "../glutin" } 15 | takeable-option = "0.4" 16 | image = "0.24" 17 | 18 | [build-dependencies] 19 | gl_generator = "0.14" 20 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/build.rs: -------------------------------------------------------------------------------- 1 | use gl_generator::{Api, Fallbacks, Profile, Registry}; 2 | use std::env; 3 | use std::fs::File; 4 | use std::path::PathBuf; 5 | 6 | fn main() { 7 | let dest = PathBuf::from(&env::var("OUT_DIR").unwrap()); 8 | 9 | println!("cargo:rerun-if-changed=build.rs"); 10 | 11 | let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap(); 12 | Registry::new(Api::Gles2, (3, 3), Profile::Core, Fallbacks::All, []) 13 | .write_bindings(gl_generator::StructGenerator, &mut file) 14 | .unwrap(); 15 | } 16 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/examples/transparent.rs: -------------------------------------------------------------------------------- 1 | mod support; 2 | 3 | use glutin::event::{Event, WindowEvent}; 4 | use glutin::event_loop::{ControlFlow, EventLoop}; 5 | use glutin::window::WindowBuilder; 6 | use glutin::ContextBuilder; 7 | 8 | fn main() { 9 | let el = EventLoop::new(); 10 | let wb = WindowBuilder::new() 11 | .with_title("A transparent window!") 12 | .with_decorations(false) 13 | .with_transparent(true); 14 | 15 | let windowed_context = ContextBuilder::new().build_windowed(wb, &el).unwrap(); 16 | 17 | let windowed_context = unsafe { windowed_context.make_current().unwrap() }; 18 | 19 | println!("Pixel format of the window's GL context: {:?}", windowed_context.get_pixel_format()); 20 | 21 | let gl = support::load(windowed_context.context()); 22 | 23 | el.run(move |event, _, control_flow| { 24 | println!("{:?}", event); 25 | *control_flow = ControlFlow::Wait; 26 | 27 | match event { 28 | Event::LoopDestroyed => (), 29 | Event::WindowEvent { event, .. } => match event { 30 | WindowEvent::Resized(physical_size) => windowed_context.resize(physical_size), 31 | WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit, 32 | _ => (), 33 | }, 34 | Event::RedrawRequested(_) => { 35 | gl.draw_frame([0.0; 4]); 36 | windowed_context.swap_buffers().unwrap(); 37 | } 38 | _ => (), 39 | } 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/examples/window.rs: -------------------------------------------------------------------------------- 1 | mod support; 2 | 3 | use glutin::event::{Event, WindowEvent}; 4 | use glutin::event_loop::{ControlFlow, EventLoop}; 5 | use glutin::window::WindowBuilder; 6 | use glutin::ContextBuilder; 7 | 8 | fn main() { 9 | let el = EventLoop::new(); 10 | let wb = WindowBuilder::new().with_title("A fantastic window!"); 11 | 12 | let windowed_context = ContextBuilder::new().build_windowed(wb, &el).unwrap(); 13 | 14 | let windowed_context = unsafe { windowed_context.make_current().unwrap() }; 15 | 16 | println!("Pixel format of the window's GL context: {:?}", windowed_context.get_pixel_format()); 17 | 18 | let gl = support::load(windowed_context.context()); 19 | 20 | el.run(move |event, _, control_flow| { 21 | println!("{:?}", event); 22 | *control_flow = ControlFlow::Wait; 23 | 24 | match event { 25 | Event::LoopDestroyed => (), 26 | Event::WindowEvent { event, .. } => match event { 27 | WindowEvent::Resized(physical_size) => windowed_context.resize(physical_size), 28 | WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit, 29 | _ => (), 30 | }, 31 | Event::RedrawRequested(_) => { 32 | gl.draw_frame([1.0, 0.5, 0.7, 1.0]); 33 | windowed_context.swap_buffers().unwrap(); 34 | } 35 | _ => (), 36 | } 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/GlutinExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/GlutinExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/GlutinExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIRequiredDeviceCapabilities 24 | 25 | armv7 26 | 27 | UISupportedInterfaceOrientations 28 | 29 | UIInterfaceOrientationPortrait 30 | UIInterfaceOrientationLandscapeLeft 31 | UIInterfaceOrientationLandscapeRight 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/GlutinExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GlutinExample 4 | // 5 | // Created by Sebastian Imlay on 11/6/19. 6 | // Copyright © 2019 Sebastian Imlay. All rights reserved. 7 | // 8 | 9 | 10 | #import "glutin_ios_example.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | run_app(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: xcode cargo run install simulator-logs 2 | 3 | LIB = rust/libglutin_ios_example.a 4 | run: install 5 | xcrun simctl launch booted com.glutin.GlutinExample 6 | 7 | install: xcode 8 | xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/GlutinExample.app 9 | 10 | xcode: $(LIB) 11 | xcrun xcodebuild -scheme GlutinExample -project GlutinExample.xcodeproj/ -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=13.2' -derivedDataPath build 12 | 13 | cargo: 14 | make -C rust 15 | 16 | simulator-logs: 17 | xcrun simctl spawn booted log stream --level=debug --predicate 'processImagePath endswith "GlutinExample"' 18 | ci: 19 | make -C rust ci 20 | xcrun xcodebuild -scheme GlutinExample -project GlutinExample.xcodeproj/ -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=13.2' -derivedDataPath build 21 | 22 | 23 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/README.md: -------------------------------------------------------------------------------- 1 | # GlutinExample.app 2 | 3 | ## Building with `make` 4 | * `make cargo xcode` will build the xcode project and put it in `build/Build/Products/Debug-iphonesimulator/GlutinExample.app` 5 | * `make run` install and run the app in a simulator that's booted. 6 | * `make simulator-logs` will give you way too many logs from the simulator. 7 | 8 | ## Building with xcode buttons 9 | * `cd rust && make` 10 | * `open GlutinExample.xcodeproj` and push the play button. 11 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/rust/.gitignore: -------------------------------------------------------------------------------- 1 | libglutin_ios_example.a 2 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "glutin-ios-example" 3 | version = "0.1.0" 4 | authors = ["Sebastian Imlay "] 5 | edition = '2018' 6 | 7 | [lib] 8 | name = "glutin_ios_example" 9 | crate-type = ["staticlib"] 10 | 11 | [dependencies] 12 | raw-window-handle = "0.3.1" 13 | takeable-option = "0.4" 14 | glutin = { path = "../../../glutin" } 15 | 16 | 17 | [build-dependencies] 18 | gl_generator = "0.14.0" 19 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/rust/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CARGO_MODE ?= debug 3 | LIB = libglutin_ios_example.a 4 | 5 | all: 6 | cargo lipo 7 | cp ../../../target/universal/debug/$(LIB) ./ 8 | 9 | doc: 10 | cargo doc --target aarch64-apple-ios --open 11 | 12 | ci: 13 | cargo build --target x86_64-apple-ios 14 | cp ../../../target/x86_64-apple-ios/debug/$(LIB) ./ 15 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/rust/build.rs: -------------------------------------------------------------------------------- 1 | extern crate gl_generator; 2 | use gl_generator::{Api, Fallbacks, Profile, Registry}; 3 | use std::env; 4 | use std::fs::File; 5 | use std::path::PathBuf; 6 | 7 | fn main() { 8 | let dest = PathBuf::from(&env::var("OUT_DIR").unwrap()); 9 | 10 | println!("cargo:rerun-if-changed=build.rs"); 11 | 12 | let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap(); 13 | Registry::new(Api::Gles2, (3, 3), Profile::Core, Fallbacks::All, []) 14 | .write_bindings(gl_generator::StructGenerator, &mut file) 15 | .unwrap(); 16 | } 17 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/rust/glutin_ios_example.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void run_app(void); 4 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_examples/ios-example/rust/rust_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/glutin-kms/glutin_examples/ios-example/rust/rust_logo.png -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_gles2_sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "glutin_gles2_sys" 3 | version = "0.1.5" 4 | authors = ["The glutin contributors", "Hal Gentz "] 5 | description = "The gles2 bindings for glutin" 6 | repository = "https://github.com/rust-windowing/glutin" 7 | license = "Apache-2.0" 8 | readme = "README.md" 9 | build = "build.rs" 10 | edition = "2018" 11 | 12 | [build-dependencies] 13 | gl_generator = "0.14" 14 | 15 | [target.'cfg(target_os = "ios")'.dependencies] 16 | objc = "0.2" 17 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_gles2_sys/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_gles2_sys/README.md: -------------------------------------------------------------------------------- 1 | # glutin_gles2_sys 2 | 3 | Glutin's gles2 bindings. 4 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_gles2_sys/build.rs: -------------------------------------------------------------------------------- 1 | use gl_generator::{Api, Fallbacks, Profile, Registry}; 2 | use std::env; 3 | use std::fs::File; 4 | use std::path::PathBuf; 5 | 6 | fn main() { 7 | let target = env::var("TARGET").unwrap(); 8 | let dest = PathBuf::from(&env::var("OUT_DIR").unwrap()); 9 | 10 | println!("cargo:rerun-if-changed=build.rs"); 11 | 12 | if target.contains("ios") { 13 | println!("cargo:rustc-link-lib=framework=GLKit"); 14 | println!("cargo:rustc-link-lib=framework=OpenGLES"); 15 | let mut file = File::create(&dest.join("gles2_bindings.rs")).unwrap(); 16 | Registry::new(Api::Gles2, (2, 0), Profile::Core, Fallbacks::None, []) 17 | .write_bindings(gl_generator::StaticStructGenerator, &mut file) 18 | .unwrap(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_glx_sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "glutin_glx_sys" 3 | version = "0.1.8" 4 | authors = ["The glutin contributors", "Hal Gentz "] 5 | description = "The glx bindings for glutin" 6 | repository = "https://github.com/rust-windowing/glutin" 7 | license = "Apache-2.0" 8 | readme = "README.md" 9 | build = "build.rs" 10 | edition = "2018" 11 | 12 | [build-dependencies] 13 | gl_generator = "0.14.0" 14 | 15 | [target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os="dragonfly", target_os="netbsd", target_os="openbsd"))'.dependencies] 16 | x11-dl = "2.19.1" 17 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_glx_sys/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_glx_sys/README.md: -------------------------------------------------------------------------------- 1 | # glutin_glx_sys 2 | 3 | Glutin's glx bindings. 4 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_glx_sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg(any( 2 | target_os = "linux", 3 | target_os = "dragonfly", 4 | target_os = "freebsd", 5 | target_os = "netbsd", 6 | target_os = "openbsd" 7 | ))] 8 | #![allow( 9 | clippy::manual_non_exhaustive, 10 | clippy::missing_safety_doc, 11 | clippy::redundant_static_lifetimes, 12 | clippy::unused_unit 13 | )] 14 | #![cfg_attr(feature = "cargo-clippy", deny(warnings))] 15 | 16 | pub use self::glx::types::GLXContext; 17 | pub use x11_dl::xlib::*; 18 | 19 | /// GLX bindings 20 | pub mod glx { 21 | include!(concat!(env!("OUT_DIR"), "/glx_bindings.rs")); 22 | } 23 | 24 | /// Functions that are not necessarily always available 25 | pub mod glx_extra { 26 | include!(concat!(env!("OUT_DIR"), "/glx_extra_bindings.rs")); 27 | } 28 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_wgl_sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "glutin_wgl_sys" 3 | version = "0.1.5" 4 | authors = ["The glutin contributors", "Hal Gentz "] 5 | description = "The wgl bindings for glutin" 6 | repository = "https://github.com/rust-windowing/glutin" 7 | license = "Apache-2.0" 8 | readme = "README.md" 9 | build = "build.rs" 10 | edition = "2018" 11 | 12 | [build-dependencies] 13 | gl_generator = "0.14" 14 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_wgl_sys/LICENSE: -------------------------------------------------------------------------------- 1 | ../LICENSE -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_wgl_sys/README.md: -------------------------------------------------------------------------------- 1 | # glutin_wgl_sys 2 | 3 | Glutin's wgl bindings. 4 | -------------------------------------------------------------------------------- /lib/glutin-kms/glutin_wgl_sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg(any(target_os = "windows"))] 2 | #![allow(clippy::manual_non_exhaustive, clippy::missing_safety_doc, clippy::too_many_arguments)] 3 | #![cfg_attr(feature = "cargo-clippy", deny(warnings))] 4 | 5 | /// WGL bindings 6 | pub mod wgl { 7 | include!(concat!(env!("OUT_DIR"), "/wgl_bindings.rs")); 8 | } 9 | 10 | /// Functions that are not necessarily always available 11 | pub mod wgl_extra { 12 | include!(concat!(env!("OUT_DIR"), "/wgl_extra_bindings.rs")); 13 | } 14 | 15 | #[link(name = "opengl32")] 16 | extern "C" {} 17 | -------------------------------------------------------------------------------- /lib/glutin-kms/rustfmt.toml: -------------------------------------------------------------------------------- 1 | use_small_heuristics = "Max" 2 | use_field_init_shorthand = true 3 | newline_style = "Unix" 4 | edition = "2018" 5 | -------------------------------------------------------------------------------- /lib/winit-kms/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | run-wasm = ["run", "--release", "--package", "run-wasm", "--"] 3 | -------------------------------------------------------------------------------- /lib/winit-kms/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /lib/winit-kms/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] Tested on all platforms changed 2 | - [ ] Added an entry to `CHANGELOG.md` if knowledge of this change could be valuable to users 3 | - [ ] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior 4 | - [ ] Created or updated an example program if it would help users understand this functionality 5 | - [ ] Updated [feature matrix](https://github.com/rust-windowing/winit/blob/master/FEATURES.md), if new features were added or implemented 6 | -------------------------------------------------------------------------------- /lib/winit-kms/.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 7 | 8 | jobs: 9 | Publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - uses: hecrj/setup-rust-action@v1 14 | with: 15 | rust-version: stable 16 | components: rustfmt 17 | - name: Publish to crates.io 18 | run: cargo publish --token ${{ secrets.cratesio_token }} 19 | -------------------------------------------------------------------------------- /lib/winit-kms/.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | target/ 3 | rls/ 4 | .vscode/ 5 | *~ 6 | *.wasm 7 | *.ts 8 | *.js 9 | #*# 10 | .DS_Store -------------------------------------------------------------------------------- /lib/winit-kms/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/apk-builder"] 2 | path = deps/apk-builder 3 | url = https://github.com/rust-windowing/android-rs-glue 4 | -------------------------------------------------------------------------------- /lib/winit-kms/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /lib/winit-kms/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/winit-kms/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /lib/winit-kms/.idea/winit-kms.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/winit-kms/FORK.md: -------------------------------------------------------------------------------- 1 | Forked from: https://github.com/null-dev/winit-kms-0.27 at commit 47beeb67da69e7afef7c220e76a3dd2c7a3b6f2b 2 | -------------------------------------------------------------------------------- /lib/winit-kms/HALL_OF_CHAMPIONS.md: -------------------------------------------------------------------------------- 1 | # Hall of Champions 2 | 3 | The winit maintainers would like to recognize the following former winit 4 | contributors, without whom winit would not exist in its current form. We thank 5 | them deeply for their time and efforts, and wish them best of luck in their 6 | future endeavors: 7 | 8 | * [@tomaka]: For creating the winit project and guiding it through its early 9 | years of existence. 10 | * [@vberger]: For diligently creating the Wayland backend, and being its 11 | extremely helpful and benevolent maintainer for years. 12 | * [@francesca64]: For taking over the responsibility of maintaining almost every 13 | winit backend, and standardizing HiDPI support across all of them. 14 | * [@Osspial]: For heroically landing EventLoop 2.0, and valiantly ushering in a 15 | vastly more sustainable era of winit. 16 | * [@goddessfreya]: For selflessly taking over maintainership of glutin, and her 17 | stellar dedication to improving both winit and glutin. 18 | 19 | [@tomaka]: https://github.com/tomaka 20 | [@vberger]: https://github.com/vberger 21 | [@francesca64]: https://github.com/francesca64 22 | [@Osspial]: https://github.com/Osspial 23 | [@goddessfreya]: https://github.com/goddessfreya 24 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/null-dev/tt/1d6c9ff9dfb9a2e750612386631f107ddd3d55a0/lib/winit-kms/examples/icon.png -------------------------------------------------------------------------------- /lib/winit-kms/examples/min_max_size.rs: -------------------------------------------------------------------------------- 1 | use simple_logger::SimpleLogger; 2 | use winit::{ 3 | dpi::LogicalSize, 4 | event::{Event, WindowEvent}, 5 | event_loop::EventLoop, 6 | window::WindowBuilder, 7 | }; 8 | 9 | fn main() { 10 | SimpleLogger::new().init().unwrap(); 11 | let event_loop = EventLoop::new(); 12 | 13 | let window = WindowBuilder::new().build(&event_loop).unwrap(); 14 | 15 | window.set_min_inner_size(Some(LogicalSize::new(400.0, 200.0))); 16 | window.set_max_inner_size(Some(LogicalSize::new(800.0, 400.0))); 17 | 18 | event_loop.run(move |event, _, control_flow| { 19 | control_flow.set_wait(); 20 | println!("{:?}", event); 21 | 22 | match event { 23 | Event::WindowEvent { 24 | event: WindowEvent::CloseRequested, 25 | .. 26 | } => control_flow.set_exit(), 27 | _ => (), 28 | } 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/minimize.rs: -------------------------------------------------------------------------------- 1 | extern crate winit; 2 | 3 | use simple_logger::SimpleLogger; 4 | use winit::event::{Event, VirtualKeyCode, WindowEvent}; 5 | use winit::event_loop::EventLoop; 6 | use winit::window::WindowBuilder; 7 | 8 | fn main() { 9 | SimpleLogger::new().init().unwrap(); 10 | let event_loop = EventLoop::new(); 11 | 12 | let window = WindowBuilder::new() 13 | .with_title("A fantastic window!") 14 | .build(&event_loop) 15 | .unwrap(); 16 | 17 | event_loop.run(move |event, _, control_flow| { 18 | control_flow.set_wait(); 19 | 20 | match event { 21 | Event::WindowEvent { 22 | event: WindowEvent::CloseRequested, 23 | .. 24 | } => control_flow.set_exit(), 25 | 26 | // Keyboard input event to handle minimize via a hotkey 27 | Event::WindowEvent { 28 | event: WindowEvent::KeyboardInput { input, .. }, 29 | window_id, 30 | } => { 31 | if window_id == window.id() { 32 | // Pressing the 'M' key will minimize the window 33 | if input.virtual_keycode == Some(VirtualKeyCode::M) { 34 | window.set_minimized(true); 35 | } 36 | } 37 | } 38 | _ => (), 39 | } 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/monitor_list.rs: -------------------------------------------------------------------------------- 1 | use simple_logger::SimpleLogger; 2 | use winit::{event_loop::EventLoop, window::WindowBuilder}; 3 | 4 | fn main() { 5 | SimpleLogger::new().init().unwrap(); 6 | let event_loop = EventLoop::new(); 7 | let window = WindowBuilder::new().build(&event_loop).unwrap(); 8 | 9 | dbg!(window.available_monitors().collect::>()); 10 | dbg!(window.primary_monitor()); 11 | } 12 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/request_redraw.rs: -------------------------------------------------------------------------------- 1 | use simple_logger::SimpleLogger; 2 | use winit::{ 3 | event::{ElementState, Event, WindowEvent}, 4 | event_loop::EventLoop, 5 | window::WindowBuilder, 6 | }; 7 | 8 | fn main() { 9 | SimpleLogger::new().init().unwrap(); 10 | let event_loop = EventLoop::new(); 11 | 12 | let window = WindowBuilder::new() 13 | .with_title("A fantastic window!") 14 | .build(&event_loop) 15 | .unwrap(); 16 | 17 | event_loop.run(move |event, _, control_flow| { 18 | println!("{:?}", event); 19 | 20 | control_flow.set_wait(); 21 | 22 | match event { 23 | Event::WindowEvent { event, .. } => match event { 24 | WindowEvent::CloseRequested => control_flow.set_exit(), 25 | WindowEvent::MouseInput { 26 | state: ElementState::Released, 27 | .. 28 | } => { 29 | window.request_redraw(); 30 | } 31 | _ => (), 32 | }, 33 | Event::RedrawRequested(_) => { 34 | println!("\nredrawing!\n"); 35 | } 36 | _ => (), 37 | } 38 | }); 39 | } 40 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/request_redraw_threaded.rs: -------------------------------------------------------------------------------- 1 | #[cfg(not(target_arch = "wasm32"))] 2 | fn main() { 3 | use std::{thread, time}; 4 | 5 | use simple_logger::SimpleLogger; 6 | use winit::{ 7 | event::{Event, WindowEvent}, 8 | event_loop::EventLoop, 9 | window::WindowBuilder, 10 | }; 11 | 12 | SimpleLogger::new().init().unwrap(); 13 | let event_loop = EventLoop::new(); 14 | 15 | let window = WindowBuilder::new() 16 | .with_title("A fantastic window!") 17 | .build(&event_loop) 18 | .unwrap(); 19 | 20 | thread::spawn(move || loop { 21 | thread::sleep(time::Duration::from_secs(1)); 22 | window.request_redraw(); 23 | }); 24 | 25 | event_loop.run(move |event, _, control_flow| { 26 | println!("{:?}", event); 27 | 28 | control_flow.set_wait(); 29 | 30 | match event { 31 | Event::WindowEvent { event, .. } => match event { 32 | WindowEvent::CloseRequested => control_flow.set_exit(), 33 | _ => (), 34 | }, 35 | Event::RedrawRequested(_) => { 36 | println!("\nredrawing!\n"); 37 | } 38 | _ => (), 39 | } 40 | }); 41 | } 42 | 43 | #[cfg(target_arch = "wasm32")] 44 | fn main() { 45 | unimplemented!() // `Window` can't be sent between threads 46 | } 47 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/timer.rs: -------------------------------------------------------------------------------- 1 | use instant::Instant; 2 | use std::time::Duration; 3 | 4 | use simple_logger::SimpleLogger; 5 | use winit::{ 6 | event::{Event, StartCause, WindowEvent}, 7 | event_loop::EventLoop, 8 | window::WindowBuilder, 9 | }; 10 | 11 | fn main() { 12 | SimpleLogger::new().init().unwrap(); 13 | let event_loop = EventLoop::new(); 14 | 15 | let _window = WindowBuilder::new() 16 | .with_title("A fantastic window!") 17 | .build(&event_loop) 18 | .unwrap(); 19 | 20 | let timer_length = Duration::new(1, 0); 21 | 22 | event_loop.run(move |event, _, control_flow| { 23 | println!("{:?}", event); 24 | 25 | match event { 26 | Event::NewEvents(StartCause::Init) => { 27 | control_flow.set_wait_until(Instant::now() + timer_length); 28 | } 29 | Event::NewEvents(StartCause::ResumeTimeReached { .. }) => { 30 | control_flow.set_wait_until(Instant::now() + timer_length); 31 | println!("\nTimer\n"); 32 | } 33 | Event::WindowEvent { 34 | event: WindowEvent::CloseRequested, 35 | .. 36 | } => control_flow.set_exit(), 37 | _ => (), 38 | } 39 | }); 40 | } 41 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/transparent.rs: -------------------------------------------------------------------------------- 1 | use simple_logger::SimpleLogger; 2 | use winit::{ 3 | event::{Event, WindowEvent}, 4 | event_loop::EventLoop, 5 | window::WindowBuilder, 6 | }; 7 | 8 | fn main() { 9 | SimpleLogger::new().init().unwrap(); 10 | let event_loop = EventLoop::new(); 11 | 12 | let window = WindowBuilder::new() 13 | .with_decorations(false) 14 | .with_transparent(true) 15 | .build(&event_loop) 16 | .unwrap(); 17 | 18 | window.set_title("A fantastic window!"); 19 | 20 | event_loop.run(move |event, _, control_flow| { 21 | control_flow.set_wait(); 22 | println!("{:?}", event); 23 | 24 | match event { 25 | Event::WindowEvent { 26 | event: WindowEvent::CloseRequested, 27 | .. 28 | } => control_flow.set_exit(), 29 | _ => (), 30 | } 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/video_modes.rs: -------------------------------------------------------------------------------- 1 | use simple_logger::SimpleLogger; 2 | use winit::event_loop::EventLoop; 3 | 4 | fn main() { 5 | SimpleLogger::new().init().unwrap(); 6 | let event_loop = EventLoop::new(); 7 | let monitor = match event_loop.primary_monitor() { 8 | Some(monitor) => monitor, 9 | None => { 10 | println!("No primary monitor detected."); 11 | return; 12 | } 13 | }; 14 | 15 | println!("Listing available video modes:"); 16 | 17 | for mode in monitor.video_modes() { 18 | println!("{}", mode); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/winit-kms/examples/window.rs: -------------------------------------------------------------------------------- 1 | use simple_logger::SimpleLogger; 2 | use winit::{ 3 | event::{Event, WindowEvent}, 4 | event_loop::EventLoop, 5 | window::WindowBuilder, 6 | }; 7 | 8 | fn main() { 9 | SimpleLogger::new().init().unwrap(); 10 | let event_loop = EventLoop::new(); 11 | 12 | let window = WindowBuilder::new() 13 | .with_title("A fantastic window!") 14 | .with_inner_size(winit::dpi::LogicalSize::new(128.0, 128.0)) 15 | .build(&event_loop) 16 | .unwrap(); 17 | 18 | event_loop.run(move |event, _, control_flow| { 19 | control_flow.set_wait(); 20 | println!("{:?}", event); 21 | 22 | match event { 23 | Event::WindowEvent { 24 | event: WindowEvent::CloseRequested, 25 | window_id, 26 | } if window_id == window.id() => control_flow.set_exit(), 27 | Event::MainEventsCleared => { 28 | window.request_redraw(); 29 | } 30 | _ => (), 31 | } 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /lib/winit-kms/run-wasm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run-wasm" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | cargo-run-wasm = "0.1.0" 10 | -------------------------------------------------------------------------------- /lib/winit-kms/run-wasm/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | cargo_run_wasm::run_wasm(); 3 | } 4 | -------------------------------------------------------------------------------- /lib/winit-kms/rustfmt.toml: -------------------------------------------------------------------------------- 1 | force_explicit_abi=true 2 | use_field_init_shorthand=true 3 | # merge_imports=true 4 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform/android.rs: -------------------------------------------------------------------------------- 1 | #![cfg(any(target_os = "android"))] 2 | 3 | use crate::{ 4 | event_loop::{EventLoop, EventLoopWindowTarget}, 5 | window::{Window, WindowBuilder}, 6 | }; 7 | use ndk::configuration::Configuration; 8 | use ndk_glue::Rect; 9 | 10 | /// Additional methods on `EventLoop` that are specific to Android. 11 | pub trait EventLoopExtAndroid {} 12 | 13 | impl EventLoopExtAndroid for EventLoop {} 14 | 15 | /// Additional methods on `EventLoopWindowTarget` that are specific to Android. 16 | pub trait EventLoopWindowTargetExtAndroid {} 17 | 18 | /// Additional methods on `Window` that are specific to Android. 19 | pub trait WindowExtAndroid { 20 | fn content_rect(&self) -> Rect; 21 | 22 | fn config(&self) -> Configuration; 23 | } 24 | 25 | impl WindowExtAndroid for Window { 26 | fn content_rect(&self) -> Rect { 27 | self.window.content_rect() 28 | } 29 | 30 | fn config(&self) -> Configuration { 31 | self.window.config() 32 | } 33 | } 34 | 35 | impl EventLoopWindowTargetExtAndroid for EventLoopWindowTarget {} 36 | 37 | /// Additional methods on `WindowBuilder` that are specific to Android. 38 | pub trait WindowBuilderExtAndroid {} 39 | 40 | impl WindowBuilderExtAndroid for WindowBuilder {} 41 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform/mod.rs: -------------------------------------------------------------------------------- 1 | //! Contains traits with platform-specific methods in them. 2 | //! 3 | //! Contains the follow OS-specific modules: 4 | //! 5 | //! - `android` 6 | //! - `ios` 7 | //! - `macos` 8 | //! - `unix` 9 | //! - `windows` 10 | //! - `web` 11 | //! 12 | //! And the following platform-specific module: 13 | //! 14 | //! - `run_return` (available on `windows`, `unix`, `macos`, and `android`) 15 | //! 16 | //! However only the module corresponding to the platform you're compiling to will be available. 17 | 18 | pub mod android; 19 | pub mod ios; 20 | pub mod macos; 21 | pub mod unix; 22 | pub mod windows; 23 | 24 | pub mod run_return; 25 | pub mod web; 26 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform/web.rs: -------------------------------------------------------------------------------- 1 | #![cfg(target_arch = "wasm32")] 2 | 3 | //! The web target does not automatically insert the canvas element object into the web page, to 4 | //! allow end users to determine how the page should be laid out. Use the `WindowExtWebSys` trait 5 | //! to retrieve the canvas from the Window. Alternatively, use the `WindowBuilderExtWebSys` trait 6 | //! to provide your own canvas. 7 | 8 | use crate::window::WindowBuilder; 9 | 10 | use web_sys::HtmlCanvasElement; 11 | 12 | pub trait WindowExtWebSys { 13 | fn canvas(&self) -> HtmlCanvasElement; 14 | 15 | /// Whether the browser reports the preferred color scheme to be "dark". 16 | fn is_dark_mode(&self) -> bool; 17 | } 18 | 19 | pub trait WindowBuilderExtWebSys { 20 | fn with_canvas(self, canvas: Option) -> Self; 21 | } 22 | 23 | impl WindowBuilderExtWebSys for WindowBuilder { 24 | fn with_canvas(mut self, canvas: Option) -> Self { 25 | self.platform_specific.canvas = canvas; 26 | 27 | self 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/linux/wayland/event_loop/proxy.rs: -------------------------------------------------------------------------------- 1 | //! An event loop proxy. 2 | 3 | use std::sync::mpsc::SendError; 4 | 5 | use sctk::reexports::calloop::channel::Sender; 6 | 7 | use crate::event_loop::EventLoopClosed; 8 | 9 | /// A handle that can be sent across the threads and used to wake up the `EventLoop`. 10 | pub struct EventLoopProxy { 11 | user_events_sender: Sender, 12 | } 13 | 14 | impl Clone for EventLoopProxy { 15 | fn clone(&self) -> Self { 16 | EventLoopProxy { 17 | user_events_sender: self.user_events_sender.clone(), 18 | } 19 | } 20 | } 21 | 22 | impl EventLoopProxy { 23 | pub fn new(user_events_sender: Sender) -> Self { 24 | Self { user_events_sender } 25 | } 26 | 27 | pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed> { 28 | self.user_events_sender 29 | .send(event) 30 | .map_err(|SendError(error)| EventLoopClosed(error)) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/linux/wayland/event_loop/sink.rs: -------------------------------------------------------------------------------- 1 | //! An event loop's sink to deliver events from the Wayland event callbacks. 2 | 3 | use crate::event::{DeviceEvent, DeviceId as RootDeviceId, Event, WindowEvent}; 4 | use crate::platform_impl::platform::{DeviceId as PlatformDeviceId, WindowId as PlatformWindowId}; 5 | use crate::window::WindowId as RootWindowId; 6 | 7 | use super::{DeviceId, WindowId}; 8 | 9 | /// An event loop's sink to deliver events from the Wayland event callbacks 10 | /// to the winit's user. 11 | #[derive(Default)] 12 | pub struct EventSink { 13 | pub window_events: Vec>, 14 | } 15 | 16 | impl EventSink { 17 | pub fn new() -> Self { 18 | Default::default() 19 | } 20 | 21 | /// Add new device event to a queue. 22 | pub fn push_device_event(&mut self, event: DeviceEvent, device_id: DeviceId) { 23 | self.window_events.push(Event::DeviceEvent { 24 | event, 25 | device_id: RootDeviceId(PlatformDeviceId::Wayland(device_id)), 26 | }); 27 | } 28 | 29 | /// Add new window event to a queue. 30 | pub fn push_window_event(&mut self, event: WindowEvent<'static>, window_id: WindowId) { 31 | self.window_events.push(Event::WindowEvent { 32 | event, 33 | window_id: RootWindowId(PlatformWindowId::Wayland(window_id)), 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/linux/wayland/event_loop/state.rs: -------------------------------------------------------------------------------- 1 | //! A state that we pass around in a dispatch. 2 | 3 | use std::collections::HashMap; 4 | 5 | use super::EventSink; 6 | use crate::platform_impl::wayland::window::shim::{WindowHandle, WindowUpdate}; 7 | use crate::platform_impl::wayland::WindowId; 8 | 9 | /// Wrapper to carry winit's state. 10 | pub struct WinitState { 11 | /// A sink for window and device events that is being filled during dispatching 12 | /// event loop and forwarded downstream afterwards. 13 | pub event_sink: EventSink, 14 | 15 | /// Window updates, which are coming from SCTK or the compositor, which require 16 | /// calling back to the winit's downstream. They are handled right in the event loop, 17 | /// unlike the ones coming from buffers on the `WindowHandle`'s. 18 | pub window_updates: HashMap, 19 | 20 | /// Window map containing all SCTK windows. Since those windows aren't allowed 21 | /// to be sent to other threads, they live on the event loop's thread 22 | /// and requests from winit's windows are being forwarded to them either via 23 | /// `WindowUpdate` or buffer on the associated with it `WindowHandle`. 24 | pub window_map: HashMap, 25 | } 26 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/linux/wayland/mod.rs: -------------------------------------------------------------------------------- 1 | #![cfg(any( 2 | target_os = "linux", 3 | target_os = "dragonfly", 4 | target_os = "freebsd", 5 | target_os = "netbsd", 6 | target_os = "openbsd" 7 | ))] 8 | 9 | use sctk::reexports::client::protocol::wl_surface::WlSurface; 10 | 11 | pub use event_loop::{EventLoop, EventLoopProxy, EventLoopWindowTarget}; 12 | pub use output::{MonitorHandle, VideoMode}; 13 | pub use window::Window; 14 | 15 | mod env; 16 | mod event_loop; 17 | mod output; 18 | mod seat; 19 | mod window; 20 | 21 | #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 22 | pub struct DeviceId; 23 | 24 | impl DeviceId { 25 | pub const unsafe fn dummy() -> Self { 26 | DeviceId 27 | } 28 | } 29 | 30 | #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 31 | pub struct WindowId(usize); 32 | 33 | impl WindowId { 34 | pub const unsafe fn dummy() -> Self { 35 | WindowId(0) 36 | } 37 | } 38 | 39 | #[inline] 40 | fn make_wid(surface: &WlSurface) -> WindowId { 41 | WindowId(surface.as_ref().c_ptr() as usize) 42 | } 43 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/linux/x11/ffi.rs: -------------------------------------------------------------------------------- 1 | use x11_dl::xmd::CARD32; 2 | pub use x11_dl::{ 3 | error::OpenError, keysym::*, xcursor::*, xinput::*, xinput2::*, xlib::*, xlib_xcb::*, 4 | xrandr::*, xrender::*, 5 | }; 6 | 7 | // Isn't defined by x11_dl 8 | #[allow(non_upper_case_globals)] 9 | pub const IconicState: CARD32 = 3; 10 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/linux/x11/util/client_msg.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | 3 | pub type ClientMsgPayload = [c_long; 5]; 4 | 5 | impl XConnection { 6 | pub fn send_event>( 7 | &self, 8 | target_window: c_ulong, 9 | event_mask: Option, 10 | event: T, 11 | ) -> Flusher<'_> { 12 | let event_mask = event_mask.unwrap_or(ffi::NoEventMask); 13 | unsafe { 14 | (self.xlib.XSendEvent)( 15 | self.display, 16 | target_window, 17 | ffi::False, 18 | event_mask, 19 | &mut event.into(), 20 | ); 21 | } 22 | Flusher::new(self) 23 | } 24 | 25 | pub fn send_client_msg( 26 | &self, 27 | window: c_ulong, // The window this is "about"; not necessarily this window 28 | target_window: c_ulong, // The window we're sending to 29 | message_type: ffi::Atom, 30 | event_mask: Option, 31 | data: ClientMsgPayload, 32 | ) -> Flusher<'_> { 33 | let event = ffi::XClientMessageEvent { 34 | type_: ffi::ClientMessage, 35 | display: self.display, 36 | window, 37 | message_type, 38 | format: c_long::FORMAT as c_int, 39 | data: unsafe { mem::transmute(data) }, 40 | // These fields are ignored by `XSendEvent` 41 | serial: 0, 42 | send_event: 0, 43 | }; 44 | self.send_event(target_window, event_mask, event) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/linux/x11/util/icon.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | use crate::icon::{Icon, Pixel, PIXEL_SIZE}; 3 | 4 | impl Pixel { 5 | pub fn to_packed_argb(&self) -> Cardinal { 6 | let mut cardinal = 0; 7 | assert!(CARDINAL_SIZE >= PIXEL_SIZE); 8 | let as_bytes = &mut cardinal as *mut _ as *mut u8; 9 | unsafe { 10 | *as_bytes.offset(0) = self.b; 11 | *as_bytes.offset(1) = self.g; 12 | *as_bytes.offset(2) = self.r; 13 | *as_bytes.offset(3) = self.a; 14 | } 15 | cardinal 16 | } 17 | } 18 | 19 | impl Icon { 20 | pub(crate) fn to_cardinals(&self) -> Vec { 21 | let rgba_icon = &self.inner; 22 | assert_eq!(rgba_icon.rgba.len() % PIXEL_SIZE, 0); 23 | let pixel_count = rgba_icon.rgba.len() / PIXEL_SIZE; 24 | assert_eq!(pixel_count, (rgba_icon.width * rgba_icon.height) as usize); 25 | let mut data = Vec::with_capacity(pixel_count); 26 | data.push(rgba_icon.width as Cardinal); 27 | data.push(rgba_icon.height as Cardinal); 28 | let pixels = rgba_icon.rgba.as_ptr() as *const Pixel; 29 | for pixel_index in 0..pixel_count { 30 | let pixel = unsafe { &*pixels.add(pixel_index) }; 31 | data.push(pixel.to_packed_argb()); 32 | } 33 | data 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/mod.rs: -------------------------------------------------------------------------------- 1 | pub use self::platform::*; 2 | 3 | #[cfg(target_os = "windows")] 4 | #[path = "windows/mod.rs"] 5 | mod platform; 6 | #[cfg(any( 7 | target_os = "linux", 8 | target_os = "dragonfly", 9 | target_os = "freebsd", 10 | target_os = "netbsd", 11 | target_os = "openbsd" 12 | ))] 13 | #[path = "linux/mod.rs"] 14 | mod platform; 15 | #[cfg(target_os = "macos")] 16 | #[path = "macos/mod.rs"] 17 | mod platform; 18 | #[cfg(target_os = "android")] 19 | #[path = "android/mod.rs"] 20 | mod platform; 21 | #[cfg(target_os = "ios")] 22 | #[path = "ios/mod.rs"] 23 | mod platform; 24 | #[cfg(target_arch = "wasm32")] 25 | #[path = "web/mod.rs"] 26 | mod platform; 27 | 28 | #[cfg(all( 29 | not(target_os = "ios"), 30 | not(target_os = "windows"), 31 | not(target_os = "linux"), 32 | not(target_os = "macos"), 33 | not(target_os = "android"), 34 | not(target_os = "dragonfly"), 35 | not(target_os = "freebsd"), 36 | not(target_os = "netbsd"), 37 | not(target_os = "openbsd"), 38 | not(target_arch = "wasm32"), 39 | ))] 40 | compile_error!("The platform you're compiling for is not supported by winit"); 41 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/web/device.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 2 | pub struct DeviceId(pub i32); 3 | 4 | impl DeviceId { 5 | pub const unsafe fn dummy() -> Self { 6 | Self(0) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/web/error.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | 3 | #[derive(Debug)] 4 | pub struct OsError(pub String); 5 | 6 | impl fmt::Display for OsError { 7 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 8 | write!(f, "{}", self.0) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/web/event_loop/proxy.rs: -------------------------------------------------------------------------------- 1 | use super::runner; 2 | use crate::event::Event; 3 | use crate::event_loop::EventLoopClosed; 4 | 5 | pub struct EventLoopProxy { 6 | runner: runner::Shared, 7 | } 8 | 9 | impl EventLoopProxy { 10 | pub fn new(runner: runner::Shared) -> Self { 11 | Self { runner } 12 | } 13 | 14 | pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed> { 15 | self.runner.send_event(Event::UserEvent(event)); 16 | Ok(()) 17 | } 18 | } 19 | 20 | impl Clone for EventLoopProxy { 21 | fn clone(&self) -> Self { 22 | Self { 23 | runner: self.runner.clone(), 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/web/event_loop/state.rs: -------------------------------------------------------------------------------- 1 | use super::backend; 2 | use crate::event_loop::ControlFlow; 3 | 4 | use instant::Instant; 5 | 6 | #[derive(Debug)] 7 | pub enum State { 8 | Init, 9 | WaitUntil { 10 | timeout: backend::Timeout, 11 | start: Instant, 12 | end: Instant, 13 | }, 14 | Wait { 15 | start: Instant, 16 | }, 17 | Poll { 18 | request: backend::AnimationFrameRequest, 19 | }, 20 | Exit, 21 | } 22 | 23 | impl State { 24 | pub fn is_exit(&self) -> bool { 25 | match self { 26 | State::Exit => true, 27 | _ => false, 28 | } 29 | } 30 | 31 | pub fn control_flow(&self) -> ControlFlow { 32 | match self { 33 | State::Init => ControlFlow::Poll, 34 | State::WaitUntil { end, .. } => ControlFlow::WaitUntil(*end), 35 | State::Wait { .. } => ControlFlow::Wait, 36 | State::Poll { .. } => ControlFlow::Poll, 37 | State::Exit => ControlFlow::Exit, 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/winit-kms/src/platform_impl/web/monitor.rs: -------------------------------------------------------------------------------- 1 | use crate::dpi::{PhysicalPosition, PhysicalSize}; 2 | use crate::monitor::{MonitorHandle as RootMonitorHandle, VideoMode as RootVideoMode}; 3 | 4 | #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 5 | pub struct MonitorHandle; 6 | 7 | impl MonitorHandle { 8 | pub fn scale_factor(&self) -> f64 { 9 | 1.0 10 | } 11 | 12 | pub fn position(&self) -> PhysicalPosition { 13 | PhysicalPosition { x: 0, y: 0 } 14 | } 15 | 16 | pub fn name(&self) -> Option { 17 | None 18 | } 19 | 20 | pub fn size(&self) -> PhysicalSize { 21 | PhysicalSize { 22 | width: 0, 23 | height: 0, 24 | } 25 | } 26 | 27 | pub fn video_modes(&self) -> impl Iterator { 28 | std::iter::empty() 29 | } 30 | } 31 | 32 | #[derive(Clone, Debug, PartialEq, Eq, Hash)] 33 | pub struct VideoMode; 34 | 35 | impl VideoMode { 36 | pub fn size(&self) -> PhysicalSize { 37 | unimplemented!(); 38 | } 39 | 40 | pub fn bit_depth(&self) -> u16 { 41 | unimplemented!(); 42 | } 43 | 44 | pub fn refresh_rate(&self) -> u16 { 45 | 32 46 | } 47 | 48 | pub fn monitor(&self) -> RootMonitorHandle { 49 | RootMonitorHandle { 50 | inner: MonitorHandle, 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/winit-kms/tests/send_objects.rs: -------------------------------------------------------------------------------- 1 | #[allow(dead_code)] 2 | fn needs_send() {} 3 | 4 | #[cfg(not(target_arch = "wasm32"))] 5 | #[test] 6 | fn event_loop_proxy_send() { 7 | #[allow(dead_code)] 8 | fn is_send() { 9 | // ensures that `winit::EventLoopProxy` implements `Send` 10 | needs_send::>(); 11 | } 12 | } 13 | 14 | #[cfg(not(target_arch = "wasm32"))] 15 | #[test] 16 | fn window_send() { 17 | // ensures that `winit::Window` implements `Send` 18 | needs_send::(); 19 | } 20 | 21 | #[test] 22 | fn ids_send() { 23 | // ensures that the various `..Id` types implement `Send` 24 | needs_send::(); 25 | needs_send::(); 26 | needs_send::(); 27 | } 28 | -------------------------------------------------------------------------------- /lib/winit-kms/tests/serde_objects.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "serde")] 2 | 3 | use serde::{Deserialize, Serialize}; 4 | use winit::{ 5 | dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize}, 6 | event::{ 7 | ElementState, KeyboardInput, ModifiersState, MouseButton, MouseScrollDelta, TouchPhase, 8 | VirtualKeyCode, 9 | }, 10 | window::CursorIcon, 11 | }; 12 | 13 | #[allow(dead_code)] 14 | fn needs_serde>() {} 15 | 16 | #[test] 17 | fn window_serde() { 18 | needs_serde::(); 19 | } 20 | 21 | #[test] 22 | fn events_serde() { 23 | needs_serde::(); 24 | needs_serde::(); 25 | needs_serde::(); 26 | needs_serde::(); 27 | needs_serde::(); 28 | needs_serde::(); 29 | needs_serde::(); 30 | } 31 | 32 | #[test] 33 | fn dpi_serde() { 34 | needs_serde::>(); 35 | needs_serde::>(); 36 | needs_serde::>(); 37 | needs_serde::>(); 38 | needs_serde::>(); 39 | } 40 | -------------------------------------------------------------------------------- /lib/winit-kms/tests/sync_object.rs: -------------------------------------------------------------------------------- 1 | #[allow(dead_code)] 2 | fn needs_sync() {} 3 | 4 | #[cfg(not(target_arch = "wasm32"))] 5 | #[test] 6 | fn window_sync() { 7 | // ensures that `winit::Window` implements `Sync` 8 | needs_sync::(); 9 | } 10 | --------------------------------------------------------------------------------