Skip to content

Commit

Permalink
added log button + icon for project manager
Browse files Browse the repository at this point in the history
  • Loading branch information
mrDIMAS committed Dec 4, 2024
1 parent ac92f25 commit e047136
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 15 deletions.
Binary file added project-manager/resources/caution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion project-manager/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn main() {
graphics_context_params: GraphicsContextParams {
window_attributes,
vsync: true,
msaa_sample_count: None,
msaa_sample_count: Some(2),
},
resource_manager: ResourceManager::new(task_pool.clone()),
serialization_context,
Expand Down Expand Up @@ -88,6 +88,10 @@ fn main() {
engine
.initialize_graphics_context(window_target)
.expect("Unable to initialize graphics context!");
engine
.graphics_context
.as_initialized_mut()
.set_window_icon_from_memory(include_bytes!("../resources/icon.png"));
}
Event::Suspended => {
engine
Expand Down
60 changes: 48 additions & 12 deletions project-manager/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ use fyrox::{
utils::make_simple_tooltip,
widget::{WidgetBuilder, WidgetMessage},
window::{WindowBuilder, WindowMessage},
BuildContext, HorizontalAlignment, Orientation, Thickness, UiNode, UserInterface,
VerticalAlignment,
BuildContext, HorizontalAlignment, Thickness, UiNode, UserInterface, VerticalAlignment,
},
};
use fyrox_build_tools::{BuildCommand, BuildProfile};
Expand Down Expand Up @@ -227,36 +226,73 @@ impl ProjectManager {
settings.";
let import_tooltip = "Allows you to import an existing project in the project manager.";

let create = make_button("+ Create", 100.0, 25.0, 0, Some(create_tooltip), ctx);
let import = make_button("Import", 100.0, 25.0, 1, Some(import_tooltip), ctx);
let create = make_button("+ Create", 100.0, 25.0, 0, 0, 0, Some(create_tooltip), ctx);
let import = make_button("Import", 100.0, 25.0, 1, 0, 1, Some(import_tooltip), ctx);
let search_bar = SearchBarBuilder::new(
WidgetBuilder::new()
.on_column(2)
.with_tab_index(Some(2))
.with_margin(Thickness::uniform(1.0))
.with_height(25.0)
.with_width(200.0),
.with_height(25.0),
)
.build(ctx);

let toolbar = StackPanelBuilder::new(
let log = GridBuilder::new(
WidgetBuilder::new()
.with_vertical_alignment(VerticalAlignment::Center)
.on_column(3)
.with_child(
ImageBuilder::new(
WidgetBuilder::new()
.with_margin(Thickness::uniform(1.0))
.with_width(18.0)
.with_height(18.0)
.on_column(0),
)
.with_opt_texture(load_image(include_bytes!("../resources/caution.png")))
.build(ctx),
)
.with_child(
TextBuilder::new(
WidgetBuilder::new()
.on_column(1)
.with_margin(Thickness::uniform(1.0))
.with_vertical_alignment(VerticalAlignment::Center)
.with_foreground(Brush::Solid(Color::GOLD).into()),
)
.with_text("2")
.build(ctx),
),
)
.add_column(Column::auto())
.add_column(Column::auto())
.add_row(Row::auto())
.build(ctx);

let toolbar = GridBuilder::new(
WidgetBuilder::new()
.with_enabled(is_ready)
.on_row(1)
.with_child(create)
.with_child(import)
.with_child(search_bar),
.with_child(search_bar)
.with_child(log),
)
.with_orientation(Orientation::Horizontal)
.add_column(Column::auto())
.add_column(Column::auto())
.add_column(Column::stretch())
.add_column(Column::auto())
.add_row(Row::auto())
.build(ctx);

let edit_tooltip = "Build the editor and run it.";
let run_tooltip = "Build the game and run it.";
let delete_tooltip = "Delete the entire project with all its assets. \
WARNING: This is irreversible operation and permanently deletes your project!";

let edit = make_button("Edit", 130.0, 25.0, 3, Some(edit_tooltip), ctx);
let run = make_button("Run", 130.0, 25.0, 4, Some(run_tooltip), ctx);
let delete = make_button("Delete", 130.0, 25.0, 5, Some(delete_tooltip), ctx);
let edit = make_button("Edit", 130.0, 25.0, 3, 0, 0, Some(edit_tooltip), ctx);
let run = make_button("Run", 130.0, 25.0, 4, 0, 0, Some(run_tooltip), ctx);
let delete = make_button("Delete", 130.0, 25.0, 5, 0, 0, Some(delete_tooltip), ctx);
let hot_reload = CheckBoxBuilder::new(
WidgetBuilder::new()
.with_margin(Thickness::uniform(1.0))
Expand Down
4 changes: 2 additions & 2 deletions project-manager/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ impl ProjectWizard {
.with_selected(1)
.build(ctx);

let create = make_button("Create", 100.0, 22.0, 0, None, ctx);
let cancel = make_button("Cancel", 100.0, 22.0, 0, None, ctx);
let create = make_button("Create", 100.0, 22.0, 0, 0, 0, None, ctx);
let cancel = make_button("Cancel", 100.0, 22.0, 0, 0, 0, None, ctx);
let buttons = StackPanelBuilder::new(
WidgetBuilder::new()
.on_row(1)
Expand Down
5 changes: 5 additions & 0 deletions project-manager/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,20 @@ pub fn make_dropdown_list_option(ctx: &mut BuildContext, name: &str) -> Handle<U
.build(ctx)
}

#[allow(clippy::too_many_arguments)]
pub fn make_button(
text: &str,
width: f32,
height: f32,
tab_index: usize,
row: usize,
column: usize,
tooltip: Option<&str>,
ctx: &mut BuildContext,
) -> Handle<UiNode> {
let mut widget_builder = WidgetBuilder::new()
.on_row(row)
.on_column(column)
.with_width(width)
.with_height(height)
.with_tab_index(Some(tab_index))
Expand Down

0 comments on commit e047136

Please sign in to comment.