public static void Draw() { if (HasChanged) { for (int i = 0; i < Width * Height; i++) { Driver.SetPixel((uint)(i % Width), (uint)(i / Width), Buffer[i]); } Driver.Update(0, 0, (uint)Width, (uint)Height); HasChanged = false; } }
protected override void Run() { FPSMeter.Update(); mainGraphics.Clear(Color.Black); mainGraphics.DrawString(Color.White, $"你好\nHola a todos\nHello there\nOlá\nПривет\nこんにちは\nHallo\nBonjour\n{FPSMeter.FPS} FPS\nInstalled RAM {CPU.GetAmountOfRAM()}MB\nUsed RAM {CPU.GetEndOfKernel() / 1048576}MB", 10, 10); DrawCursor(mainGraphics, (int)MouseManager.X, (int)MouseManager.Y); videoDriver.Video_Memory.Copy(mainGraphics.memory); videoDriver.Update(0, 0, (uint)screenWidth, (uint)screenHeight); }
public static void InitGUI_1024x768() { VMWareSVGAII driver = new VMWareSVGAII(); driver.SetMode(1024, 768); driver.Clear(0x16711935); MouseDriver mouseDriver = new MouseDriver(1024, 768); bool OK = true; while (OK) { mouseDriver.Draw(driver); driver.Update(0, 0, 1024, 768); } }
public static void InitGUI_800x600() { VMWareSVGAII driver = new VMWareSVGAII(); driver.SetMode(800, 600); driver.Clear(0x16711935); MouseDriver mouseDriver = new MouseDriver(800, 600); bool OK = true; while (OK) { mouseDriver.Draw(driver); driver.Update(0, 0, 800, 600); } }
public static void ASUSEeePC1001PX_OEM() // It's recommended that this code be deleted in outside projects as it is not wanted. { Console.WriteLine("Using ASUS EeePC 1001PX Resolution Mode"); VMWareSVGAII driver = new VMWareSVGAII(); driver.SetMode(1024, 600); driver.Clear(0x16711935); MouseDriver mouseDriver = new MouseDriver(1024, 600); bool OK = true; while (OK) { mouseDriver.Draw(driver); driver.Update(0, 0, 1024, 600); } }
private static void DrawComponents() { ushort updateWidth = Math.Min((ushort)(Width / 2.56), Width); ushort updateHeight = Math.Min((ushort)(Height / 2.56), Height); ushort updateX = (ushort)((Width - updateWidth) / 2); ushort updateY = (ushort)((Height - updateHeight) / 2); bool running = true; if (running) { if (deltaT != RTC.Second) { FPS = Frames; Frames = 0; deltaT = RTC.Second; } byte b = (byte)(((double)m.X / (double)Width) * 255); byte rg = (byte)(((double)m.Y / (double)Height) * 255); uint col = (uint)b + (uint)(rg << 8) + (uint)(rg << 16); string fps = "FPS : " + FPS; DrawUtils.DrawString(driver, LastFPS, fps, 50, 50, 0x255); LastFPS = fps; string ram = "RAM : " + MemoryManager.UsedMemory().ToString() + " MB / " + MemoryManager.TotalMemory().ToString() + " MB"; DrawUtils.DrawString(driver, LastRAM, ram, 50, 80, 0x255); LastRAM = ram; for (ushort x = updateX; x < updateX + updateWidth; x++) { for (ushort y = updateY; y < updateY + updateHeight; y++) { driver.SetPixel(x, y, col); } } m.Draw(driver); driver.Update(0, 0, Width, Height); Frames++; DrawComponents(); } }
// update public static void Update() { //delta = deltaOld; // draw buffer if (refresh) { for (int i = 0; i < width * height; i++) { int x = i % width; int y = i / width; device.SetPixel((uint)x, (uint)y, buffer[i]); } // clear buffer ClearBuffer(color); refresh = false; } // update device device.Update(0, 0, width, height); // get framerate if (frames > 0) { delta = (float)1000 / (float)frames; } int sec = Clock.GetSecond(); if (tick != sec) { fpsString = "FPS: " + frames.ToString(); fps = frames; if (delta.ToString().Length > 6) { deltaString = "DELTA: " + delta.ToString().Substring(0, 6) + "ms"; } else { deltaString = "DELTA: " + delta.ToString() + "ms"; } frames = 0; tick = sec; } frames++; }
public static void update() { svga.Update((ushort)0, (ushort)0, (ushort)res.x, (ushort)res.y); }
public void Clear() { svga.Clear(0x000000); svga.Update(0, 0, 800, 600); }