dolondro/

thegrid

该软件包最新版本(1.0.0)没有可用的许可证信息。

1.0.0 2016-02-20 18:29 UTC

This package is auto-updated.

Last update: 2024-09-16 02:53:06 UTC


README

终端窗口中创建内容网格的抽象类

你是否曾经想过在终端窗口中用PHP创建一个棋类游戏,但又觉得制作网格太麻烦?不是吗?我想也是。

如果你确实想这样做,这个项目可能会对你有所帮助。它使用所有各种盒字符Unicode内容来生成一个半合理的网格。

// Usage is something like this
$gridRenderer = \Dolondro\TheGrid\GridRenderer::create();
$gridRenderer->render([[
  "Cell1"
]]);

这里有一个半成品的例子,可以在examples/test.php中找到,如果你需要指导,这里有一个复制的注释,解释了单元格的格式应该是什么样的

// Create expects a multi-dimensional array. Each "cell" in the array should either be:
// 1. null    (will result in nothing being rendered)
// 2. a value (like the number 5 or what have you)
// 3. an array like so: [$value, $colour]. Colour should be in ansi style format (like "\033[31m").
//    a comprehensive list of them can be accessed directly from Color::COLOR_BLAH

祝你好运,玩得开心!