static void Main(string[] args) { //using (var w = new GameWindow()) //{ // w.Open(); //} var bm = Bitmap32.Load(File.ReadAllBytes("..\\..\\Sample3.png")); var random = new Random(); //var bm = new Bitmap32(640, 480); var rd = new BasicRenderer32(bm); //rd.Clear(new Color32(0x20, 0x20, 0x20, 0xFF)); rd.FillColor = new Color32(0xFF, 0x00, 0x00, 0x30); for (int i = 0; i < 100; i++) { var r = random.Next(50) + 10; var x = random.Next(bm.Width - r * 2) + r; var y = random.Next(bm.Height - r * 2) + r; rd.SolidElipse( x, y, r, r ); } //File.WriteAllBytes("out.png", bm.Save()); DisplayWindow.Show(bm); //bm.Save("out.png"); //new Bitmap32(bm, 0, 0, 128, 128).Save("out2.png"); }
protected override void OnDrawRequest(Bitmap32 buffer, TimeSpan elapsed) { SetTitle(string.Format("FPS: {0:0}, Particles: {1}", FramesPerSecond, m_particles.Count)); var rd = new BasicRenderer32(buffer); rd.Clear(new Color32(0x50, 0x50, 0x50, 0xFF)); foreach (var particle in m_particles) { particle.x += particle.vx * elapsed.TotalMilliseconds; particle.y += particle.vy * elapsed.TotalMilliseconds; if (particle.x < 0 || particle.x >= buffer.Width) { particle.vx = -particle.vx * 0.8; } if (particle.y < 0 || particle.y >= buffer.Height) { particle.vy = -particle.vy * 0.8; } rd.FillColor = particle.color; rd.SolidElipse((int)particle.x, (int)particle.y, (int)particle.radius, (int)particle.radius); //rd.SolidRectangle((int)(particle.x - particle.radius), (int)(particle.y - particle.radius), (int)(particle.x + particle.radius), (int)(particle.y + particle.radius)); } }
protected override void OnDrawRequest(Bitmap32 buffer, TimeSpan elapsed) { SetTitle(string.Format("FPS: {0:0}, Particles: {1}", FramesPerSecond, m_particles.Count)); var rd = new BasicRenderer32(buffer); rd.Clear(new Color32(0x50, 0x50, 0x50, 0xFF)); foreach (var particle in m_particles) { particle.x += particle.vx * elapsed.TotalMilliseconds; particle.y += particle.vy * elapsed.TotalMilliseconds; if (particle.x < 0 || particle.x >= buffer.Width) particle.vx = -particle.vx * 0.8; if (particle.y < 0 || particle.y >= buffer.Height) particle.vy = -particle.vy * 0.8; rd.FillColor = particle.color; rd.SolidElipse((int)particle.x, (int)particle.y, (int)particle.radius, (int)particle.radius); //rd.SolidRectangle((int)(particle.x - particle.radius), (int)(particle.y - particle.radius), (int)(particle.x + particle.radius), (int)(particle.y + particle.radius)); } }