protected override void OnRenderFrame(FrameEventArgs e) { base.OnRenderFrame(e); GL.Clear(ClearBufferMask.ColorBufferBit); GL.ClearColor(System.Drawing.Color.Aquamarine); Spritebatch.Begin(this.Width, this.Height); Spritebatch.Draw(texture2, new Vector2(0, 0), new Vector2(1f, 1f), Color.White, new Vector2(0, 0), new RectangleF(0, 0, 450, 480)); Spritebatch.Draw(texture2, new Vector2(450, 0), new Vector2(1f, 1f), Color.White, new Vector2(0, 0), new RectangleF(450, 0, 450, 480)); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); sw.Start(); //Animate(milliseconds); button1.Draw(); Spritebatch.Draw(texture2, new Vector2(0, 0), new Vector2(1f, 1f), Color.White, new Vector2(0, 0), new RectangleF(0, 0, 70, 50)); player.Draw(texture2); for (int i = blocks.Count - 1; i >= 0; i--) { blocks[i].Draw(texture2); } //Spritebatch.Draw(texture, new Vector2(642, 170), new Vector2(1f, 1f), Color.White, new Vector2(0, 0), new RectangleF(0, 0, 42, 166)); piston.Draw(texture2); bool tmp = false; tmp = sensors[0].CheckPosition(piston); sensors[0].State = tmp; PipeClient.SetInput(sensors[0].Name, sensors[0].State); sensors[0].Draw(); tmp = false; tmp = sensors[1].CheckPosition(piston); sensors[1].State = tmp; PipeClient.SetInput(sensors[1].Name, sensors[1].State); sensors[1].Draw(); tmp = false; for (int i = 0; i < blocks.Count; i++) { tmp = sensors[2].CheckPosition(blocks[i]); if (tmp) { break; } } sensors[2].State = tmp; PipeClient.SetInput(sensors[2].Name, sensors[2].State); sensors[2].Draw(); tmp = false; for (int i = 0; i < blocks.Count; i++) { tmp = sensors[3].CheckPosition(blocks[i]); if (tmp) { break; } } sensors[3].State = tmp; PipeClient.SetInput(sensors[3].Name, sensors[3].State); sensors[3].Draw(); tmp = false; for (int i = 0; i < blocks.Count; i++) { tmp = sensors[4].CheckPosition(blocks[i]); if (tmp) { break; } } sensors[4].State = tmp; PipeClient.SetInput(sensors[4].Name, sensors[4].State); sensors[4].Draw(); tmp = false; for (int i = 0; i < blocks.Count; i++) { tmp = sensors[5].CheckPosition(blocks[i]); if (tmp) { break; } } sensors[5].State = tmp; PipeClient.SetInput(sensors[5].Name, sensors[5].State); sensors[5].Draw(); tmp = false; if (player.Position.X == Player.startPosition.X) { tmp = true; } sensors[6].State = tmp; PipeClient.SetInput(sensors[6].Name, sensors[6].State); sensors[6].Draw(); tmp = false; if (player.Position.X == Player.firstContainerPosition.X) { tmp = true; } sensors[7].State = tmp; PipeClient.SetInput(sensors[7].Name, sensors[7].State); sensors[7].Draw(); tmp = false; if (player.Position.X == Player.secondContainerPosition.X) { tmp = true; } sensors[8].State = tmp; PipeClient.SetInput(sensors[8].Name, sensors[8].State); sensors[8].Draw(); tmp = false; if (player.Position.Y == Player.startPosition.Y) { tmp = true; } sensors[9].State = tmp; PipeClient.SetInput(sensors[9].Name, sensors[9].State); sensors[9].Draw(); tmp = false; if (player.Position.Y == Player.downPosition.Y) { tmp = true; } sensors[10].State = tmp; PipeClient.SetInput(sensors[10].Name, sensors[10].State); sensors[10].Draw(); tmp = false; tmp = Sensor.CheckState(conveyor); sensors[11].State = tmp; PipeClient.SetInput(sensors[11].Name, sensors[11].State); sensors[11].Draw(); sensors[12].State = !tmp; PipeClient.SetInput(sensors[12].Name, sensors[12].State); sensors[12].Draw(); tmp = false; tmp = Sensor.CheckState(gripper); sensors[13].State = tmp; PipeClient.SetInput(sensors[13].Name, sensors[13].State); sensors[13].Draw(); sensors[14].State = !tmp; PipeClient.SetInput(sensors[14].Name, sensors[14].State); sensors[14].Draw(); ControlMode.UpdateControlsForMode(); Spritebatch.Draw(texture2, new Vector2(116, 378), new Vector2(1f, 1f), Color.White, new Vector2(0, 0), new RectangleF(116, 378, 98, 64)); Spritebatch.Draw(texture2, new Vector2(239, 378), new Vector2(1f, 1f), Color.White, new Vector2(0, 0), new RectangleF(239, 378, 98, 64)); GL.Accum(AccumOp.Mult, 0.2f); // dodanie przeskalowanych wartości z bufora kolorów do bufora akumulacynego GL.Accum(AccumOp.Accum, 0.8f); //// kopiowanie wartości z bufora akumulacyjnego do bufora kolorów GL.Accum(AccumOp.Return, 1.0f); GL.Flush(); this.SwapBuffers(); double milliseconds = ComputeTimeSlice(); SetFPS(milliseconds); Accumulate(milliseconds); }