mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
restore lost changes
Former-commit-id: a94c52677287131e02c88748694dfbcaf90b531a
This commit is contained in:
parent
3ad8f49f7f
commit
4a8e85ef64
@ -348,7 +348,7 @@ impl Hud {
|
||||
&mut self.ids.health_bars,
|
||||
&mut ui_widgets.widget_id_generator(),
|
||||
);
|
||||
// Healh Bar
|
||||
// Health Bar
|
||||
Rectangle::fill_with([120.0, 8.0], Color::Rgba(0.3, 0.3, 0.3, 0.5))
|
||||
.x_y(0.0, -25.0)
|
||||
.position_ingame(pos.0 + Vec3::new(0.0, 0.0, 3.0))
|
||||
|
@ -46,7 +46,7 @@ impl Pipeline for UiPipeline {
|
||||
impl From<Vec3<f32>> for Locals {
|
||||
fn from(pos: Vec3<f32>) -> Self {
|
||||
Self {
|
||||
pos: [pos[0], pos[1], pos[2], 1.0],
|
||||
pos: [pos.x, pos.y, pos.z, 1.0],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ impl Ui {
|
||||
|
||||
enum Placement {
|
||||
Interface,
|
||||
// Number and resolution
|
||||
// Number of primitives left to render ingame and relative scaling/resolution
|
||||
InWorld(usize, Option<f32>),
|
||||
};
|
||||
|
||||
@ -295,6 +295,7 @@ impl Ui {
|
||||
}
|
||||
|
||||
match placement {
|
||||
// No primitives left to place in the world at the current position, go back to drawing the interface
|
||||
Placement::InWorld(0, _) => {
|
||||
placement = Placement::Interface;
|
||||
p_scale_factor = self.scale.scale_factor_physical();
|
||||
@ -307,24 +308,22 @@ impl Ui {
|
||||
// Push new position command
|
||||
self.draw_commands.push(DrawCommand::WorldPos(None));
|
||||
}
|
||||
Placement::InWorld(n, res) => match kind {
|
||||
// Other types don't need to be drawn in the game
|
||||
// Primitives still left to draw ingame
|
||||
Placement::InWorld(num_prims, res) => match kind {
|
||||
// Other types don't aren't drawn & shoudn't decrement the number of primitives left to draw ingame
|
||||
PrimitiveKind::Other(_) => {}
|
||||
_ => {
|
||||
placement = Placement::InWorld(n - 1, res);
|
||||
if res.is_none() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Decrement the number of primitives left
|
||||
_ => placement = Placement::InWorld(num_prims - 1, res),
|
||||
},
|
||||
Placement::Interface => {}
|
||||
}
|
||||
|
||||
// Functions for converting for conrod scalar coords to GL vertex coords (-1.0 to 1.0).
|
||||
let (ui_win_w, ui_win_h) = if let Placement::InWorld(_, Some(res)) = placement {
|
||||
(res as f64, res as f64)
|
||||
} else {
|
||||
(self.ui.win_w, self.ui.win_h)
|
||||
let (ui_win_w, ui_win_h) = match placement {
|
||||
Placement::InWorld(_, Some(res)) => (res as f64, res as f64),
|
||||
// Behind the camera or far away
|
||||
Placement::InWorld(_, None) => continue,
|
||||
Placement::Interface => (self.ui.win_w, self.ui.win_h),
|
||||
};
|
||||
let vx = |x: f64| (x / ui_win_w * 2.0) as f32;
|
||||
let vy = |y: f64| (y / ui_win_h * 2.0) as f32;
|
||||
|
Loading…
Reference in New Issue
Block a user