--- nono/lib/textscreen.h 2026/04/29 17:04:28 1.1 +++ nono/lib/textscreen.h 2026/04/29 17:04:31 1.1.1.2 @@ -39,9 +39,15 @@ class TextScreen // 初期化 void Init(int col, int row); + // 折り返しモードかどうか + bool foldmode {}; + // クリア void Clear(); + // 現在位置を移動 + void Locate(int x, int y); + // 現在位置に1文字出力 (上位バイトは属性) void Putc(uint16 ch); @@ -51,6 +57,9 @@ class TextScreen // 現在位置に指定の属性で文字列を出力 void Puts(uint attr, const char *str); + // 現在位置に属性なしで書式付き文字列を出力 + void Print(const char *fmt, ...) __printflike(2, 3); + // 座標を指定して属性なしで書式付き文字列を出力 void Print(int x, int y, const char *fmt, ...) __printflike(4, 5); @@ -59,12 +68,17 @@ class TextScreen __printflike(5, 6); // バッファアドレスを取得。(描画デバイス向け) - const uint16 *GetBuf() const { return textbuf; } + const uint16 *GetBuf() const { return textbuf.get(); } // XXX 生バッファを取得 // バッファの内部構造を変えた場合はこれを呼んでる人については // 見直しをすること。そのうちなんとかするかも - uint16 *GetRawBuf() { return textbuf; } + uint16 *GetRawBuf() { return textbuf.get(); } + + // 現在の X 座標を取得 + int GetX() const { return X; } + // 現在の Y 座標を取得 + int GetY() const { return Y; } // 桁数を取得 int GetCol() const { return col; } @@ -73,9 +87,12 @@ class TextScreen int GetRow() const { return row; } private: + // 改行(次の行の左端に移動) + void CRLF(); + // バッファ (幅x高さちょうどの長さ、ゼロ終端文字列ではない) // 上位8ビットは属性、下位8ビットが文字コード。 - uint16 *textbuf = NULL; + std::unique_ptr textbuf {}; // 幅 int col = 0;