mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 12:30:32 +00:00
Please note that this version works only with Bochs. - To make it works was needed to renounce to all structures (a part for primitive types) so now Mode and Color are classes. - Implemented methods of Canvas DrawPoint(), DrawLine() and DrawRect() for now only color depth of 32 bit and integer coordinates are supported - Changed IoPort of Bochs / VBE to MemoryBlock and not MemoryBlock08 so I can write an 32 bit ARGB color in only an operation instead of 4, this will semplify the future work of RGB24 and RGB16 too. Changed the name to the correct one "LinearFrameBuffer". - Made VBEDriver more object oriented (used enums instead of hardcoded values, created methods and so on...) - Bugfix in the Pen class there was confusion in the setter / getter of the Color property - In VBEScreen removed the old code that is not needed anymore, added check to method arguments (that throws in case of fatal errors)
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
//#define COSMOSDEBUG
|
|
using Cosmos.System.Graphics;
|
|
|
|
namespace Cosmos.System.Graphics
|
|
{
|
|
public static class FullScreenCanvas
|
|
{
|
|
/*
|
|
* For now we hardcode that the VideoDriver is always VBE when we have more that a driver supported we need to find
|
|
* what to use when we do the 'new' (inside GetFullScreenCanvas() static methods). MyVideoDriver should be
|
|
* of type Canvas
|
|
*/
|
|
static private Canvas MyVideoDriver = null;
|
|
|
|
public static Canvas GetFullScreenCanvas(Mode mode)
|
|
{
|
|
Global.mDebugger.SendInternal("GetFullScreenCanvas() with mode " + mode);
|
|
|
|
if (MyVideoDriver == null)
|
|
return MyVideoDriver = new VBEScreen(mode);
|
|
|
|
/* We have already got a VideoDriver istance simple change its mode */
|
|
MyVideoDriver.Mode = mode;
|
|
return MyVideoDriver;
|
|
}
|
|
|
|
public static Canvas GetFullScreenCanvas()
|
|
{
|
|
Global.mDebugger.SendInternal($"GetFullScreenCanvas() with default mode");
|
|
if (MyVideoDriver == null)
|
|
return new VBEScreen();
|
|
|
|
/* We have already got a VideoDriver istance simple reset its mode to DefaultGraphicMode */
|
|
MyVideoDriver.Mode = MyVideoDriver.DefaultGraphicMode;
|
|
return MyVideoDriver;
|
|
}
|
|
}
|
|
}
|