I forgot to source control for a sec
This commit is contained in:
parent
305d7920c6
commit
e816fb2cc3
|
@ -12,6 +12,8 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using Cosmos.System.Graphics;
|
||||
using System.Drawing;
|
||||
using System.Reflection.Metadata;
|
||||
using Cosmos.Debug.Kernel;
|
||||
|
||||
namespace DremDOS.Core.Terminal
|
||||
{
|
||||
|
@ -68,8 +70,12 @@ namespace DremDOS.Core.Terminal
|
|||
AppendText("" + c);
|
||||
}
|
||||
}
|
||||
public void ClearBuffer() { InitializeBuffer(); LinkedVGATerminal.CanBackspace = false; }
|
||||
public void BufferBackspace() {
|
||||
public void ClearBuffer() {
|
||||
kernel.mDebugger.Send("Clearing buffer");
|
||||
InitializeBuffer();
|
||||
LinkedVGATerminal.CanBackspace = false;
|
||||
}
|
||||
public void BufferBackspace() {
|
||||
if (CommandBufferCurrentLocation != 0) {
|
||||
CommandBuffer[CommandBufferCurrentLocation - 1] = '\0';
|
||||
CommandBufferCurrentLocation--;
|
||||
|
@ -96,7 +102,7 @@ namespace DremDOS.Core.Terminal
|
|||
}
|
||||
//LinkedVGATerminal.AppendText("You entered: " + temp + "\n");
|
||||
RunCommand(temp);
|
||||
|
||||
|
||||
ClearBuffer();
|
||||
}
|
||||
|
||||
|
@ -115,6 +121,7 @@ namespace DremDOS.Core.Terminal
|
|||
{
|
||||
if (ConsoleMode)
|
||||
{
|
||||
// TODO: Implement color for single console mode
|
||||
Console.Write(Text);
|
||||
}
|
||||
else
|
||||
|
@ -261,8 +268,8 @@ namespace DremDOS.Core.Terminal
|
|||
public void RunCommand(string cmd)
|
||||
{
|
||||
string[] arguments = GetArguments(cmd);
|
||||
//RunCommand(arguments);
|
||||
Command();
|
||||
RunCommand(arguments);
|
||||
//Command();
|
||||
//Console.Beep(1000, 1000);
|
||||
}
|
||||
|
||||
|
@ -270,7 +277,6 @@ namespace DremDOS.Core.Terminal
|
|||
{
|
||||
if (arguments[0] == "command")
|
||||
{
|
||||
//Console.Beep(1500, 1000);
|
||||
Command();
|
||||
}
|
||||
else if (arguments[0] == "checktime")
|
||||
|
@ -287,13 +293,7 @@ namespace DremDOS.Core.Terminal
|
|||
}
|
||||
else if (arguments[0] == "clear")
|
||||
{
|
||||
if(ConsoleMode)
|
||||
{
|
||||
Console.Clear();
|
||||
} else
|
||||
{
|
||||
//LinkedVGATerminal.Clear(); Implement later
|
||||
}
|
||||
ClearConsole();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -302,13 +302,31 @@ namespace DremDOS.Core.Terminal
|
|||
|
||||
if (ShowOutput)
|
||||
{
|
||||
AppendText("\n" + CurrentDirectory + " >");
|
||||
kernel.mDebugger.Send("Display directory");
|
||||
AppendText("\n" + CurrentDirectory + " > ");
|
||||
}
|
||||
|
||||
ClearBuffer();
|
||||
}
|
||||
|
||||
private void ClearConsole()
|
||||
{
|
||||
kernel.mDebugger.Send("Command: clear");
|
||||
if (ConsoleMode)
|
||||
{
|
||||
kernel.mDebugger.Send("Console mode clear");
|
||||
Console.Clear();
|
||||
} else
|
||||
{
|
||||
// TODO: Implement VGATerminal.Clear
|
||||
//LinkedVGATerminal.Clear();
|
||||
}
|
||||
kernel.mDebugger.Send("Console cleared");
|
||||
return;
|
||||
}
|
||||
|
||||
private void Command() {
|
||||
kernel.mDebugger.Send("Command: command");
|
||||
if (ShowOutput)
|
||||
{
|
||||
AppendText(@" _..._" + '\n', "Blue"); // Blue
|
||||
|
@ -322,6 +340,7 @@ namespace DremDOS.Core.Terminal
|
|||
AppendText(@"`::::::::.'" + '\n', "DarkMagenta"); // Dark Magenta
|
||||
AppendText(@" `':::''" + '\n', "Magenta"); // Magenta
|
||||
AppendText(kernel._OS_NAME + " " + kernel._OS_VERSION_FULL + "\n");
|
||||
Console.Beep(1000, 250);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ namespace DremDOS.Core.Terminal
|
|||
if (CanBackspace)
|
||||
{
|
||||
if (CursorX == 0 && CursorY != 0) { LastLine(); return; } else { if (CursorX != 0) SetCursorPosition(CursorX - 1, CursorY); }
|
||||
TextBuffer[CursorY][CursorX] = '\0';
|
||||
TextBuffer[CursorY][CursorX] = ' ';
|
||||
canvas.DrawFilledRectangle(BackgroundColor, new Sys.Graphics.Point(PositionX + (CursorX * 8), PositionY + (CursorY * 16)), 8, 16);
|
||||
UpdateCharacter(CursorX, CursorY);
|
||||
WriteCursor();
|
||||
|
@ -230,6 +230,7 @@ namespace DremDOS.Core.Terminal
|
|||
{
|
||||
for(int i = 0; i < TextHeight-1; i++) { TextBuffer[i] = TextBuffer[i + 1]; }
|
||||
TextBuffer[TextHeight-1] = new char[TextWidth];
|
||||
for (int i = 0; i < TextWidth; i++) { TextBuffer[TextHeight - 1][i] = ' '; }
|
||||
|
||||
for (int i = 0; i < TextHeight - 1; i++) { ColorBuffer[i] = ColorBuffer[i + 1]; }
|
||||
ColorBuffer[TextHeight - 1] = new Pen[TextWidth];
|
||||
|
|
|
@ -91,14 +91,23 @@ namespace DremDOS.Core.Graphics
|
|||
new Color [43] { Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue, Color.Blue },
|
||||
};
|
||||
|
||||
|
||||
private static int New_RightOffset = 268;
|
||||
private static int Close_RightOffset = 205;
|
||||
private static int Left_RightOffset = 142;
|
||||
private static int Right_RightOffset = 102;
|
||||
private static int FontWidth = 6;
|
||||
public static void DrawBUI(Canvas canvas, Kernel kernel)
|
||||
{
|
||||
for (ushort x = 0; x < 43; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(NewButton[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - 268) + x), (ushort)(20 + y)));
|
||||
for (ushort x = 0; x < 43; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(CloseButton[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - 268) + x), (ushort)(20 + y)));
|
||||
for (ushort x = 0; x < 14; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(ArrowLeft[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - 268) + x), (ushort)(20 + y)));
|
||||
for (ushort x = 0; x < 43; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(NewButton[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - New_RightOffset) + x), (ushort)(20 + y)));
|
||||
for (ushort x = 0; x < 43; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(CloseButton[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - Close_RightOffset) + x), (ushort)(20 + y)));
|
||||
for (ushort x = 0; x < 14; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(ArrowLeft[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - Left_RightOffset) + x), (ushort)(20 + y)));
|
||||
//canvas.DrawACSIIString(new Pen(Color.Red), Kernel.CurrentConsole + " of " + Kernel.TotalConsoles, Kernel._SCREEN_WIDTH - 122, 20);
|
||||
canvas.DrawString(kernel.CurrentConsole + " of " + kernel.TotalConsoles, kernel.Font, new Pen(Color.Red), kernel._SCREEN_WIDTH - 122, 20);
|
||||
for (ushort x = 0; x < 14; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(ArrowRight[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - 268) + x), (ushort)(20 + y)));
|
||||
string consoleCountString = kernel.CurrentConsole + " of " + kernel.TotalConsoles;
|
||||
canvas.DrawString(consoleCountString, kernel.Font, new Pen(Color.Red), kernel._SCREEN_WIDTH - 122, 20);
|
||||
|
||||
Right_RightOffset = 102-( FontWidth * consoleCountString.Length);
|
||||
for (ushort x = 0; x < 14; x++) for (ushort y = 0; y < 14; y++) canvas.DrawPoint(new Pen(ArrowRight[y][x]), new Sys.Graphics.Point((ushort)((kernel._SCREEN_WIDTH - Right_RightOffset) + x), (ushort)(20 + y)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ using DremDOS.Core.Graphics;
|
|||
using DremDOS.Core.Drivers;
|
||||
using DremDOS.Core.Sound;
|
||||
using Cosmos.Debug.Kernel;
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
namespace DremDOS
|
||||
{
|
||||
|
@ -58,6 +59,7 @@ namespace DremDOS
|
|||
private bool BlackBoxHasBeenFixed;
|
||||
|
||||
private VGATerminal SelectedConsole;
|
||||
|
||||
protected override void BeforeRun()
|
||||
{
|
||||
// Temporary stuff to get this thing to BEHAVE
|
||||
|
@ -156,7 +158,7 @@ namespace DremDOS
|
|||
{
|
||||
try
|
||||
{
|
||||
Terminal MainTerminal = new Terminal(ConsoleMode, this);
|
||||
MainTerminal = new Terminal(ConsoleMode, this);
|
||||
if (!ConsoleMode)
|
||||
{
|
||||
canvas.Clear(BorderColor);
|
||||
|
@ -164,6 +166,7 @@ namespace DremDOS
|
|||
|
||||
mouseDriver = new MouseDriver(checked((uint)_SCREEN_WIDTH), checked((uint)_SCREEN_HEIGHT));
|
||||
|
||||
// TODO: Burn these magic numbers
|
||||
ConsoleA = new VGATerminal(MainTerminal, (_SCREEN_WIDTH / 8) - 12, (_SCREEN_HEIGHT / 16) - 6, 50, 50, this);
|
||||
ConsoleA.ShowCursor = true;
|
||||
ConsoleA.EnableWrite = true;
|
||||
|
@ -173,27 +176,29 @@ namespace DremDOS
|
|||
canvas.Clear(BorderColor);
|
||||
canvas.Display();
|
||||
|
||||
// TODO: Burn these magic numbers
|
||||
canvas.DrawString(_OS_NAME + " " + _OS_VERSION_FULL, Font, WhitePen, 50, 5);
|
||||
canvas.DrawString(ConsoleA.VGATerminalName, Font, WhitePen, 50, 20);
|
||||
|
||||
ConsoleA.UpdateEntireScreen(true);
|
||||
int TempX;
|
||||
int TempY;
|
||||
|
||||
BUI.DrawBUI(canvas, this);
|
||||
canvas.Display();
|
||||
BlackBoxHasBeenFixed = false;
|
||||
|
||||
MainTerminal.ShowOutput = true;
|
||||
ConsoleA.RunTerminalCommand("command");
|
||||
|
||||
SelectedConsole = ConsoleA;
|
||||
} else
|
||||
{
|
||||
// Yay sketti code cause past me wrote code like a mongol
|
||||
mDebugger.Send("Setting up single console mode");
|
||||
MainTerminal.ShowOutput = true;
|
||||
MainTerminal.RunCommand("clear");
|
||||
MainTerminal.RunCommand("command");
|
||||
}
|
||||
|
||||
SelectedConsole = ConsoleA;
|
||||
|
||||
mDebugger.Send("Entering main OS loop.");
|
||||
while (true)
|
||||
{
|
||||
|
@ -206,8 +211,6 @@ namespace DremDOS
|
|||
{
|
||||
if (!ConsoleMode)
|
||||
{
|
||||
|
||||
|
||||
SelectedConsole.InterpretKeyInput(new ConsoleKeyInfo('\b', ConsoleKey.Backspace, false, false, false));
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue