Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Cosmos.Core;
- using Cosmos.Core.IOGroup;
- using Cosmos.System;
- using Cosmos.System.Graphics;
- using Cosmos.System.Graphics.Fonts;
- using System;
- using System.Drawing;
- using System.Reflection;
- using Sys = Cosmos.System;
- namespace CosmosOS
- {
- public class Kernel : Sys.Kernel
- {
- Canvas canvas;
- Pen pen;
- int buttonx = 512;
- int buttony = 384;
- int bwidth = 100;
- int bheight = 50;
- public static Color[] Colors = new Color[]
- {
- Color.Blue, Color.Green, Color.Red, Color.DarkMagenta,
- Color.Purple, Color.Yellow, Color.Orange
- };
- protected override void BeforeRun()
- {
- System.Threading.Thread.Sleep(500);
- canvas = FullScreenCanvas.GetFullScreenCanvas();
- pen = new Pen(Color.White);
- canvas.Display();
- }
- public bool IsClicked()
- {
- return MouseManager.MouseState == MouseState.Left &&
- MouseManager.X >= buttonx && MouseManager.X <= buttonx + bwidth &&
- MouseManager.Y >= buttony && MouseManager.Y <= buttony + bheight;
- }
- protected override void Run()
- {
- int index = 0;
- while (true)
- {
- canvas.Clear(Colors[index]);
- canvas.DrawFilledRectangle(pen, new Sys.Graphics.Point(buttonx, buttony), bwidth, bheight);
- canvas.DrawPoint(pen, MouseManager.X, MouseManager.Y);
- canvas.DrawString("CosmosOS 2.0 booted up on i386.", PCScreenFont.Default, pen, 10, 10);
- canvas.Display();
- if (IsClicked())
- {
- index++;
- if (index == 6)
- {
- index = 0;
- }
- continue
- ;
- }
- index = (index + 1) % Colors.Length;
- System.Threading.Thread.Sleep(500);
- System.Threading.Thread.Sleep(50);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment