コード例 #1
0
ファイル: Clock.cs プロジェクト: sayaPintar/Cosmos-GUI-Sample
        void drawHand(DoubleBufferedVMWareSVGAII vMWareSVGAII, uint color, int xStart, int yStart, int angle, int radius)
        {
            int[] sine = new int[16] {
                0, 27, 54, 79, 104, 128, 150, 171, 190, 201, 221, 233, 243, 250, 254, 255
            };
            int xEnd, yEnd, quadrant, x_flip, y_flip;

            quadrant = angle / 15;

            switch (quadrant)
            {
            case 0: x_flip = 1; y_flip = -1; break;

            case 1: angle = Math.Abs(angle - 30); x_flip = y_flip = 1; break;

            case 2: angle = angle - 30; x_flip = -1; y_flip = 1; break;

            case 3: angle = Math.Abs(angle - 60); x_flip = y_flip = -1; break;

            default: x_flip = y_flip = 1; break;
            }

            xEnd = xStart;
            yEnd = yStart;

            if (angle > sine.Length)
            {
                return;
            }

            xEnd += (x_flip * ((sine[angle] * radius) >> 8));
            yEnd += (y_flip * ((sine[15 - angle] * radius) >> 8));

            vMWareSVGAII.DoubleBuffer_DrawLine(color, xStart, yStart, xEnd, yEnd);
        }
コード例 #2
0
 public void DrawCursor(DoubleBufferedVMWareSVGAII vMWareSVGAII, uint x, uint y)
 {
     for (uint h = 0; h < 19; h++)
     {
         for (uint w = 0; w < 12; w++)
         {
             if (cursor[h * 12 + w] == 1)
             {
                 vMWareSVGAII.DoubleBuffer_SetPixel(w + x, h + y, (uint)Color.Black.ToArgb());
             }
             if (cursor[h * 12 + w] == 2)
             {
                 vMWareSVGAII.DoubleBuffer_SetPixel(w + x, h + y, (uint)Color.White.ToArgb());
             }
         }
     }
 }
コード例 #3
0
        protected override void BeforeRun()
        {
            CosmosVFS cosmosVFS = new CosmosVFS();

            VFSManager.RegisterVFS(cosmosVFS);

            bootBitmap = new Bitmap(@"0:\boot.bmp");

            vMWareSVGAII = new DoubleBufferedVMWareSVGAII();
            vMWareSVGAII.SetMode(screenWidth, screenHeight);

            vMWareSVGAII.DoubleBuffer_DrawImage(bootBitmap, 640 / 4, 0);
            vMWareSVGAII.DoubleBuffer_Update();

            bitmap      = new Bitmap(@"0:\timg.bmp");
            programlogo = new Bitmap(@"0:\program.bmp");

            uint r = 0;
            uint g = 0;
            uint b = 0;

            for (uint i = 0; i < bitmap.rawData.Length; i++)
            {
                Color color = Color.FromArgb(bitmap.rawData[i]);
                r += color.R;
                g += color.G;
                b += color.B;
            }
            avgCol = Color.FromArgb((int)(r / bitmap.rawData.Length), (int)(g / bitmap.rawData.Length), (int)(b / bitmap.rawData.Length));

            MouseManager.ScreenWidth  = screenWidth;
            MouseManager.ScreenHeight = screenHeight;
            MouseManager.X            = screenWidth / 2;
            MouseManager.Y            = screenHeight / 2;

            logView = new LogView(300, 200, 10, 30);
            Clock   = new Clock(200, 200, 400, 200);
            notepad = new Notepad(200, 100, 10, 300);
            dock    = new Dock();

            apps.Add(logView);
            apps.Add(Clock);
            apps.Add(notepad);
        }
コード例 #4
0
        protected override void BeforeRun()
        {
            CosmosVFS cosmosVFS = new CosmosVFS();

            VFSManager.RegisterVFS(cosmosVFS);

            bootBitmap = new Bitmap(@"0:\boot.bmp");

            vMWareSVGAII = new DoubleBufferedVMWareSVGAII();
            vMWareSVGAII.SetMode(screenWidth, screenHeight);

            vMWareSVGAII.DoubleBuffer_DrawImage(bootBitmap, screenWidth / 2 - bootBitmap.Width / 2, screenHeight / 2 - bootBitmap.Height / 2);
            vMWareSVGAII.DoubleBuffer_Update();

            //bitmap = new Bitmap(@"0:\timg.bmp"); Wallpaper

            programlogo = new Bitmap(@"0:\program.bmp");

            /*
             * uint r = 0;
             * uint g = 0;
             * uint b = 0;
             * for (uint i = 0; i < bitmap.rawData.Length; i++)
             * {
             *  Color color = Color.FromArgb(bitmap.rawData[i]);
             *  r += color.R;
             *  g += color.G;
             *  b += color.B;
             * }
             * avgCol = Color.FromArgb((int)(r / bitmap.rawData.Length), (int)(g / bitmap.rawData.Length), (int)(b / bitmap.rawData.Length));
             */
            avgCol = Color.DimGray;

            MouseManager.ScreenWidth  = screenWidth;
            MouseManager.ScreenHeight = screenHeight;

            console = new Console(400, 300, 40, 40);
            dock    = new Dock();

            apps.Add(console);
        }