Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Cosmos.HAL;
- using Sys = Cosmos.System;
- namespace NewTech.Display
- {
- public class LegacyDisplayDriver
- {
- protected VGAScreen screen;
- private int width, height;
- public LegacyDisplayDriver()
- {
- screen = new VGAScreen();
- }
- public void init()
- {
- Console.WriteLine("LegacyDisplayDriver Booted lets go to graphic mode!");
- Console.Clear();
- screen.SetGraphicsMode(VGAScreen.ScreenSize.Size320x200, VGAScreen.ColorDepth.BitDepth8);
- width = screen.PixelWidth;
- height = screen.PixelHeight;
- screen.Clear(0);
- clear(0);
- }
- public virtual void setPixel(int x, int y, int c)
- {
- if (screen.GetPixel320x200x8((uint)x, (uint)y) != (uint)c)
- setPixelRaw(x, y, c);
- }
- public virtual byte getPixel(int x, int y)
- {
- return (byte)screen.GetPixel320x200x8((uint)x, (uint)y);
- }
- public virtual void clear()
- {
- clear(0);
- }
- public virtual void clear(int c)
- {
- DrawFilledRectangle(0, 0, width, width, c);
- }
- public virtual void step() { }
- public int getWidth()
- {
- return width;
- }
- public int getHeight()
- {
- return height;
- }
- public void setPixelRaw(int x, int y, int c)
- {
- screen.SetPixel320x200x8((uint)x, (uint)y, (uint)c);
- }
- public void DrawFilledRectangle(uint x0, uint y0, int Width, int Height, int color)
- {
- for(uint i = 0; i < Width; i++)
- {
- for(uint h = 0; h < Height; h++)
- {
- setPixel((int)(x0 + i), (int)(y0 + h), color);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement