Commit 3f8d66e2 authored by Simon Goller's avatar Simon Goller
Browse files

Merge request fixes

parent 6d6ea756
......@@ -28,7 +28,7 @@ pub fn draw_edges(
rendering.begin_path();
rendering.set_line_width(7.0);
rendering.set_stroke_style(&resources::Color::new_rgb(0.164, 0.0, 0.367));
rendering.set_stroke_style(&resources::Color::with_rgb(0.164, 0.0, 0.367));
rendering.move_to(pos1.0.x as f64, pos1.0.y as f64);
rendering.line_to(pos2.0.x as f64, pos2.0.y as f64);
rendering.stroke();
......
......@@ -54,7 +54,7 @@ pub fn draw_nodes(
) {
// TODO: Replace by proper API
rendering.begin_path();
rendering.set_fill_style(&resources::Color::new_rgb(0.63, 0.54, 0.137));
rendering.set_fill_style(&resources::Color::with_rgb(0.63, 0.54, 0.137));
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
......@@ -66,7 +66,7 @@ pub fn draw_nodes(
rendering.begin_path();
rendering.set_line_width(5.0);
rendering.set_stroke_style(&resources::Color::new_rgb(0.254, 0.0, 0.543));
rendering.set_stroke_style(&resources::Color::with_rgb(0.254, 0.0, 0.543));
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
......@@ -79,7 +79,7 @@ pub fn draw_nodes(
let time = clock.wall_time();
if let Some(amount_completed) = node.amount_completed(time) {
rendering.begin_path();
rendering.set_stroke_style(&resources::Color::new_rgb(0.406, 0.0, 0.902));
rendering.set_stroke_style(&resources::Color::with_rgb(0.406, 0.0, 0.902));
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
......@@ -95,7 +95,7 @@ pub fn draw_nodes(
let alpha = (1.0 - (time - ping_time) * 2.0).max(0.0).powi(2);
rendering.begin_path();
rendering.set_stroke_style(&resources::Color::new_rgba(0.406, 0.0, 0.902, alpha));
rendering.set_stroke_style(&resources::Color::with_rgba(0.406, 0.0, 0.902, alpha));
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
......
......@@ -12,7 +12,7 @@ pub fn draw_thesun(
) {
// TODO: Replace by proper API
rendering.begin_path();
rendering.set_fill_style(&resources::Color::new_rgb(0.695, 0.223, 1.0));
rendering.set_fill_style(&resources::Color::with_rgb(0.695, 0.223, 1.0));
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
......@@ -26,7 +26,7 @@ pub fn draw_thesun(
rendering.set_line_width(10.0);
rendering.begin_path();
rendering.set_stroke_style(&resources::Color::new_rgb(0.402, 0.008, 0.621));
rendering.set_stroke_style(&resources::Color::with_rgb(0.402, 0.008, 0.621));
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
......@@ -37,7 +37,7 @@ pub fn draw_thesun(
rendering.stroke();
rendering.begin_path();
rendering.set_stroke_style(&resources::Color::new_rgb(0.266, 0.0, 0.410));
rendering.set_stroke_style(&resources::Color::with_rgb(0.266, 0.0, 0.410));
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
......
......@@ -12,7 +12,7 @@ pub struct Color {
}
impl Color {
pub fn new_rgba(red: f64, green: f64, blue: f64, alpha: f64) -> Self {
pub fn with_rgba(red: f64, green: f64, blue: f64, alpha: f64) -> Self {
Color {
red,
green,
......@@ -20,7 +20,7 @@ impl Color {
alpha,
}
}
pub fn new_rgb(red: f64, green: f64, blue: f64) -> Self {
pub fn with_rgb(red: f64, green: f64, blue: f64) -> Self {
Color {
red,
green,
......@@ -32,10 +32,10 @@ impl Color {
pub fn as_color_string(&self) -> String {
format!(
"#{:02X}{:02X}{:02X}{:02X}",
(self.red * 256.0) as u8,
(self.green * 256.0) as u8,
(self.blue * 256.0) as u8,
(self.alpha * 256.0) as u8,
(self.red * 255.0) as u8,
(self.green * 255.0) as u8,
(self.blue * 255.0) as u8,
(self.alpha * 255.0) as u8,
)
}
}
......
......@@ -97,7 +97,7 @@ impl state::State for HeavenState {
fn update(&mut self) -> state::Transition {
{
let rendering = self.resources.get_mut::<resources::Rendering>().unwrap();
rendering.set_fill_style(&resources::Color::new_rgb(0.0625, 0.06, 0.125));
rendering.set_fill_style(&resources::Color::with_rgb(0.0625, 0.06, 0.125));
rendering.fill_rect(0.0, 0.0, 1920.0, 1080.0);
}
......
......@@ -59,7 +59,7 @@ impl state::State for InGameState {
fn update(&mut self) -> state::Transition {
{
let rendering = self.resources.get::<resources::Rendering>().unwrap();
rendering.set_fill_style(&resources::Color::new_rgb(0.0625, 0.06, 0.125));
rendering.set_fill_style(&resources::Color::with_rgb(0.0625, 0.06, 0.125));
rendering.fill_rect(0.0, 0.0, 1920.0, 1080.0);
}
self.schedule.execute(&mut self.world, &mut self.resources);
......
......@@ -57,7 +57,7 @@ impl state::State for LevelLoadingState {
fn update(&mut self) -> state::Transition {
{
let rendering = self.resources.get_mut::<resources::Rendering>().unwrap();
rendering.set_fill_style(&resources::Color::new_rgb(0.0625, 0.06, 0.125));
rendering.set_fill_style(&resources::Color::with_rgb(0.0625, 0.06, 0.125));
rendering.fill_rect(0.0, 0.0, 1920.0, 1080.0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment