Skip to content

Commit

Permalink
Fix formatting and colour rendering not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathmagician8191 committed Sep 13, 2024
1 parent c520f39 commit e41d798
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions enterprise/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ fn handle_midway_connection(stream: TcpStream, tx: &Sender<MidwayMessage>) -> Op

fn main() {
let viewport = ViewportBuilder::default()
.with_min_inner_size(vec2(480.0, 360.0))
.with_inner_size(vec2(1280.0, 800.0))
.with_resizable(true);
let options = NativeOptions {
Expand Down
9 changes: 5 additions & 4 deletions midway/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const PORT: u16 = 25565;
const TIME_ACCELERATION_FACTOR: f32 = 5.0;
const TPS: u32 = 60;

const COLOUR: &str = "f00";
const COLOUR: &str = "#999";

const MAP_RADIUS: Option<f32> = Some(5000.0);
const KRAKEN_NAME: &str = "Kraken";
Expand Down Expand Up @@ -90,13 +90,13 @@ impl Ship {
}

fn distance_from_origin(&self) -> f32 {
(self.coords.0.powi(2) + self.coords.1.powi(2)).sqrt()
self.coords.0.hypot(self.coords.1)
}

fn distance(&self, other: &Self) -> f32 {
let x_distance = self.coords.0 - other.coords.0;
let y_distance = self.coords.1 - other.coords.1;
(x_distance.powi(2) + y_distance.powi(2)).sqrt()
x_distance.hypot(y_distance)
}

fn damage(&mut self, amount: f32) {
Expand Down Expand Up @@ -339,7 +339,8 @@ fn main() {
let texture = ship.stats.texture;
let size = ship.stats.length;
let health = ship.stats.health / ship.stats.mass;
let message = format!("ship {name} {x} {y} {angle} {velocity} {size} {texture} {COLOUR} {health}\n");
let message =
format!("ship {name} {x} {y} {angle} {velocity} {size} {texture} {COLOUR} {health}\n");
for connection2 in connections.values_mut() {
connection2.stream.write_all(message.as_bytes()).ok();
}
Expand Down

0 comments on commit e41d798

Please sign in to comment.