Skip to content

Commit

Permalink
Fix release build
Browse files Browse the repository at this point in the history
  • Loading branch information
vE5li committed Apr 15, 2024
1 parent bb6a0af commit 4248dad
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
1 change: 1 addition & 0 deletions korangar/src/interface/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ pub struct Themes {
impl Themes {
pub fn new(menu: InterfaceTheme, main: InterfaceTheme, game: GameTheme) -> Self {
Self {
#[cfg(feature = "debug")]
theme_actions: Default::default(),
menu,
main,
Expand Down
4 changes: 1 addition & 3 deletions korangar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ use cgmath::{Vector2, Vector3, Zero};
use image::io::Reader as ImageReader;
use image::{EncodableLayout, ImageFormat};
use korangar_interface::application::{Application, FocusState, FontSizeTrait, FontSizeTraitExt, PositionTraitExt};
use korangar_interface::state::{
PlainTrackedState, Remote, RemoteClone, TrackedState, TrackedStateBinary, TrackedStateClone, TrackedStateVec,
};
use korangar_interface::state::{PlainTrackedState, Remote, RemoteClone, TrackedState, TrackedStateVec};
use korangar_interface::Interface;
use korangar_procedural::debug_condition;
use network::SkillType;
Expand Down
57 changes: 29 additions & 28 deletions korangar_interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ where
}
}

#[cfg_attr(feature = "debug", procedural::profile("update user interface"))]
// #[cfg_attr(feature = "debug", procedural::profile("update user interface"))]
pub fn update(&mut self, application: &App, font_loader: App::FontLoader, focus_state: &mut FocusState<App>) -> (bool, bool) {
for (window, post_update) in &mut self.windows {
#[cfg(feature = "debug")]
profile_block!("update window");
// #[cfg(feature = "debug")]
// profile_block!("update window");

if let Some(change_event) = window.update() {
Self::handle_change_event(&mut self.post_update, post_update, change_event);
Expand All @@ -185,8 +185,8 @@ where

for (window_index, (window, post_update)) in self.windows.iter_mut().enumerate() {
if self.post_update.needs_resolve() || post_update.take_resolve() {
#[cfg(feature = "debug")]
profile_block!("resolve window");
// #[cfg(feature = "debug")]
// profile_block!("resolve window");

let (_position, previous_size) = window.get_area();
let kind = window.get_theme_kind();
Expand Down Expand Up @@ -225,8 +225,8 @@ where
if !self.post_update.needs_render() {
// We profile this block rather than the flag function itself because it calls
// itself recursively
#[cfg(feature = "debug")]
profile_block!("flag render windows");
// #[cfg(feature = "debug")]
// profile_block!("flag render windows");

self.flag_render_windows(application, 0, None);
}
Expand All @@ -242,7 +242,7 @@ where
self.post_update.resolve();
}

#[cfg_attr(feature = "debug", procedural::profile("get hovered element"))]
// #[cfg_attr(feature = "debug", procedural::profile("get hovered element"))]
pub fn hovered_element(
&self,
mouse_position: App::Position,
Expand All @@ -259,7 +259,7 @@ where
(None, None)
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn move_window_to_top(&mut self, window_index: usize) -> usize {
let (window, post_update) = self.windows.remove(window_index);
let new_window_index = self.windows.len();
Expand All @@ -269,7 +269,7 @@ where
new_window_index
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn left_click_element(&mut self, hovered_element: &ElementCell<App>, window_index: usize) -> Vec<ClickAction<App>> {
let (_, post_update) = &mut self.windows[window_index];
let mut resolve = false;
Expand All @@ -283,7 +283,7 @@ where
action
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn right_click_element(&mut self, hovered_element: &ElementCell<App>, window_index: usize) -> Vec<ClickAction<App>> {
let (_, post_update) = &mut self.windows[window_index];
let mut resolve = false;
Expand All @@ -297,7 +297,7 @@ where
action
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn drag_element(&mut self, element: &ElementCell<App>, _window_index: usize, mouse_delta: App::Position) {
//let (_window, post_update) = &mut self.windows[window_index];

Expand All @@ -307,7 +307,7 @@ where
}
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn scroll_element(&mut self, element: &ElementCell<App>, window_index: usize, scroll_delta: f32) {
let (_, post_update) = &mut self.windows[window_index];

Expand All @@ -316,7 +316,7 @@ where
}
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn input_character_element(&mut self, element: &ElementCell<App>, window_index: usize, character: char) -> Vec<ClickAction<App>> {
let (_, post_update) = &mut self.windows[window_index];
let mut propagated_actions = Vec::new();
Expand All @@ -331,7 +331,7 @@ where
propagated_actions
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn move_window(&mut self, window_index: usize, offset: App::Position) {
if let Some((window_class, position)) = self.windows[window_index].0.offset(self.available_space, offset) {
self.window_cache.update_position(window_class, position);
Expand All @@ -340,7 +340,7 @@ where
self.post_update.render();
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn resize_window(&mut self, application: &App, window_index: usize, growth: App::Size) {
let (window, post_update) = &mut self.windows[window_index];

Expand Down Expand Up @@ -390,7 +390,7 @@ where
}
}

#[cfg_attr(feature = "debug", procedural::profile("render user interface"))]
// #[cfg_attr(feature = "debug", procedural::profile("render user interface"))]
pub fn render(
&mut self,
render_target: &mut <App::Renderer as InterfaceRenderer<App>>::Target,
Expand All @@ -405,8 +405,8 @@ where

for (window, post_update) in &mut self.windows {
if post_update.take_render() || self.post_update.needs_render() {
#[cfg(feature = "debug")]
profile_block!("render window");
// #[cfg(feature = "debug")]
// profile_block!("render window");

let kind = window.get_theme_kind();
let theme = application.get_theme(kind);
Expand All @@ -426,7 +426,7 @@ where
self.post_update.take_render();
}

#[cfg_attr(feature = "debug", procedural::profile("check window exists"))]
// #[cfg_attr(feature = "debug", procedural::profile("check window exists"))]
fn window_exists(&self, window_class: Option<&str>) -> bool {
match window_class {
Some(window_class) => self.windows.iter().any(|window| {
Expand All @@ -444,15 +444,15 @@ where
focus_state.set_focused_window(self.windows.len() - 1);
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn open_window(&mut self, application: &App, focus_state: &mut FocusState<App>, prototype_window: &dyn PrototypeWindow<App>) {
if !self.window_exists(prototype_window.window_class()) {
let window = prototype_window.to_window(&self.window_cache, application, self.available_space);
self.open_new_window(focus_state, window);
}
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn open_popup(
&mut self,
element: ElementCell<App>,
Expand All @@ -465,14 +465,14 @@ where
entry.1.resolve();
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn close_popup(&mut self, window_index: usize) {
let entry = &mut self.windows[window_index];
entry.0.close_popup();
entry.1.render();
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn close_window(&mut self, focus_state: &mut FocusState<App>, window_index: usize) {
let (window, ..) = self.windows.remove(window_index);
self.post_update.render();
Expand All @@ -489,7 +489,7 @@ where
&self.windows[window_index].0
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn close_window_with_class(&mut self, focus_state: &mut FocusState<App>, window_class: &str) {
let index_from_back = self
.windows
Expand All @@ -503,7 +503,7 @@ where
self.close_window(focus_state, index);
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn close_all_windows_except(&mut self, focus_state: &mut FocusState<App>) {
for index in (0..self.windows.len()).rev() {
if self.windows[index]
Expand All @@ -517,7 +517,8 @@ where
}
}

#[cfg_attr(feature = "debug", procedural::profile("get first focused element"))]
// #[cfg_attr(feature = "debug", procedural::profile("get first focused
// element"))]
pub fn first_focused_element(&self, focus_state: &mut FocusState<App>) {
if self.windows.is_empty() {
return;
Expand All @@ -529,7 +530,7 @@ where
focus_state.set_focused_element(element, window_index);
}

#[cfg_attr(feature = "debug", procedural::profile)]
// #[cfg_attr(feature = "debug", procedural::profile)]
pub fn restore_focus(&self, focus_state: &mut FocusState<App>) {
if self.windows.is_empty() {
return;
Expand Down

0 comments on commit 4248dad

Please sign in to comment.