Skip to content

Commit

Permalink
Remove SetFullscreenBuffering; always use buffering in fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
electroly committed Jul 6, 2024
1 parent f1933ec commit c7d0382
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 33 deletions.
1 change: 0 additions & 1 deletion src/compiler/BuiltInProcedureList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ BuiltInProcedureList::BuiltInProcedureList() {
addSub("SetForeColor", { "color" }, { color }, SystemCall::kSetForeColor);
addSub("SetForeColor", { "red", "green", "blue" }, { number, number, number }, SystemCall::kSetForeColorComponents);
addSub("SetFormTitle", { "form", "title" }, { form, string }, SystemCall::kSetFormTitle);
addSub("SetFullscreenBuffering", { "enable" }, { boolean }, SystemCall::kSetFullscreenBuffering);
addFunction("Sin", { "x" }, { number }, number, SystemCall::kSin);
addFunction("Skip", { "list", "count" }, { listOfAny, number }, listOfGeneric1, SystemCall::kListSkip);
addSub("Sleep", { "delay" }, { timeSpan }, SystemCall::kSleep);
Expand Down
1 change: 0 additions & 1 deletion src/shared/SystemCalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ enum class SystemCall {
kSetForeColor,
kSetForeColorComponents,
kSetFormTitle,
kSetFullscreenBuffering,
kSetLen,
kSetValues,
kSin,
Expand Down
1 change: 0 additions & 1 deletion src/vm/BasicConsoleView.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class BasicConsoleView : public TView {
std::vector<std::vector<TScreenCell>> cells{};
int16_t currentX{ 0 }, currentY{ 0 };
TColorAttr currentColorAttr{ TColorRGB{ 255, 255, 255 }, TColorRGB{ 0, 0, 0 } };
bool isBuffered{ false };
TColorRGB fillColor{ 0, 0, 0 };

explicit BasicConsoleView(const TRect& bounds);
Expand Down
2 changes: 0 additions & 2 deletions src/vm/initSystemCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ void systemCallSetControlText(const SystemCallInput&, SystemCallResult*);
void systemCallSetForeColor(const SystemCallInput&, SystemCallResult*);
void systemCallSetForeColorComponents(const SystemCallInput&, SystemCallResult*);
void systemCallSetFormTitle(const SystemCallInput&, SystemCallResult*);
void systemCallSetFullscreenBuffering(const SystemCallInput&, SystemCallResult*);
void systemCallSetLen(const SystemCallInput&, SystemCallResult*);
void systemCallSetValues(const SystemCallInput&, SystemCallResult*);
void systemCallSin(const SystemCallInput&, SystemCallResult*);
Expand Down Expand Up @@ -467,7 +466,6 @@ void initSystemCalls() {
initSystemCall(shared::SystemCall::kSetForeColor, systemCallSetForeColor);
initSystemCall(shared::SystemCall::kSetForeColorComponents, systemCallSetForeColorComponents);
initSystemCall(shared::SystemCall::kSetFormTitle, systemCallSetFormTitle);
initSystemCall(shared::SystemCall::kSetFullscreenBuffering, systemCallSetFullscreenBuffering);
initSystemCall(shared::SystemCall::kSetLen, systemCallSetLen);
initSystemCall(shared::SystemCall::kSetValues, systemCallSetValues);
initSystemCall(shared::SystemCall::kSin, systemCallSin);
Expand Down
29 changes: 1 addition & 28 deletions src/vm/systemCalls.console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,45 +69,21 @@ void systemCallEnterFullscreen(const SystemCallInput& /*input*/, SystemCallResul
BasicApp::createInstance();
}

// (enable as Boolean)
void systemCallSetFullscreenBuffering(const SystemCallInput& input, SystemCallResult* /*result*/) {
auto enable = input.getValue(-1).getBoolean();

auto* app = BasicApp::instance.get();
if (app == nullptr) {
throw Error(ErrorCode::kWrongScreenMode, "Must be in fullscreen mode.");
}

app->console->isBuffered = enable;

// If we just disabled buffering, then redraw the screen right now.
if (!enable) {
app->forceScreenUpdate();
}
}

// ()
void systemCallUpdateScreen(const SystemCallInput& /*input*/, SystemCallResult* /*result*/) {
auto* app = BasicApp::instance.get();
if (app == nullptr) {
throw Error(ErrorCode::kWrongScreenMode, "Must be in fullscreen mode.");
}

if (!app->console->isBuffered) {
throw Error(ErrorCode::kInvalidOperation, "Screen buffering is not enabled.");
}

app->forceScreenUpdate();
}

// ()
void systemCallFlushConsoleOutput(const SystemCallInput& input, SystemCallResult* /*result*/) {
auto* app = BasicApp::instance.get();
if (app != nullptr) {
// Full-screen mode. In buffered mode, this is a noop.
if (!app->console->isBuffered) {
app->forceScreenUpdate();
}
// Full-screen mode. This is a noop.
} else {
// Command line mode
input.consoleOutputStream->flush();
Expand Down Expand Up @@ -262,9 +238,6 @@ void systemCallCls(const SystemCallInput& /*input*/, SystemCallResult* /*result*

app->console->cells.clear();
app->console->fillColor = getBack(app->console->currentColorAttr).asRGB();
if (!app->console->isBuffered) {
app->forceScreenUpdate();
}
}

} // namespace vm

0 comments on commit c7d0382

Please sign in to comment.