Skip to content

Commit

Permalink
bump version 0.2.1. and make a releae
Browse files Browse the repository at this point in the history
  • Loading branch information
coderedart committed Oct 9, 2023
1 parent 0762f96 commit 8022e5a
Show file tree
Hide file tree
Showing 17 changed files with 240 additions and 178 deletions.
216 changes: 105 additions & 111 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion crates/joko_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
[package]
name = "joko_core"
version = "0.1.0"
version = "0.2.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cap-directories = { version = "*" }
cap-std = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3", features = [
"env-filter",
"time",
] } # for ErrorLayer
tracing-appender = { version = "*" }
miette = { workspace = true }

egui = { workspace = true, features = ["serde"] }
egui_extras = { workspace = true }

ringbuffer = { workspace = true }
rayon = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
indexmap = { workspace = true }
rfd = { workspace = true }
glam = { workspace = true }
21 changes: 8 additions & 13 deletions crates/joko_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
pub mod manager;
/*
each manager must have
1. a main thread struct
2. an off thread struct
3. commands that they send/receive
4. a public api for other managers to access
#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
*/
2 changes: 2 additions & 0 deletions crates/joko_core/src/manager/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod theme;
pub mod trace;
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/joko_marker_format/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "joko_marker_format"
version = "0.1.0"
version = "0.2.1"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/joko_render/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "joko_render"
version = "0.1.0"
version = "0.2.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -16,4 +16,4 @@ tracing = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
egui = { workspace = true }
raw-window-handle = { version = "*" }
raw-window-handle = { version = "0.5" }
4 changes: 2 additions & 2 deletions crates/joko_render/shaders/marker.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ fn vs_main(

@fragment
fn fs_main(vout: VertexOutput) -> @location(0) vec4<f32> {
var color: vec4<f32> = textureSample(r_tex_color, r_tex_sampler, vout.tex_coord);
var color: vec4<f32> = textureSampleBias(r_tex_color, r_tex_sampler, vout.tex_coord, -2.0);
color.a = color.a * vout.alpha;
if color.a < 0.001 {
if color.a < 0.01 {
discard;
}
return color;
Expand Down
4 changes: 2 additions & 2 deletions crates/joko_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl JokoRenderer {
power_preference,
device_descriptor,
surface_formats_priority,
surface_config,
mut surface_config,
backends,
transparent_surface,
} = config;
Expand All @@ -53,7 +53,7 @@ impl JokoRenderer {
for adapter in instance.enumerate_adapters(backends) {
debug!("adapter: {:#?}", adapter.get_info());
}

surface_config.present_mode = egui_render_wgpu::wgpu::PresentMode::AutoVsync;
let surface = Some(unsafe {
use raw_window_handle::HasRawWindowHandle;
debug!(
Expand Down
2 changes: 1 addition & 1 deletion crates/jokoapi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jokoapi"
version = "0.1.0"
version = "0.2.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
3 changes: 2 additions & 1 deletion crates/jokolay/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jokolay"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
default-run = "jokolay"

Expand All @@ -13,6 +13,7 @@ path = "src/main.rs"
wayland = ["egui_window_glfw_passthrough/wayland"]

[dependencies]
joko_core = { path = "../joko_core" }
joko_render = { path = "../joko_render" }
jmf = { path = "../joko_marker_format", package = "joko_marker_format" }
jokolink = { path = "../jokolink" }
Expand Down
30 changes: 0 additions & 30 deletions crates/jokolay/src/app/frame.rs

This file was deleted.

29 changes: 17 additions & 12 deletions crates/jokolay/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@ use std::sync::Arc;

use cap_std::fs_utf8::Dir;
use egui_window_glfw_passthrough::{GlfwBackend, GlfwConfig};
mod frame;
mod init;
mod theme;
mod trace;
use self::theme::ThemeManager;
mod wm;
use init::get_jokolay_dir;
use jmf::MarkerManager;
use joko_core::manager::{theme::ThemeManager, trace::JokolayTracingLayer};
use joko_render::JokoRenderer;
use jokolink::{MumbleChanges, MumbleManager};
use miette::{Context, Result};
use trace::JokolayTracingLayer;
use tracing::{error, info};
#[allow(unused)]
pub struct Jokolay {
frame_stats: frame::FrameStatistics,
frame_stats: wm::WindowStatistics,
jdir: Arc<Dir>,
menu_panel: MenuPanel,
mumble_manager: MumbleManager,
Expand Down Expand Up @@ -65,7 +62,7 @@ impl Jokolay {
Ok(Self {
mumble_manager: mumble,
marker_manager,
frame_stats: frame::FrameStatistics::new(glfw_backend.glfw.get_time() as _),
frame_stats: wm::WindowStatistics::new(glfw_backend.glfw.get_time() as _),
joko_renderer,
glfw_backend,
jdir,
Expand All @@ -76,6 +73,8 @@ impl Jokolay {
}
pub fn enter_event_loop(mut self) {
tracing::info!("entering glfw event loop");
self.menu_panel.show_theme_window = true;
self.menu_panel.show_marker_manager_window = true;
loop {
let Self {
frame_stats,
Expand Down Expand Up @@ -125,9 +124,12 @@ impl Jokolay {
];
latest_size
});
let input = glfw_backend.take_raw_input();
etx.begin_frame(input);

let latest_time = glfw_backend.glfw.get_time();
let mut input = glfw_backend.take_raw_input();
input.time = Some(latest_time);

etx.begin_frame(input);
// do all the non-gui stuff first
frame_stats.tick(latest_time);
let link = match mumble_manager.tick() {
Expand Down Expand Up @@ -155,6 +157,10 @@ impl Jokolay {
.size((MenuPanel::HEIGHT - 2.0) * menu_panel.ui_scaling_factor)
.background_color(egui::Color32::TRANSPARENT),
|ui| {
ui.checkbox(
&mut menu_panel.show_window_manager,
"Show Window Manager",
);
ui.checkbox(
&mut menu_panel.show_marker_manager_window,
"Show Marker Manager",
Expand All @@ -181,9 +187,7 @@ impl Jokolay {
mumble_manager.gui(&etx, &mut menu_panel.show_mumble_manager_winodw);
JokolayTracingLayer::gui(&etx, &mut menu_panel.show_tracing_window);
theme_manager.gui(&etx, &mut menu_panel.show_theme_window);
egui::Window::new("fps").show(&etx, |ui| {
frame_stats.gui(ui);
});
frame_stats.gui(&etx, glfw_backend, &mut menu_panel.show_window_manager);
// show notifications
JokolayTracingLayer::show_notifications(&etx);

Expand Down Expand Up @@ -327,6 +331,7 @@ pub struct MenuPanel {
// show_settings_window: bool,
show_marker_manager_window: bool,
show_mumble_manager_winodw: bool,
show_window_manager: bool,
}

impl MenuPanel {
Expand Down
75 changes: 75 additions & 0 deletions crates/jokolay/src/app/wm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
use egui_window_glfw_passthrough::GlfwBackend;

pub struct WindowStatistics {
pub fps_last_reset: f64,
pub frame_count: u32,
pub total_frame_count: u32,
pub average_fps: u32,
}

impl WindowStatistics {
pub fn new(current_time: f64) -> Self {
Self {
fps_last_reset: current_time,
frame_count: 0,
total_frame_count: 0,
average_fps: 0,
}
}

pub fn tick(&mut self, current_time: f64) {
self.total_frame_count += 1;
self.frame_count += 1;
if current_time - self.fps_last_reset > 1.0 {
self.average_fps = self.frame_count;
self.frame_count = 0;
self.fps_last_reset = current_time;
}
}

pub fn gui(&mut self, etx: &egui::Context, wb: &mut GlfwBackend, open: &mut bool) {
egui::Window::new("Window Manager")
.open(open)
.show(etx, |ui| {
egui::Grid::new("frame details")
.num_columns(2)
.show(ui, |ui| {
ui.label("fps");
ui.label(&format!("{}", self.average_fps));
ui.end_row();
ui.label("frame count");
ui.label(&format!("{}", self.total_frame_count));
ui.end_row();
ui.label("jokolay pos");
ui.label(&format!(
"x: {}; y: {}",
wb.window_position[0], wb.window_position[1]
));
ui.end_row();
ui.label("jokolay size");
ui.label(&format!(
"width: {}, height: {}",
wb.framebuffer_size_physical[0], wb.framebuffer_size_physical[1]
));
ui.end_row();
ui.label("decorations (borders)");
let is_decorated = wb.window.is_decorated();
let mut result = is_decorated;
if ui
.checkbox(
&mut result,
if is_decorated {
"borders visible"
} else {
"borders hidden"
},
)
.changed()
{
wb.window.set_decorated(result);
}
ui.end_row();
});
});
}
}
4 changes: 2 additions & 2 deletions crates/jokolink/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jokolink"
version = "0.1.0"
version = "0.2.1"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
Expand All @@ -23,7 +23,7 @@ egui = { workspace = true }
serde = { workspace = true }
glam = { workspace = true }
serde_json = { workspace = true }
notify ={ version = "*", default-features = false}
notify = { version = "*", default-features = false }
[target.'cfg(unix)'.dependencies]
x11rb = { version = "0.12", default-features = false, features = [] }

Expand Down

0 comments on commit 8022e5a

Please sign in to comment.