|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2022 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // NEWS のフレームバッファ(予定地)
9: //
10:
11: #include "newsfb.h"
12:
13: // コンストラクタ
14: NewsfbDevice::NewsfbDevice()
15: : inherited(OBJ_NEWSFB)
16: {
17: console.Init(80, 32, TextScreen::Console);
18:
19: monitor.func = ToMonitorCallback(&NewsfbDevice::MonitorUpdate);
20: monitor.SetSize(console.GetCol(), console.GetRow());
21: monitor.Regist(ID_MONITOR_ROMCONS);
22: }
23:
24: // デストラクタ
25: NewsfbDevice::~NewsfbDevice()
26: {
27: }
28:
29: void
30: NewsfbDevice::ResetHard(bool poweron)
31: {
32: console.Clear();
33: }
34:
35: void
36: NewsfbDevice::Putc(int ch)
37: {
38: if (ch == '\t') {
39: // タブはここでスペースに展開
40: int x = console.GetX();
41: int next = roundup(x, 8);
42: for (; x < next; x++) {
43: console.Putc(' ');
44: }
45: return;
46: }
47: console.Putc(ch);
48: }
49:
50: void
51: NewsfbDevice::MonitorUpdate(Monitor *, TextScreen& screen)
52: {
53: int row = console.GetRow();
54: int col = console.GetCol();
55: const auto& src = console.GetBuf();
56:
57: int s = 0;
58: for (int y = 0; y < row; y++) {
59: for (int x = 0; x < col; x++) {
60: screen.Putc(x, y, src[s++]);
61: }
62: }
63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.