mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
Fixed VGACanvas
Mode Property supports changing mode while being active Disable Method actually reverts to text mode
This commit is contained in:
parent
50d400065a
commit
838b2866be
1 changed files with 13 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Cosmos.HAL;
|
||||
|
|
@ -16,6 +16,7 @@ namespace Cosmos.System.Graphics
|
|||
/// Private boolean whether VGA graphics mode is enabled or not
|
||||
/// </summary>
|
||||
bool _Enabled;
|
||||
private Mode _Mode;
|
||||
|
||||
/// <summary>
|
||||
/// The HAL VGA driver
|
||||
|
|
@ -50,7 +51,14 @@ namespace Cosmos.System.Graphics
|
|||
/// <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
|
||||
|
|
@ -59,7 +67,7 @@ namespace Cosmos.System.Graphics
|
|||
public override void Clear(Color aColor)
|
||||
{
|
||||
var paletteIndex = _VGADriver.GetClosestColorInPalette(aColor);
|
||||
_VGADriver.DrawFilledRectangle(0,0, _VGADriver.PixelWidth, _VGADriver.PixelHeight, paletteIndex);
|
||||
_VGADriver.DrawFilledRectangle(0, 0, _VGADriver.PixelWidth, _VGADriver.PixelHeight, paletteIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,6 +77,7 @@ namespace Cosmos.System.Graphics
|
|||
{
|
||||
if (Enabled)
|
||||
{
|
||||
VGAScreen.SetTextMode(TextSize.Size80x25);
|
||||
Enabled = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -411,7 +420,7 @@ namespace Cosmos.System.Graphics
|
|||
|
||||
public override void Display()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue