Feat: add hidden mode and new documentation
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//! Egui integration layer for baseview windows.
|
||||
|
||||
mod renderer;
|
||||
mod translate;
|
||||
mod window;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! GPU renderer backend selection (currently OpenGL only).
|
||||
|
||||
#[cfg(feature = "opengl")]
|
||||
mod opengl;
|
||||
#[cfg(feature = "opengl")]
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
//! OpenGL renderer errors and submodule.
|
||||
|
||||
use egui_glow::PainterError;
|
||||
use thiserror::Error;
|
||||
|
||||
pub mod renderer;
|
||||
|
||||
/// Errors from OpenGL context or painter initialization.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum OpenGlError {
|
||||
#[error("Failed to get baseview's GL context")]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Glow-based OpenGL renderer for egui inside a baseview window.
|
||||
|
||||
use baseview::{PhySize, Window};
|
||||
use egui::FullOutput;
|
||||
use egui_glow::Painter;
|
||||
@@ -5,6 +7,7 @@ use std::sync::Arc;
|
||||
|
||||
use super::OpenGlError;
|
||||
|
||||
/// OpenGL rendering options for the egui painter.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GraphicsConfig {
|
||||
/// Controls whether to apply dithering to minimize banding artifacts.
|
||||
@@ -32,12 +35,14 @@ impl Default for GraphicsConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Manages glow context and egui painter lifecycle.
|
||||
pub struct Renderer {
|
||||
glow_context: Arc<egui_glow::glow::Context>,
|
||||
painter: Painter,
|
||||
}
|
||||
|
||||
impl Renderer {
|
||||
/// Create a renderer from the baseview window's GL context.
|
||||
pub fn new(window: &Window, config: GraphicsConfig) -> Result<Self, OpenGlError> {
|
||||
let context = window.gl_context().ok_or(OpenGlError::NoContext)?;
|
||||
unsafe {
|
||||
@@ -71,6 +76,7 @@ impl Renderer {
|
||||
self.painter.max_texture_side()
|
||||
}
|
||||
|
||||
/// Render a completed egui frame to the window.
|
||||
pub fn render(
|
||||
&mut self,
|
||||
window: &Window,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Baseview-to-egui event translation.
|
||||
|
||||
pub(crate) fn translate_mouse_button(button: baseview::MouseButton) -> Option<egui::PointerButton> {
|
||||
match button {
|
||||
baseview::MouseButton::Left => Some(egui::PointerButton::Primary),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Egui window wrapper over baseview, handling input, rendering, and clipboard.
|
||||
|
||||
use std::time::Instant;
|
||||
|
||||
use baseview::{
|
||||
@@ -14,6 +16,7 @@ use crate::{renderer::Renderer, GraphicsConfig};
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing::{error, warn};
|
||||
|
||||
/// Deferred command queue available during the update callback.
|
||||
pub struct Queue<'a> {
|
||||
bg_color: &'a mut Rgba,
|
||||
close_requested: &'a mut bool,
|
||||
|
||||
Reference in New Issue
Block a user