public override void Redraw(VirtualRenderTarget buffer) { base.Redraw(buffer); Draw.SpriteBatch.Begin(); table.Render(new Vector2(60f, 20f)); Draw.SpriteBatch.End(); }
private void onGameplayBuffersCreate(On.Celeste.GameplayBuffers.orig_Create orig) { orig(); // create the foreground effect buffer as well. foregroundEffectBuffer = VirtualContent.CreateRenderTarget("foreground-effect-buffer", 320, 180); }
public VirtualRenderTarget SwapHudTarget(VirtualRenderTarget target) { VirtualRenderTarget prev = Celeste.HudTarget; Celeste.HudTarget = target; return(prev); }
private void onGameplayBuffersCreate(On.Celeste.GameplayBuffers.orig_Create orig) { orig(); // create the black mask as well. blackMask = VirtualContent.CreateRenderTarget("extended-variants-black-mask", 320, 180); }
public override void Removed(Scene scene) { logBuffer?.Dispose(); logBuffer = null; base.Removed(scene); }
private void onGameplayBuffersCreate(On.Celeste.GameplayBuffers.orig_Create orig) { orig(); // create the blur temp buffer as well. tempBuffer = VirtualContent.CreateRenderTarget("extended-variants-temp-blur-buffer", 320, 180); }
public void BeforeRender() { if (!Focused || !Visible || Lines == null) { return; } if (logBuffer == null) { logBuffer = VirtualContent.CreateRenderTarget("loggedprogress-log", logBounds.Width, logBounds.Height); } Engine.Graphics.GraphicsDevice.SetRenderTarget(logBuffer.Target); Engine.Graphics.GraphicsDevice.Clear(Color.Transparent); Draw.SpriteBatch.Begin(); for (int i = 0; i < Lines.Count; i++) { ActiveFont.Draw( Lines[i], new Vector2(8f, logBuffer.Height - 8f - (30f * (Lines.Count - i))), Vector2.Zero, Vector2.One * 0.5f, Color.White ); } Draw.SpriteBatch.End(); }
private void onGameplayBuffersUnload(On.Celeste.GameplayBuffers.orig_Unload orig) { orig(); // dispose the blur temp buffer as well. tempBuffer?.Dispose(); tempBuffer = null; }
public override void Redraw(VirtualRenderTarget buffer) { base.Redraw(buffer); Draw.SpriteBatch.Begin(); mapImage.DrawCentered(new Vector2(PageWidth / 2, PageHeight / 2)); Draw.SpriteBatch.End(); }
public override void BeforeRender(Scene scene) { base.BeforeRender(scene); VirtualRenderTarget prev = SwapHudTarget(HudTarget); WrappedScene.BeforeRender(); SwapHudTarget(prev); }
private void onGameplayBuffersUnload(On.Celeste.GameplayBuffers.orig_Unload orig) { orig(); // dispose the black mask as well. blackMask?.Dispose(); blackMask = null; }
private void Dispose() { if (renderTarget != null) { renderTarget.Dispose(); } renderTarget = null; }
private void onGameplayBuffersUnload(On.Celeste.GameplayBuffers.orig_Unload orig) { orig(); // dispose the black mask as well. foregroundEffectBuffer?.Dispose(); foregroundEffectBuffer = null; }
public override void Unload() { IL.Celeste.Level.Render -= modLevelRender; On.Celeste.GameplayBuffers.Create -= onGameplayBuffersCreate; On.Celeste.GameplayBuffers.Unload -= onGameplayBuffersUnload; // dispose the blur temp buffer, or it will just be laying around for no reason. tempBuffer?.Dispose(); tempBuffer = null; }
public void Alloc() { if (allocated) { return; } allocated = true; HudTarget = VirtualContent.CreateRenderTarget("hud-target", 1922, 1082); }
public void Dispose() { if (!allocated) { return; } allocated = false; HudTarget.Dispose(); HudTarget = null; }
public override void Unload() { IL.Celeste.Level.Render -= modLevelRender; On.Celeste.Level.BeforeRender -= onLevelBeforeRender; On.Celeste.GameplayBuffers.Create -= onGameplayBuffersCreate; On.Celeste.GameplayBuffers.Unload -= onGameplayBuffersUnload; // dispose the black mask, or it will just be laying around for no reason. blackMask?.Dispose(); blackMask = null; }
public DreamJellyfishRenderer() { Depth = Depths.Player - 4; Tag = Tags.Global | Tags.TransitionUpdate; /* * Okay, so this was the only way I could imagine doing this. * I was told that using a render target for masking stuff was a bit brutal, but I couldn't find another way. */ renderTarget = VirtualContent.CreateRenderTarget("communalhelper-dreamjellyfishrenderer", 48, 42); }
public override void Load() { IL.Celeste.Level.Render += modLevelRender; On.Celeste.GameplayBuffers.Create += onGameplayBuffersCreate; On.Celeste.GameplayBuffers.Unload += onGameplayBuffersUnload; if (Engine.Scene is Level) { // we are already in a map, aaaaa, create the blur temp buffer real quick tempBuffer = VirtualContent.CreateRenderTarget("extended-variants-temp-blur-buffer", 320, 180); } }
private void Dispose() { if (DetectOtherController()) { return; } if (BlockFill != null) { BlockFill.Dispose(); } BlockFill = null; }
public Emulator(Scene returnTo, int levelX = 0, int levelY = 0) { ReturnTo = returnTo; bootLevel = new Point(levelX, levelY); buffer = VirtualContent.CreateRenderTarget("pico-8", 128, 128); // sprites var atlas = GFX.Game["pico8/atlas"]; sprites = new MTexture[(atlas.Width / 8) * (atlas.Height / 8)]; for (int ty = 0; ty < atlas.Height / 8; ty++) { for (int tx = 0; tx < atlas.Width / 8; tx++) { sprites[tx + ty * (atlas.Width / 8)] = atlas.GetSubtexture(tx * 8, ty * 8, 8, 8); } } // tilemap var tiledata = MapData; tiledata = Regex.Replace(tiledata, @"\s+", ""); tilemap = new byte[tiledata.Length / 2]; for (int i = 0, len = tiledata.Length, hlen = len / 2; i < len; i += 2) { var a = tiledata[i]; var b = tiledata[i + 1]; var str = (i < hlen ? (a.ToString() + b.ToString()) : (b.ToString() + a.ToString())); tilemap[i / 2] = (byte)int.Parse(str, System.Globalization.NumberStyles.HexNumber); } // font var fontatlas = GFX.Game["pico8/font"]; font = new MTexture[(fontatlas.Width / 4) * (fontatlas.Height / 6)]; for (var ty = 0; ty < fontatlas.Height / 6; ty++) { for (var tx = 0; tx < fontatlas.Width / 4; tx++) { font[tx + ty * (fontatlas.Width / 4)] = fontatlas.GetSubtexture(tx * 4, ty * 6, 4, 6); } } // boot stuff picoBootLogo = GFX.Game["pico8/logo"]; ResetScreen(); Audio.SetMusic(null); Audio.SetAmbience(null); new FadeWipe(this, true); RendererList.UpdateLists(); }
public override void Load() { IL.Celeste.Level.Render += modLevelRender; On.Celeste.Level.BeforeRender += onLevelBeforeRender; On.Celeste.GameplayBuffers.Create += onGameplayBuffersCreate; On.Celeste.GameplayBuffers.Unload += onGameplayBuffersUnload; if (Engine.Scene is Level) { // we are already in a map, aaaaa, create the black mask real quick blackMask = VirtualContent.CreateRenderTarget("extended-variants-black-mask", 320, 180); } }
public override void Render() { VirtualRenderTarget buffer = this.Manager.buffer; Rectangle rectangle; ((Rectangle) ref rectangle).\u002Ector(this.Index % 8 * 64, this.Index / 8 * 64, 64, 64); float num = (double)this.Duration > 0.0 ? (float)(0.75 * (1.0 - (double)Ease.CubeOut(this.Percent))) : 1f; if (buffer == null) { return; } Draw.SpriteBatch.Draw((Texture2D)(RenderTarget2D)buffer, this.Position, new Rectangle?(rectangle), Color.op_Multiply(this.Color, num), 0.0f, Vector2.op_Multiply(new Vector2(64f, 64f), 0.5f), Vector2.get_One(), (SpriteEffects)0, 0.0f); }
public void Dispose() { if (starsTarget != null && !starsTarget.IsDisposed) { starsTarget.Dispose(); } if (beamsTarget != null && !beamsTarget.IsDisposed) { beamsTarget.Dispose(); } starsTarget = null; beamsTarget = null; }
private void BeforeRender() { if (BlockFill == null) { BlockFill = VirtualContent.CreateRenderTarget("block-fill", 320, 180, false, true, 0); } if (this.vertexCount <= 0) { return; } Engine.Graphics.GraphicsDevice.SetRenderTarget((RenderTarget2D)BlockFill); Engine.Graphics.GraphicsDevice.Clear(wipeColor); GFX.DrawVertices <VertexPositionColor>(Matrix.Identity, this.vertices, this.vertexCount, (Effect)null, (BlendState)null); }
public override void Render() { if (SceneAs <Level>().Session.Area.GetLevelSet() == "Celeste") { orig_Render(); return; } // Allow the StarJumpBlock to use an Everest StarJumpGraphicsController instead, // which is color-customizable and doesn't include forced music. // Prioritizes the Everest controller if found, though you shouldn't be using both at once. StarJumpController vanillaController = Scene.Tracker.GetEntity <StarJumpController>(); StarClimbGraphicsController everestController = Scene.Tracker.GetEntity <StarClimbGraphicsController>(); Vector2 cameraPos = level.Camera.Position.Floor(); VirtualRenderTarget blockFill = null; if (everestController != null) { blockFill = StarClimbGraphicsController.BlockFill; } else if (vanillaController != null) { blockFill = vanillaController.BlockFill; } if (blockFill != null) { Draw.SpriteBatch.Draw( blockFill, Position, new Rectangle?(new Rectangle((int)(X - cameraPos.X), (int)(Y - cameraPos.Y), (int)Width, (int)Height)), Color.White ); } base_Render(); }
private static void BloomRendererHook(On.Celeste.BloomRenderer.orig_Apply orig, BloomRenderer self, VirtualRenderTarget target, Scene scene) { if (alphaFade < 1f) { // multiply all alphas by alphaFade, and back up original values. List <BloomPoint> affectedBloomPoints = new List <BloomPoint>(); List <float> originalAlpha = new List <float>(); foreach (BloomPoint bloomPoint in scene.Tracker.GetComponents <BloomPoint>().ToArray()) { if (bloomPoint.Visible && !(bloomPoint.Entity is Payphone)) { affectedBloomPoints.Add(bloomPoint); originalAlpha.Add(bloomPoint.Alpha); bloomPoint.Alpha *= alphaFade; } } // render the bloom. orig(self, target, scene); // restore original alphas. int index = 0; foreach (BloomPoint bloomPoint in affectedBloomPoints) { bloomPoint.Alpha = originalAlpha[index++]; } } else { // alpha multiplier is 1: nothing to modify, go on with vanilla. orig(self, target, scene); } }
public override void Awake(Scene scene) { base.Awake(scene); renderTarget = VirtualContent.CreateRenderTarget("madelineparty-better-textmenu", Crop.Width, Crop.Height); }
public virtual void Redraw(VirtualRenderTarget buffer) { Engine.Graphics.GraphicsDevice.SetRenderTarget(buffer); Engine.Graphics.GraphicsDevice.Clear(Color.Transparent); }
private void BeforeRender() { List <Entity> glassBlocks = Scene.Tracker.GetEntities <CustomizableGlassBlock>(); hasBlocks = (glassBlocks.Count > 0); if (!hasBlocks) { return; } Camera camera = (Scene as Level).Camera; int screenWidth = 320; int screenHeight = 180; // draw stars if (starsTarget == null) { starsTarget = VirtualContent.CreateRenderTarget("customizable-glass-block-surfaces", screenWidth, screenHeight); } Engine.Graphics.GraphicsDevice.SetRenderTarget(starsTarget); Engine.Graphics.GraphicsDevice.Clear(Color.Transparent); Draw.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, Matrix.Identity); Vector2 origin = new Vector2(8f, 8f); for (int i = 0; i < stars.Length; i++) { MTexture starTexture = stars[i].Texture; Color starColor = stars[i].Color * alpha; Vector2 starScroll = stars[i].Scroll; Vector2 starActualPosition = default; starActualPosition.X = Mod(stars[i].Position.X - camera.X * (1f - starScroll.X), screenWidth); starActualPosition.Y = Mod(stars[i].Position.Y - camera.Y * (1f - starScroll.Y), screenHeight); starTexture.Draw(starActualPosition, origin, starColor); if (starActualPosition.X < origin.X) { starTexture.Draw(starActualPosition + new Vector2(screenWidth, 0f), origin, starColor); } else if (starActualPosition.X > screenWidth - origin.X) { starTexture.Draw(starActualPosition - new Vector2(screenWidth, 0f), origin, starColor); } if (starActualPosition.Y < origin.Y) { starTexture.Draw(starActualPosition + new Vector2(0f, screenHeight), origin, starColor); } else if (starActualPosition.Y > screenHeight - origin.Y) { starTexture.Draw(starActualPosition - new Vector2(0f, screenHeight), origin, starColor); } } Draw.SpriteBatch.End(); // draw rays/beams int vertex = 0; for (int j = 0; j < rays.Length; j++) { Vector2 rayPosition = default; rayPosition.X = Mod(rays[j].Position.X - camera.X * 0.9f, screenWidth); rayPosition.Y = Mod(rays[j].Position.Y - camera.Y * 0.9f, screenHeight); DrawRay(rayPosition, ref vertex, ref rays[j]); if (rayPosition.X < 64f) { DrawRay(rayPosition + new Vector2(screenWidth, 0f), ref vertex, ref rays[j]); } else if (rayPosition.X > (screenWidth - 64)) { DrawRay(rayPosition - new Vector2(screenWidth, 0f), ref vertex, ref rays[j]); } if (rayPosition.Y < 64f) { DrawRay(rayPosition + new Vector2(0f, screenHeight), ref vertex, ref rays[j]); } else if (rayPosition.Y > (screenHeight - 64)) { DrawRay(rayPosition - new Vector2(0f, screenHeight), ref vertex, ref rays[j]); } } if (beamsTarget == null) { beamsTarget = VirtualContent.CreateRenderTarget("customizable-glass-block-beams", screenWidth, screenHeight); } Engine.Graphics.GraphicsDevice.SetRenderTarget(beamsTarget); Engine.Graphics.GraphicsDevice.Clear(Color.Transparent); GFX.DrawVertices(Matrix.Identity, verts, vertex); // if fading in, update the alpha value to fade in in ~0.25 seconds. if (alpha != 1f) { alpha = Calc.Approach(alpha, 1f, Engine.DeltaTime * 4f); } }