|
|
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"
1.1.1.2 root 12: #include "monitor.h"
1.1 root 13:
14: // コンストラクタ
15: NewsfbDevice::NewsfbDevice()
16: : inherited(OBJ_NEWSFB)
17: {
18: console.Init(80, 32, TextScreen::Console);
19:
1.1.1.2 root 20: monitor = gMonitorManager->Regist(ID_MONITOR_ROMCONS, this);
1.1.1.3 ! root 21: monitor->SetCallback(&NewsfbDevice::MonitorScreen);
1.1.1.2 root 22: monitor->SetSize(console.GetCol(), console.GetRow());
1.1 root 23: }
24:
25: // デストラクタ
26: NewsfbDevice::~NewsfbDevice()
27: {
28: }
29:
30: void
31: NewsfbDevice::ResetHard(bool poweron)
32: {
33: console.Clear();
34: }
35:
36: void
37: NewsfbDevice::Putc(int ch)
38: {
39: if (ch == '\t') {
40: // タブはここでスペースに展開
41: int x = console.GetX();
42: int next = roundup(x, 8);
43: for (; x < next; x++) {
44: console.Putc(' ');
45: }
46: return;
47: }
48: console.Putc(ch);
49: }
50:
51: void
1.1.1.3 ! root 52: NewsfbDevice::MonitorScreen(Monitor *, TextScreen& screen)
1.1 root 53: {
54: int row = console.GetRow();
55: int col = console.GetCol();
56: const auto& src = console.GetBuf();
57:
58: int s = 0;
59: for (int y = 0; y < row; y++) {
60: for (int x = 0; x < col; x++) {
61: screen.Putc(x, y, src[s++]);
62: }
63: }
64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.