Skip to content

Commit

Permalink
Merge pull request #262 from Nazariglez/f/0.9.5
Browse files Browse the repository at this point in the history
0.9.5
  • Loading branch information
Nazariglez authored Apr 18, 2023
2 parents 4c2013b + 3b647fa commit a080237
Show file tree
Hide file tree
Showing 36 changed files with 267 additions and 148 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.

## v0.9.5 - 19/03/2023

- Increased mouse wheel scroll speed on native platforms.
- Added `WindowBackend::set_touch_as_mouse` and `touch_as_mouse` to enable/disable it at runtime.
- Fix `Event::Exit` which is triggered now before the app is closed.
- Add `WindowConfig::set_window_icon_data` and `set_taskbar_icon_data` to set them using bytes. Check `examples/window_icon_from_raw.rs` for more info.
- Allow to load images without allocation limits, return an error if the image is bigger than the size supported by the GPU.

## v0.9.4 - 26/02/2023

- Added `WindowBackend::set_title` and `WindowBackend::title` to change or get the title at any time.
Expand Down
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "notan"
version = "0.9.4"
version = "0.9.5"
authors = ["Nazarí González <[email protected]>"]
edition = "2021"
categories = ["graphics", "rendering", "wasm", "gui", "multimedia"]
Expand All @@ -19,22 +19,22 @@ features = ["default", "glyph", "egui", "text", "extra", "audio", "links", "drop
lto = true

[dependencies]
notan_core = { path = "crates/notan_core", version = "0.9.4" }
notan_input = { path = "crates/notan_input", version = "0.9.4" }
notan_app = { path = "crates/notan_app", version = "0.9.4" }
notan_macro = { path = "crates/notan_macro", version = "0.9.4" }
notan_math = { path = "crates/notan_math", version = "0.9.4" }
notan_graphics = { path = "crates/notan_graphics", version = "0.9.4" }
notan_utils = { path = "crates/notan_utils", version = "0.9.4" }
notan_log = { path = "crates/notan_log", version = "0.9.4", optional = true }
notan_glyph = { path = "crates/notan_glyph", version = "0.9.4", optional = true }
notan_draw = { path = "crates/notan_draw", version = "0.9.4", optional = true }
notan_backend = { path = "crates/notan_backend", version = "0.9.4", optional = true }
notan_egui = { path = "crates/notan_egui", version = "0.9.4", optional = true }
notan_text = { path = "crates/notan_text", version = "0.9.4", optional = true }
notan_audio = { path = "crates/notan_audio", version = "0.9.4", optional = true }
notan_extra = { path = "crates/notan_extra", version = "0.9.4", optional = true }
notan_random = { path = "crates/notan_random", version = "0.9.4", optional = true }
notan_core = { path = "crates/notan_core", version = "0.9.5" }
notan_input = { path = "crates/notan_input", version = "0.9.5" }
notan_app = { path = "crates/notan_app", version = "0.9.5" }
notan_macro = { path = "crates/notan_macro", version = "0.9.5" }
notan_math = { path = "crates/notan_math", version = "0.9.5" }
notan_graphics = { path = "crates/notan_graphics", version = "0.9.5" }
notan_utils = { path = "crates/notan_utils", version = "0.9.5" }
notan_log = { path = "crates/notan_log", version = "0.9.5", optional = true }
notan_glyph = { path = "crates/notan_glyph", version = "0.9.5", optional = true }
notan_draw = { path = "crates/notan_draw", version = "0.9.5", optional = true }
notan_backend = { path = "crates/notan_backend", version = "0.9.5", optional = true }
notan_egui = { path = "crates/notan_egui", version = "0.9.5", optional = true }
notan_text = { path = "crates/notan_text", version = "0.9.5", optional = true }
notan_audio = { path = "crates/notan_audio", version = "0.9.5", optional = true }
notan_extra = { path = "crates/notan_extra", version = "0.9.5", optional = true }
notan_random = { path = "crates/notan_random", version = "0.9.5", optional = true }

[workspace]
members = ["crates/*"]
Expand Down
16 changes: 8 additions & 8 deletions crates/notan_app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "notan_app"
version = "0.9.4"
version = "0.9.5"
authors = ["Nazarí González <[email protected]>"]
edition = "2021"
readme = "README.md"
Expand All @@ -14,13 +14,13 @@ description = "Provides the core API for Notan"
[dependencies]
log = "0.4.17"
hashbrown = "0.13.2"
notan_core = { path = "../notan_core", version = "0.9.4" }
notan_input = { path = "../notan_input", version = "0.9.4" }
notan_math = { path = "../notan_math", version = "0.9.4" }
notan_macro = { path = "../notan_macro", version = "0.9.4" }
notan_graphics = { path = "../notan_graphics", version = "0.9.4" }
notan_utils = { path = "../notan_utils", version = "0.9.4" }
notan_audio = { path = "../notan_audio", version = "0.9.4", optional = true }
notan_core = { path = "../notan_core", version = "0.9.5" }
notan_input = { path = "../notan_input", version = "0.9.5" }
notan_math = { path = "../notan_math", version = "0.9.5" }
notan_macro = { path = "../notan_macro", version = "0.9.5" }
notan_graphics = { path = "../notan_graphics", version = "0.9.5" }
notan_utils = { path = "../notan_utils", version = "0.9.5" }
notan_audio = { path = "../notan_audio", version = "0.9.5", optional = true }
downcast-rs = "1.2.0"
indexmap = "1.9.2"
futures = "0.3.25"
Expand Down
6 changes: 6 additions & 0 deletions crates/notan_app/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,10 @@ pub trait WindowBackend {
fn width(&self) -> i32 {
self.size().0
}

/// Use touch event as mouse events
fn set_touch_as_mouse(&mut self, enable: bool);

/// Returns if touch as mouse is enabled
fn touch_as_mouse(&self) -> bool;
}
13 changes: 11 additions & 2 deletions crates/notan_app/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ where
#[cfg(not(feature = "audio"))]
let mut app = App::new(Box::new(backend));

app.window().set_touch_as_mouse(use_touch_as_mouse);

let (width, height) = app.window().size();
let win_dpi = app.window().dpi();
graphics.set_size(width, height);
Expand All @@ -254,7 +256,7 @@ where
cb(&mut app, &mut assets, &mut graphics, &mut plugins);
}

// add plguins
// add plugins
plugin_callbacks.reverse();
while let Some(cb) = plugin_callbacks.pop() {
cb(&mut app, &mut assets, &mut graphics, &mut plugins);
Expand Down Expand Up @@ -306,6 +308,8 @@ where

let delta = app.timer.delta_f32();

let use_touch_as_mouse = app.window().touch_as_mouse();

// Manage each event
let mut events = app.backend.events_iter();
while let Some(evt) = events.next() {
Expand Down Expand Up @@ -370,8 +374,13 @@ where
#[cfg(feature = "audio")]
app.audio.clean();

// dispatch Event::Exit before close the app
if app.closed {
log::debug!("App Closed");
let evt = Event::Exit;
let _ = plugins.event(app, &mut assets, &evt)?;
if let Some(cb) = &event_callback {
cb.exec(app, &mut assets, &mut plugins, state, evt);
}
}

// Using lazy loop we need to draw 2 frames at the beginning to avoid
Expand Down
24 changes: 22 additions & 2 deletions crates/notan_app/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ pub struct WindowConfig {
/// Use or create the canvas with this id. Only Web.
pub canvas_id: String,

/// Window icon file
/// Optinal Window icon filepath
pub window_icon_path: Option<PathBuf>,

/// Task bar icon file
/// Optinal Window icon filedata
pub window_icon_data: Option<&'static [u8]>,

/// Optinal Task bar icon filepath
pub taskbar_icon_path: Option<PathBuf>,

/// Optinal Task bar icon filedata
pub taskbar_icon_data: Option<&'static [u8]>,
}

impl Default for WindowConfig {
Expand All @@ -99,7 +105,9 @@ impl Default for WindowConfig {
mouse_passthrough: false,
canvas_id: String::from("notan_canvas"),
window_icon_path: None,
window_icon_data: None,
taskbar_icon_path: None,
taskbar_icon_data: None,
}
}
}
Expand Down Expand Up @@ -219,11 +227,23 @@ impl WindowConfig {
self
}

/// Window icon data
pub fn set_window_icon_data(mut self, window_icon_data: Option<&'static [u8]>) -> Self {
self.window_icon_data = window_icon_data;
self
}

/// Task bar icon path
pub fn taskbar_icon(mut self, taskbar_icon_path: Option<PathBuf>) -> Self {
self.taskbar_icon_path = taskbar_icon_path;
self
}

/// Task bar icon data
pub fn set_taskbar_icon_data(mut self, taskbar_icon_data: Option<&'static [u8]>) -> Self {
self.taskbar_icon_data = taskbar_icon_data;
self
}
}

impl<S, B> BuildConfig<S, B> for WindowConfig
Expand Down
Loading

0 comments on commit a080237

Please sign in to comment.