added log button + icon for project manager

This commit is contained in:
Dmitry Stepanov
2024-12-04 20:56:32 +03:00
parent ac92f2599d
commit e047136fe3
5 changed files with 60 additions and 15 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+5 -1
View File
@@ -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,
@@ -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
+48 -12
View File
@@ -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};
@@ -227,26 +226,63 @@ 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.";
@@ -254,9 +290,9 @@ impl ProjectManager {
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))
+2 -2
View File
@@ -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)
+5
View File
@@ -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))