public override void Update(Window window) { if (window.GetKey(KeyCode.D)) { center.X += window.deltaTime; } if (window.GetKey(KeyCode.A)) { center.X -= window.deltaTime; } if (window.GetKey(KeyCode.W)) { center.Y += window.deltaTime; } if (window.GetKey(KeyCode.S)) { center.Y -= window.deltaTime; } screenMesh.v = new float[] { -1 + center.X, 1 + center.Y, 1+ center.X, 1 + center.Y, 1+ center.X, -1 + center.Y, 1+ center.X,-1 + center.Y, -1+ center.X, -1 + center.Y, -1+ center.X, 1 + center.Y }; screenMesh.UpdateVertex(); }
public Engine(string windowName, int width, int height, int fps = 60, bool fullscreen = false, bool vsync = false) { Initialize(); wantedDeltaTime = fps > 0 ? 1f/fps : 0; // FPS? Window = new Window(width, height, windowName, fullscreen, vsync); }
public void Update(Window window) { for (int i = 0; i < this.instancedSprite.Instances; i++) { this.particles[i].life -= window.deltaTime; if (this.particles[i].life <= 0) { this.particles[i].velocity = new Vector2(RandomFloat(-1, 1), RandomFloat(-1, 0)) * 60f; this.particles[i].gravity = Vector2.Zero; this.particles[i].life = RandomFloat(1, 3); this.instancedSprite.SetPosition(i, Vector2.Zero); this.instancedSprite.SetScale(i, new Vector2(RandomFloat(1, 2), RandomFloat(1, 2))); continue; } Vector2 position = this.instancedSprite.GetPosition(i); this.particles[i].gravity += gravity * window.deltaTime; this.instancedSprite.SetPosition(i, position + (this.particles[i].velocity + this.particles[i].gravity) * window.deltaTime, noUpload: true); } this.instancedSprite.UpdatePositions(); this.instancedSprite.DrawSolidColor(0, 1, 0, 0.8f); }
public override void Update(Window window) { window.BindTextureToUnit(this.maskTexture, 1); screenMesh.shader.SetUniform("mask_tex", 1); }
public virtual void Update(Window window) { }
public void Setup(Window window) { renderTexture = new RenderTexture(window.Width, window.Height); }
public void Apply(Window window) { screenMesh.DrawTexture(renderTexture); }
public override void Update(Window window) { this.wave += window.deltaTime * this.speed; screenMesh.shader.SetUniform("wave", this.wave); }