private void Update() { if (window.GetKey(KeyCode.Right)) { tileMap.position += new Vector2(1, 0) * window.DeltaTime * 300; ship2.FlipX = false; } if (window.GetKey(KeyCode.Left)) { tileMap.position += new Vector2(-1, 0) * window.DeltaTime * 300; ship2.FlipX = true; } if (window.GetKey(KeyCode.Up)) { tileMap.position += new Vector2(0, -1) * window.DeltaTime * 300; } if (window.GetKey(KeyCode.Down)) { tileMap.position += new Vector2(0, 1) * window.DeltaTime * 300; } if (window.GetKey(KeyCode.CtrlLeft)) { deltaTimeAccumulator += window.DeltaTime; window.SetSize(window.Width, (int)(300 * (1 + Math.Abs(Math.Sin(deltaTimeAccumulator))))); } tileMap.position += window.JoystickAxisRight(0) * window.DeltaTime * 300; tileMap.Draw(); for (int i = 0; i < tiles2.Instances; i++) { tiles2.SetPositionPerInstance(i, new Vector2(20 * i, 20 * i)); if (i % 2 == 0) { tiles2.SetAdditiveTintPerInstance(i, new Vector4(0f, 0f, 1f, 1f)); } } tiles2.UpdatePositionForAllInstances(); tiles2.UpdateAdditiveTintForAllInstances(); ship.position.Y = 10; ship.position += new Vector2(5f, 0) * window.DeltaTime; ship.scale = new Vector2(1f, 1f); t += window.DeltaTime; if (t > 1f / 24f) { index++; if (index >= 51) { index = 0; } t = 0; } int x = (index % 10) * (alien.Width / 10); int y = (index / 10) * height; ship.DrawTexture(alien, x, y, alien.Width / 10, height); square.DrawColor(1f, 0, 0, 0.5f); window.SetClearColor(255, 0, 0); window.RenderTo(screen); logo.position.Y = 100; logo.position += new Vector2(50f, 0) * window.DeltaTime; logo.scale = new Vector2(1f, 1f); logo.DrawTexture(logoAiv); if (window.GetKey(KeyCode.Esc)) { window.Exit(); } if (window.GetKey(KeyCode.F)) { window.SetFullScreen(true); window.SetResolution(1920, 1080); } if (window.GetKey(KeyCode.T)) { window.SetTitle(string.Format("Counter = {0}", counter++)); } if (window.GetKey(KeyCode.R)) { ship.SetAdditiveTint(1f, -1f, -1f, 0); //ship.SetMultiplyTint(2f, 0, 0, 1); } if (window.GetKey(KeyCode.N)) { ship.SetAdditiveTint(0, 0, 0, 0); //ship.SetMultiplyTint(2f, 0, 0, 1); } window.SetClearColor(100, 100, 100); window.RenderTo(null); monitor.DrawRenderTexture(screen); Vector2 newPosition = tiles.GetPositionPerInstance(2) - Vector2.One * 20f * window.DeltaTime; tiles.SetPositionPerInstance(2, newPosition); tiles.DrawColor(0f, 1f, 1f, 1f); tiles2.position.X += 30 * window.DeltaTime; tiles2.DrawColor(1f, 1f, 0f, 1f); particleSystem.Update(window); //rope.SetDestination(window.mousePosition); rope.UpdatePhysics(window); rope.DrawColor(1f, 0f, 1f, 1f); ship2.position = rope.position + rope.Point2; ship2.SetAdditiveTint(-1f, 1f, -1f, 0); ship2.DrawTexture(alien, x, y, alien.Width / 10, height); particleSystem2.position = ship2.position; particleSystem2.Update(window); farTriangles.position.Y = window.MouseWheel; farTriangles.DrawColor(0f, 0f, 1f, 1f); triangle.v[4] = window.MouseX; triangle.v[5] = window.MouseY; triangle.UpdateVertex(); if (window.HasFocus) { triangle.DrawTexture(alien); } else { window.SetScissorTest(window.Width / 2 - 200, window.Height / 2 - 200, 400, 400); triangle.DrawColor(1f, 0f, 1f, 1f); window.SetScissorTest(false); } window.SetClearColor(0f, 0f, 0f, 0f); window.RenderTo(maskedAlien); maskedBackground.DrawTexture(alien2); window.SetMaskedBlending(); spriteMask.scale = Vector2.One; spriteMask.position = new Vector2(150, 100); spriteMask.DrawTexture(circleMask); spriteMask.scale = new Vector2(2f, 2.7f); spriteMask.position = new Vector2(180, 280); spriteMask.DrawTexture(circleMask2); window.SetAlphaBlending(); window.SetClearColor(0.5f, 0.5f, 0.5f); window.RenderTo(null); maskedObject.DrawRenderTexture(maskedAlien); if (window.GetKey(KeyCode.Space)) { mainEffect.enabled = true; } if (window.GetKey(KeyCode.Return)) { mainEffect.enabled = false; } if (window.GetKey(KeyCode.Num1)) { window.SetDefaultViewportOrthographicSize(window.CurrentViewportOrthographicSize + window.DeltaTime * 100); } colouredTriangle.position = window.MousePosition; colouredTriangle.pivot = new Vector2(500, 250); float triggerRight = window.JoystickTriggerRight(0); float triggerLeft = window.JoystickTriggerLeft(0); colouredTriangle.scale = new Vector2(1 + triggerLeft, 1 + triggerRight); colouredTriangle.Draw(); }