mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-02 22:30:27 +00:00
- To solve the slowness of the MemoryBlock Fill() method when the block has a big size I've created a new class for this MemoryOperations that for now contains only the method Fill() with a part implemented in ASM and with some overloads to semplify its usage from managed code. In future in this class will be added other methods to operate fast on memory for example Cmp() and Copy(). - Adding (not passing) test of the Color struct to the BoxingTest kernel - Removed BoxingTest kernel inside BCL test: it was a duplicate of the BoxingTest kernel - Restored correct TestKernelSets - In the CGS Test kernel the last rectangle is now LimeGreen instead of another type of red (more clear that is working correctly) - Added to X# the generation of the instruction Shuftps - Added to X# the generation of the instruction MoveUPS - Modified Guess Demo to wait for a key press to terminate (it closed suddenly in case the number was guessed) - The VBE IOMemoryBlock has again size of 1920x1200 (the max usable) - Added CGS Demo - Code clean up
70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
using System;
|
|
using Cosmos.System.Graphics;
|
|
using Sys = Cosmos.System;
|
|
|
|
/*
|
|
* Beware Demo Kernels are not recompiled when its dependencies changes!
|
|
* To force recompilation right click on on the Cosmos icon of the demo solution and do "Build".
|
|
*/
|
|
namespace Cosmos_Graphic_Subsytem
|
|
{
|
|
public class Kernel : Sys.Kernel
|
|
{
|
|
Canvas canvas;
|
|
protected override void BeforeRun()
|
|
{
|
|
Console.WriteLine("Cosmos booted successfully. Let's go in Graphic Mode");
|
|
|
|
/* Get on istance of the Canvas that is all the Screen */
|
|
canvas = FullScreenCanvas.GetFullScreenCanvas();
|
|
|
|
/* Clear the Screen with the color 'Blue' */
|
|
canvas.Clear(Color.Blue);
|
|
}
|
|
|
|
protected override void Run()
|
|
{
|
|
mDebugger.Send("Run");
|
|
|
|
/* A red Point */
|
|
Pen pen = new Pen(Color.Red);
|
|
canvas.DrawPoint(pen, 69, 69);
|
|
|
|
/* A GreenYellow horizontal line */
|
|
pen.Color = Color.GreenYellow;
|
|
canvas.DrawLine(pen, 250, 100, 400, 100);
|
|
|
|
/* An IndianRed vertical line */
|
|
pen.Color = Color.IndianRed;
|
|
canvas.DrawLine(pen, 350, 150, 350, 250);
|
|
|
|
/* A MintCream diagonal line */
|
|
pen.Color = Color.MintCream;
|
|
canvas.DrawLine(pen, 250, 150, 400, 250);
|
|
|
|
/* A PaleVioletRed rectangle */
|
|
pen.Color = Color.PaleVioletRed;
|
|
canvas.DrawRectangle(pen, 350, 350, 80, 60);
|
|
|
|
/*
|
|
* It will be really beautiful to do here:
|
|
* canvas.DrawString(pen, "Please press any key to continue the Demo...");
|
|
*/
|
|
Console.ReadKey();
|
|
|
|
/* Let's try to change mode...*/
|
|
canvas.Mode = new Mode(800, 600, ColorDepth.ColorDepth32);
|
|
|
|
/* A LimeGreen rectangle */
|
|
pen.Color = Color.LimeGreen;
|
|
canvas.DrawRectangle(pen, 450, 450, 80, 60);
|
|
|
|
/*
|
|
* It will be really beautiful to do here:
|
|
* canvas.DrawString(pen, "Please press any key to end the Demo...");
|
|
*/
|
|
Console.ReadKey();
|
|
Stop();
|
|
}
|
|
}
|
|
}
|