Skip to content

Fixed VGACanvas #1504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions source/Cosmos.System2/Graphics/VGACanvas.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;
using Cosmos.HAL;
Expand All @@ -16,6 +16,7 @@ public class VGACanvas : Canvas
/// Private boolean whether VGA graphics mode is enabled or not
/// </summary>
bool _Enabled;
private Mode _Mode;

/// <summary>
/// The HAL VGA driver
Expand Down Expand Up @@ -55,7 +56,14 @@ public VGACanvas() : base()
/// <summary>
/// Gets or sets the VGA graphics mode
/// </summary>
public override Mode Mode { get; set; }
public override Mode Mode
{
get => _Mode; set
{
_VGADriver.SetGraphicsMode(ModeToScreenSize(_Mode), (VGADriver.ColorDepth)(int)_Mode.ColorDepth);
_Mode = value;
}
}

/// <summary>
/// Clears the screen of all pixels
Expand Down Expand Up @@ -83,6 +91,7 @@ public override void Disable()
{
if (Enabled)
{
VGAScreen.SetTextMode(TextSize.Size80x25);
Enabled = false;
}
}
Expand Down