Skip to content

Commit

Permalink
Merge pull request #89 from Owen2k6/1.5
Browse files Browse the repository at this point in the history
PRing what we have so far to Latest. No release will be made at this time.
  • Loading branch information
Owen2k6 authored Nov 17, 2023
2 parents 5b755d6 + 2445288 commit b2c5999
Show file tree
Hide file tree
Showing 74 changed files with 3,017 additions and 977 deletions.
152 changes: 102 additions & 50 deletions GoOS/9xCode/Interpreter.cs

Large diffs are not rendered by default.

31 changes: 9 additions & 22 deletions GoOS/BetterConsole/BetterConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,14 @@
using Cosmos.System;
using GoOS.GUI;
using GoOS.Themes;
using IL2CPU.API.Attribs;
using PrismAPI.Graphics;
using PrismAPI.Graphics.Fonts;
using static GoOS.Resources;

/// <summary>
/// <see cref="BetterConsole"/> class
/// </summary>
public static class BetterConsole
{
/* The raw global font */
[ManifestResourceStream(ResourceName = "GoOS.Resources.Font_1x.btf")]
public static byte[] rawFont;

/* The credits easter egg */
[ManifestResourceStream(ResourceName = "GoOS.Resources.Credits05.bmp")]
private static byte[] easterEgg;

/* The global font */
public static Font font;

/* The canvas for the console */
public static Canvas Canvas;

Expand Down Expand Up @@ -94,7 +82,6 @@ public static class BetterConsole
/// <param name="videoHeight">The height of the canvas</param>
public static void Init(ushort width, ushort height)
{
font = new Font(rawFont, charHeight);
//Canvas = Display.GetDisplay(width, height);
Canvas = new Canvas(width, height);
WindowWidth = Convert.ToUInt16(width / charWidth);
Expand Down Expand Up @@ -165,7 +152,7 @@ public static ConsoleKeyInfo ReadKey(bool intercept = true)
{
if (CursorVisible)
{
Canvas.DrawString(CursorLeft * charWidth, CursorTop * charHeight, '_'.ToString(), font, ForegroundColor);
Canvas.DrawString(CursorLeft * charWidth, CursorTop * charHeight, '_'.ToString(), Font_1x, ForegroundColor);
}

var keyPressed = KeyBuffer.TryDequeue(out var key);
Expand All @@ -190,10 +177,10 @@ public static ConsoleKeyInfo ReadKey(bool intercept = true)
if (CursorVisible)
{
// Just to be safe
Canvas.DrawString((CursorLeft - 1) * charWidth, CursorTop * charHeight, '_'.ToString(), font, Color.Black);
Canvas.DrawString((CursorLeft + 1) * charWidth, CursorTop * charHeight, '_'.ToString(), font, Color.Black);
Canvas.DrawString(CursorLeft * charWidth, (CursorTop - 1) * charHeight, '_'.ToString(), font, Color.Black);
Canvas.DrawString(CursorLeft * charWidth, (CursorTop + 1) * charHeight, '_'.ToString(), font, Color.Black);
Canvas.DrawString((CursorLeft - 1) * charWidth, CursorTop * charHeight, '_'.ToString(), Font_1x, Color.Black);
Canvas.DrawString((CursorLeft + 1) * charWidth, CursorTop * charHeight, '_'.ToString(), Font_1x, Color.Black);
Canvas.DrawString(CursorLeft * charWidth, (CursorTop - 1) * charHeight, '_'.ToString(), Font_1x, Color.Black);
Canvas.DrawString(CursorLeft * charWidth, (CursorTop + 1) * charHeight, '_'.ToString(), Font_1x, Color.Black);
}
}
}
Expand Down Expand Up @@ -273,7 +260,7 @@ public static string ReadLine()
if (key.Key == ConsoleKeyEx.G)
{
string collected = Heap.Collect() + " items collected";
Canvas.DrawString(Canvas.Width - (collected.Length * 8) - 8, Canvas.Height - 32, collected, font, ThemeManager.WindowText);
Canvas.DrawString(Canvas.Width - (collected.Length * 8) - 8, Canvas.Height - 32, collected, Font_1x, ThemeManager.WindowText);
Write(returnValue);
}
else if (key.Key == ConsoleKeyEx.L)
Expand All @@ -289,7 +276,7 @@ public static string ReadLine()
if (input == "e015")
{
Clear();
Canvas.DrawImage(0, 0, Image.FromBitmap(easterEgg, false), false);
Canvas.DrawImage(0, 0, easterEgg, false);
ReadKey(true);
Clear();
}
Expand Down Expand Up @@ -436,7 +423,7 @@ public static void PutChar(char c, int CursorLeft, int y, bool quick = false)
Canvas.DrawFilledRectangle(CursorLeft * charWidth, y * charHeight,
Convert.ToUInt16(charWidth + (charWidth / 8)), charHeight, 0, BackgroundColor); //yes this is correct
if (c != ' ')
Canvas.DrawString(CursorLeft * charWidth, y * charHeight, c.ToString(), font, ForegroundColor);
Canvas.DrawString(CursorLeft * charWidth, y * charHeight, c.ToString(), Font_1x, ForegroundColor);
}

#endregion
Expand Down
69 changes: 46 additions & 23 deletions GoOS/Commands/GoCodeInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void Install(string file)
if (file.Contains("\\"))
{
//Console.WriteLine("3");

string whatToRemove = file.Substring(file.LastIndexOf("\\"));

string FullName = file.Replace(whatToRemove, "");
Expand All @@ -40,7 +40,7 @@ public static void Install(string file)
else
{
//Console.WriteLine("4");

string FullName = file;

string name = FullName.Replace(".gexe", "");
Expand Down Expand Up @@ -86,27 +86,50 @@ public static void CheckForInstalledPrograms()
{
try
{
var directory_list = Directory.GetFiles(@"0:\content\GCI\");
string[] firectories = File.ReadAllLines(@"0:\content\sys\path.ugms");

foreach (var file in directory_list)
foreach (var firectory in firectories)
{
if (file.EndsWith(".gexe"))
{
string name = file.Replace(".gexe", "");

string location = @"0:\content\GCI\" + file;

if (!Kernel.InstalledPrograms.ContainsKey(name))
Kernel.InstalledPrograms.Add(name, location);
}
else if (file.EndsWith(".goexe"))
if (!Kernel.pathPaths.Contains(firectory))
{
string name = file.Replace(".goexe", "");
Kernel.pathPaths.Append(firectory);

string location = @"0:\content\GCI\" + file;
}
}

foreach (var pathDir in Kernel.pathPaths)
{
var directory_list = Directory.GetFiles(pathDir);

if (!Kernel.InstalledPrograms.ContainsKey(name))
Kernel.InstalledPrograms.Add(name, location);
foreach (var file in directory_list)
{
if (file.EndsWith(".gexe"))
{
string name = file.Replace(".gexe", "");

string location = pathDir + @"\" + file;

if (!Kernel.InstalledPrograms.ContainsKey(name))
Kernel.InstalledPrograms.Add(name, location);
}
else if (file.EndsWith(".goexe"))
{
string name = file.Replace(".goexe", "");

string location = pathDir + @"\" + file;

if (!Kernel.InstalledPrograms.ContainsKey(name))
Kernel.InstalledPrograms.Add(name, location);
}
else if (file.EndsWith(".9xc"))
{
string name = file.Replace(".9xc", "");

string location = pathDir + @"\" + file;

if (!Kernel.InstalledPrograms.ContainsKey(name))
Kernel.InstalledPrograms.Add(name, location);
}
}
}
}
Expand All @@ -123,21 +146,21 @@ public static void Uninstall(string name)
string rootass = @"0:\";

string currentDIRRRRRR = Directory.GetCurrentDirectory();

Directory.SetCurrentDirectory(rootass);

Kernel.InstalledPrograms.TryGetValue(name, out string locat);

string TrueLocat = locat;

if (locat.Contains(@"0:\"))
{
TrueLocat = TrueLocat.Replace(@"0:\", "");
}

File.Delete(TrueLocat);
Kernel.InstalledPrograms.Remove(name);

Directory.SetCurrentDirectory(currentDIRRRRRR);
}
}
Expand Down
28 changes: 28 additions & 0 deletions GoOS/GUI/Apps/About.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IL2CPU.API.Attribs;
using PrismAPI.Graphics;
using PrismAPI.UI;

namespace GoOS.GUI.Apps
{
public class About : Window
{
public About()
{
// Create the window.
Contents = new Canvas(200, 180);
Title = "About this GoPC";
Visible = true;
Closable = true;
Sizable = false;
SetDock(WindowDock.Auto);
// Paint the window.
Contents.DrawImage(0, 0, Resources.abtbg, false);
Contents.DrawString(50, 150, "(Version " + Kernel.version + ")", Resources.Font_1x, Color.White);
}
}
}
67 changes: 24 additions & 43 deletions GoOS/GUI/Apps/AppManager.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
using System;
using IL2CPU.API.Attribs;
using PrismAPI.Graphics;
using static GoOS.Resources;

namespace GoOS.GUI.Apps
{
public class AppManager : Window
{
[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.gterm.bmp")] private static byte[] gtermIconRaw;
private static Canvas gtermIcon = Image.FromBitmap(gtermIconRaw, false);

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.clock.bmp")] private static byte[] clockIconRaw;
private static Canvas clockIcon = Image.FromBitmap(clockIconRaw, false);

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.TaskManager.bmp")] private static byte[] taskmanIconRaw;
private static Canvas taskmanIcon = Image.FromBitmap(taskmanIconRaw, false);

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.ide.bmp")] private static byte[] ideIconRaw;
private static Canvas ideIcon = Image.FromBitmap(ideIconRaw, false);

Button[] AppButtons;
Button CloseButton;

public AppManager()
{
// Generate the fonts.
Fonts.Generate();

// Create the window.
Contents = new Canvas(400, 350);
Contents = new Canvas(400, 300);
Title = "GoOS Applications";
Visible = true;
Closable = true;
Expand All @@ -36,7 +22,7 @@ public AppManager()
// Initialize the controls.
AppButtons = new Button[]
{
new Button(this, 10, 52, 64, 80, "GTerm")
new Button(this, 10, 10, 64, 80, "GTerm")
{
UseSystemStyle = false,
BackgroundColour = Color.LightGray,
Expand All @@ -46,7 +32,7 @@ public AppManager()
Image = gtermIcon,
Clicked = GTerm_Click
},
new Button(this, 84, 52, 96, 80, "Task Manager")
new Button(this, 84, 10, 96, 80, "Task Manager")
{
UseSystemStyle = false,
BackgroundColour = Color.LightGray,
Expand All @@ -56,7 +42,7 @@ public AppManager()
Image = taskmanIcon,
Clicked = TaskMan_Click
},
new Button(this, 10, 184, 64, 80, "Clock")
new Button(this, 190, 10, 64, 80, "Clock")
{
UseSystemStyle = false,
BackgroundColour = Color.LightGray,
Expand All @@ -66,7 +52,7 @@ public AppManager()
Image = clockIcon,
Clicked = Clock_Click
},
new Button(this, 84, 184, 64, 80, "IDE")
new Button(this, 262, 10, 64, 80, "IDE")
{
UseSystemStyle = false,
BackgroundColour = Color.LightGray,
Expand All @@ -75,43 +61,38 @@ public AppManager()

Image = ideIcon,
Clicked = IDE_Click
}
},
new Button(this, 10, 100, 64, 80, "Store")
{
UseSystemStyle = false,
BackgroundColour = Color.LightGray,
SelectionColour = new Color(100, 100, 100),
TextColour = Color.White,

Image = GoStoreicon,
Clicked = Store_Click
},
};
CloseButton = new Button(this, Convert.ToUInt16(Contents.Width - 90), Convert.ToUInt16(Contents.Height - 30), 80, 20, "Close") { Clicked = CloseButton_Click };

// Paint the window.
Contents.Clear(Color.LightGray);
RenderSystemStyleBorder();
Contents.DrawFilledRectangle(2, Convert.ToUInt16(Contents.Height - 40), Convert.ToUInt16(Contents.Width - 4), 38, 0, Color.DeepGray);
Contents.DrawString(10, 10, "System Applications", Fonts.Font_2x, Color.White);
Contents.DrawString(10, 142, "Accessories", Fonts.Font_2x, Color.White);
foreach (Button AppButton in AppButtons) AppButton.Render();
CloseButton.Render();
}

private void GTerm_Click()
{
WindowManager.AddWindow(new GTerm());
}
private void GTerm_Click() => WindowManager.AddWindow(new GTerm());

private void TaskMan_Click()
{
WindowManager.AddWindow(new TaskManager());
}
private void TaskMan_Click() => WindowManager.AddWindow(new TaskManager());

private void Clock_Click()
{
WindowManager.AddWindow(new Clock());
}
private void Clock_Click() => WindowManager.AddWindow(new Clock());

private void IDE_Click()
{
WindowManager.AddWindow(new GoIDE.ProjectsFrame());
}
private void IDE_Click() => WindowManager.AddWindow(new GoIDE.ProjectsFrame());

private void CloseButton_Click()
{
Dispose();
}
private void Store_Click() => WindowManager.AddWindow(new GoStore.MainFrame());

private void CloseButton_Click() => Dispose();
}
}
8 changes: 2 additions & 6 deletions GoOS/GUI/Apps/BrownGhost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
using GoOS.GUI;
using IL2CPU.API.Attribs;
using PrismAPI.Graphics;
using static GoOS.Resources;

namespace GoOS.GUI.Apps
{
public class BrownGhost : Window
{
[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.brown_ghost.bmp")] static byte[] brownGhostRaw;
static Canvas brownGhost = Image.FromBitmap(brownGhostRaw, false);

public BrownGhost()
{
Contents = new Canvas(238, 150);
Expand All @@ -22,12 +20,10 @@ public BrownGhost()
Closable = true;
SetDock(WindowDock.Auto);

Fonts.Generate();

Contents.Clear(Color.Black);
RenderSystemStyleBorder();
Contents.DrawImage(10, 51, brownGhost);
Contents.DrawString(61, 67, "Aaaa! A brown ghost!", Fonts.Font_1x, Color.White);
Contents.DrawString(61, 67, "Aaaa! A brown ghost!", Font_1x, Color.White);
}
}
}
Loading

0 comments on commit b2c5999

Please sign in to comment.