public static function draw($roll, $pitch, $time, $speed, $altitude, $throttle) { $altitude = floor($altitude); $time = round($time, 5); $header_left = "Altitude: {$altitude}m "; $header_right = " Power: {$throttle}w"; $footer = "Flight time: {$time}s "; $footer_right = " Speed: " . floor($speed) . "m/s"; self::$roll = $roll; self::$pitch = $pitch; self::setElevation(); $screen = ''; for ($i = 0; $i < 10; $i++) { $screen .= "\n"; } for ($y = 0; $y <= self::$height + 1; $y++) { for ($x = 0; $x <= self::$width + 1; $x++) { if ($x == ceil(self::$width / 2) && $y == ceil(self::$height / 2)) { $screen .= '+'; } elseif ($x == 0 && $y == 0 || $x == self::$width + 1 && $y == self::$height + 1) { $screen .= '\\'; } elseif ($x == 0 && $y == self::$height + 1 || $x == self::$width + 1 && $y == 0) { $screen .= '/'; } elseif ($x == 0 || $x == self::$width + 1) { $screen .= '-'; } elseif ($y == 0 || $y == self::$height + 1) { $screen .= '|'; } elseif ($y == self::$height && $x <= strlen($footer)) { if ($x == 1) { $screen .= $footer; } } elseif ($y == self::$height && $x > self::$width - strlen($footer_right)) { if ($x == self::$width - strlen($footer_right) + 1) { $screen .= $footer_right; } } elseif ($y == 1 && $x <= strlen($header_left)) { if ($x == 1) { $screen .= $header_left; } } elseif ($y == 1 && $x > self::$width - strlen($header_right)) { if ($x == self::$width - strlen($header_right) + 1) { $screen .= $header_right; } } else { $screen .= self::horizon($x, $y); } } $screen .= "\n"; } return "{$screen} Roll: {$roll}\nPitch: {$pitch}\n"; }