Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pomme-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ fn main() {
("sky.frag", shaderc::ShaderKind::Fragment),
("cull.comp", shaderc::ShaderKind::Compute),
("blur.vert", shaderc::ShaderKind::Vertex),
("blur.frag", shaderc::ShaderKind::Fragment),
("entity.vert", shaderc::ShaderKind::Vertex),
("entity.frag", shaderc::ShaderKind::Fragment),
("entity_outline.frag", shaderc::ShaderKind::Fragment),
Expand Down
9 changes: 5 additions & 4 deletions pomme-client/src/app/phases/connecting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::app::core::AppCore;
use crate::app::phases::in_game::{GameState, build_server_screens};
use crate::app::phases::{ConnectionPhase, Gfx, Panorama, draw_status};
use crate::net::connection::ConnectionHandle;
use crate::renderer::pipelines::menu_overlay::MenuElement;
use crate::singleplayer::World;

pub enum ConnectingUpdateResult {
Expand Down Expand Up @@ -110,7 +111,7 @@ fn draw_server_dialog(
// the same atlas the in-game text uses.
core.sync_game_dynamic_atlas(game, &mut gfx.renderer, false);

let mut elements = Vec::new();
let mut elements = vec![MenuElement::BlurBackground];
let text_events = core.input.drain_text_events();
// The connecting screen runs no client ticks, so the dialog's own
// timers fall back to wall time.
Expand All @@ -128,9 +129,9 @@ fn draw_server_dialog(
);

let cursor = core.input.cursor_pos();
if let Err(e) =
gfx.renderer
.render_menu(&gfx.window, panorama.scroll(), 2.0, elements, cursor, None)
if let Err(e) = gfx
.renderer
.render_menu(&gfx.window, panorama.scroll(), elements, cursor, None)
{
tracing::error!("Render error: {e}");
}
Expand Down
11 changes: 11 additions & 0 deletions pomme-client/src/app/phases/in_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,8 @@ pub(crate) fn build_server_screens(
if scroll != 0.0 && !modal_open {
dialog.handle_scroll(scroll);
}
// Vanilla's `DialogScreen` keeps `Screen`'s blurred background.
elements.push(MenuElement::BlurBackground);
let action = dialog.build(
elements,
sw,
Expand Down Expand Up @@ -2255,6 +2257,8 @@ pub fn update_game(
core.audio.set_subtitles_enabled(core.menu.show_subtitles);

gfx.renderer.set_vsync(core.menu.vsync);
gfx.renderer
.set_menu_blur_radius(core.menu.menu_background_blurriness);
game.chat.set_options(core.menu.chat_options);

// Vanilla pauseIfInactive: losing OS focus for more than half a second
Expand Down Expand Up @@ -3213,6 +3217,9 @@ pub fn update_game(
} else if game.paused && !matches!(game.pause_screen, PauseScreen::Hidden) && !dialog_open {
let cursor = core.input.cursor_pos();
let clicked = core.input.left_just_pressed();
// Vanilla `PauseScreen.extractBackground`: blurred while the menu
// shows; F3+Esc's hidden pause draws nothing.
elements.push(MenuElement::BlurBackground);
pause_action = pause::build_pause_menu(
&mut elements,
sw,
Expand Down Expand Up @@ -3740,6 +3747,8 @@ pub fn update_game(

// F1 hides the closed-chat overlay; an open chat is a screen and renders
// regardless (vanilla Hud.extractChat vs ChatScreen).
// TODO: the closed chat (and titles) build after screens, so they draw
// sharp over the menu blur; vanilla's HUD extracts them before the screen.
if !game.hide_gui || game.chat.is_focused() {
let command_tree = game.command_tree.clone();
// Vanilla `ChatScreen.mouseClicked` offers the click to the chat's own
Expand Down Expand Up @@ -4270,6 +4279,8 @@ pub fn update_game(
core.apply_cursor_grab(&gfx.window, Some(game));
}
PauseAction::Options => {
// TODO: back from these options, the pause menu ignores Escape and
// clicks (tests/ingame/ui/menu_blur.toml stops before it).
core.menu.open_options(&core.input.key_bindings);
game.options_from_game = true;
core.apply_cursor_grab(&gfx.window, Some(game));
Expand Down
3 changes: 2 additions & 1 deletion pomme-client/src/app/phases/in_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ pub fn update_menu(
if let Err(e) = gfx.renderer.render_menu(
&gfx.window,
panorama.scroll(),
result.blur,
result.elements,
core.input.cursor_pos(),
core.menu.skin_preview(),
Expand All @@ -145,6 +144,8 @@ pub fn update_menu(
core.sync_display_mode(&gfx.window);

gfx.renderer.set_vsync(core.menu.vsync);
gfx.renderer
.set_menu_blur_radius(core.menu.menu_background_blurriness);

if core.menu.rescan_packs {
core.menu.rescan_packs = false;
Expand Down
8 changes: 4 additions & 4 deletions pomme-client/src/app/phases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub fn draw_status(
let cy = sh / 2.0;

let cursor = core.input.cursor_pos();
let mut elements = Vec::new();
let mut elements = vec![MenuElement::BlurBackground];

elements.push(MenuElement::Text {
x: cx,
Expand Down Expand Up @@ -217,9 +217,9 @@ pub fn draw_status(

core.input.clear_just_pressed_actions();

if let Err(e) =
gfx.renderer
.render_menu(&gfx.window, panorama.scroll(), 2.0, elements, cursor, None)
if let Err(e) = gfx
.renderer
.render_menu(&gfx.window, panorama.scroll(), elements, cursor, None)
{
tracing::error!("Render error: {e}");
}
Expand Down
3 changes: 3 additions & 0 deletions pomme-client/src/harness/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ fn set_options(core: &mut AppCore, options: &protocol::OptionSet) -> Result<Valu
core.menu
.set_main_hand_right(hand == protocol::Hand::Right, &core.input.key_bindings);
}
if let Some(radius) = options.menu_background_blur {
core.menu.set_menu_background_blurriness(radius);
}
core.menu.save_options(&core.input.key_bindings);
Ok(Value::Null)
}
Expand Down
2 changes: 2 additions & 0 deletions pomme-client/src/harness/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ pub struct Click {
#[serde(deny_unknown_fields)]
pub struct OptionSet {
pub main_hand: Option<Hand>,
/// Menu Background Blur, 0 (off) to 10.
pub menu_background_blur: Option<u8>,
}

#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
Expand Down
3 changes: 2 additions & 1 deletion pomme-client/src/harness/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,8 @@ mod tests {
assert_eq!(
steps[19],
Step::Run(Command::Option(OptionSet {
main_hand: Some(Hand::Left)
main_hand: Some(Hand::Left),
menu_background_blur: None,
}))
);
assert_eq!(
Expand Down
Loading
Loading