allow enabling/disabling biome names on map

This commit is contained in:
floppy 2022-01-17 23:45:51 +01:00
parent 0c97a6e91a
commit a836b61190
6 changed files with 53 additions and 2 deletions

BIN
assets/voxygen/element/ui/map/buttons/biome.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -14,6 +14,7 @@
"hud.map.caves": "Caves",
"hud.map.cave": "Cave",
"hud.map.peaks": "Mountains",
"hud.map.biomes": "Biomes",
"hud.map.voxel_map": "Voxel map",
"hud.map.trees": "Giant Trees",
"hud.map.tree": "Giant Tree",

View File

@ -414,6 +414,7 @@ image_ids! {
mmap_site_tree: "voxygen.element.ui.map.buttons.tree",
mmap_site_tree_hover: "voxygen.element.ui.map.buttons.tree_hover",
mmap_poi_peak: "voxygen.element.ui.map.buttons.peak",
mmap_poi_biome: "voxygen.element.ui.map.buttons.biome",
mmap_poi_peak_hover: "voxygen.element.ui.map.buttons.peak_hover",
// Window Parts

View File

@ -42,6 +42,8 @@ widget_ids! {
mmap_poi_titles[],
peaks_txt,
peaks_txt_bg,
biomes_txt,
biomes_txt_bg,
site_difs[],
member_indicators[],
member_height_indicators[],
@ -65,6 +67,9 @@ widget_ids! {
show_peaks_img,
show_peaks_box,
show_peaks_text,
show_biomes_img,
show_biomes_box,
show_biomes_text,
show_voxel_map_img,
show_voxel_map_box,
show_voxel_map_text,
@ -209,6 +214,7 @@ impl<'a> Widget for Map<'a> {
let show_caves = self.global_state.settings.interface.map_show_caves;
let show_trees = self.global_state.settings.interface.map_show_trees;
let show_peaks = self.global_state.settings.interface.map_show_peaks;
let show_biomes = self.global_state.settings.interface.map_show_biomes;
let show_voxel_map = self.global_state.settings.interface.map_show_voxel_map;
let show_topo_map = self.global_state.settings.interface.map_show_topo_map;
let mut events = Vec::new();
@ -641,9 +647,43 @@ impl<'a> Widget for Map<'a> {
.graphics_for(state.ids.show_trees_box)
.color(TEXT_COLOR)
.set(state.ids.show_trees_text, ui);
// Biomes
Image::new(self.imgs.mmap_poi_biome)
.down_from(state.ids.show_trees_img, 10.0)
.w_h(20.0, 20.0)
.set(state.ids.show_biomes_img, ui);
if Button::image(if show_biomes {
self.imgs.checkbox_checked
} else {
self.imgs.checkbox
})
.w_h(18.0, 18.0)
.hover_image(if show_biomes {
self.imgs.checkbox_checked_mo
} else {
self.imgs.checkbox_mo
})
.press_image(if show_biomes {
self.imgs.checkbox_checked
} else {
self.imgs.checkbox_press
})
.right_from(state.ids.show_biomes_img, 10.0)
.set(state.ids.show_biomes_box, ui)
.was_clicked()
{
events.push(Event::SettingsChange(MapShowBiomes(!show_biomes)));
}
Text::new(i18n.get("hud.map.biomes"))
.right_from(state.ids.show_biomes_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.graphics_for(state.ids.show_biomes_box)
.color(TEXT_COLOR)
.set(state.ids.show_biomes_text, ui);
// Peaks
Image::new(self.imgs.mmap_poi_peak)
.down_from(state.ids.show_trees_img, 10.0)
.down_from(state.ids.show_biomes_img, 10.0)
.w_h(20.0, 20.0)
.set(state.ids.show_peaks_img, ui);
if Button::image(if show_peaks {
@ -1023,7 +1063,7 @@ impl<'a> Widget for Map<'a> {
}
},
PoiKind::Lake(size) => {
if zoom.powi(2) * size as f64 > 30.0 {
if show_biomes && zoom > 2.0 && zoom.powi(2) * size as f64 > 30.0 {
let font_scale_factor = if size > 20 {
size as f64 / 25.0
} else if size > 10 {

View File

@ -129,6 +129,7 @@ pub enum Interface {
MapShowCaves(bool),
MapShowTrees(bool),
MapShowPeaks(bool),
MapShowBiomes(bool),
MapShowVoxelMap(bool),
ResetInterfaceSettings,
@ -535,6 +536,9 @@ impl SettingsChange {
Interface::MapShowPeaks(map_show_peaks) => {
settings.interface.map_show_peaks = map_show_peaks;
},
Interface::MapShowBiomes(map_show_biomes) => {
settings.interface.map_show_biomes = map_show_biomes;
},
Interface::MapShowVoxelMap(map_show_voxel_map) => {
settings.interface.map_show_voxel_map = map_show_voxel_map;
},

View File

@ -38,6 +38,7 @@ pub struct InterfaceSettings {
pub map_show_caves: bool,
pub map_show_trees: bool,
pub map_show_peaks: bool,
pub map_show_biomes: bool,
pub map_show_voxel_map: bool,
pub minimap_show: bool,
pub minimap_face_north: bool,
@ -77,6 +78,7 @@ impl Default for InterfaceSettings {
map_show_caves: true,
map_show_trees: false,
map_show_peaks: false,
map_show_biomes: false,
map_show_voxel_map: true,
minimap_show: true,
minimap_face_north: true,