Added converting ANSI to a binary format, and custom font rendering

This commit is contained in:
Deon George
2021-09-26 20:42:21 +10:00
parent 82e3283d6d
commit eda0926758
7 changed files with 1059 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Classes\ANSI;
class ANSIDecode extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ansi:decode'
.' {file : ANS file to decode}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Encode ANS file to custom binary';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo ANSI::ansi($this->argument('file'));
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Classes\ANSI;
class ANSIEncode extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ansi:encode'
.' {file : ANS file to encode}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Encode ANS file to custom binary';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
foreach (ANSI::binary($this->argument('file')) as $line) {
foreach (str_split(bin2hex($line),2) as $y)
echo hex2bin($y);
echo "\r";
}
}
}