Exemplo n.º 1
0
        public override void LoadContent(bool firstLoad)
        {
            // Check if the current input GUI override is still valid. If so, apply it.
            if (!string.IsNullOrEmpty(Settings.InputGui))
            {
                string inputGuiPath = $"controls/{Settings.InputGui}/";
                if (GFX.Gui.GetTextures().Any(kvp => kvp.Key.StartsWith(inputGuiPath)))
                {
                    Input.OverrideInputPrefix = Settings.InputGui;
                }
                else
                {
                    Settings.InputGui = "";
                }
            }

            if (firstLoad && !Everest.Flags.AvoidRenderTargets)
            {
                SubHudRenderer.Buffer = VirtualContent.CreateRenderTarget("subhud-target", 1922, 1082);
            }
            if (Everest.Flags.AvoidRenderTargets && Celeste.HudTarget != null)
            {
                Celeste.HudTarget.Dispose();
                Celeste.HudTarget = null;
            }

            if (GFX.MountainTerrain == null && Settings.NonThreadedGL)
            {
                GFX.MountainTerrain   = ObjModel.Create(Path.Combine(Engine.ContentDirectory, "Overworld", "mountain.obj"));
                GFX.MountainBuildings = ObjModel.Create(Path.Combine(Engine.ContentDirectory, "Overworld", "buildings.obj"));
                GFX.MountainCoreWall  = ObjModel.Create(Path.Combine(Engine.ContentDirectory, "Overworld", "mountain_wall.obj"));
            }
            // Otherwise loaded in GameLoader.LoadThread
        }
        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);
        }
        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);
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        public override void LoadContent(bool firstLoad)
        {
            // Check if the current input GUI override is still valid. If so, apply it.
            if (!string.IsNullOrEmpty(Settings.InputGui))
            {
                string inputGuiPath = $"controls/{Settings.InputGui}/";
                if (GFX.Gui.GetTextures().Any(kvp => kvp.Key.StartsWith(inputGuiPath)))
                {
                    Input.OverrideInputPrefix = Settings.InputGui;
                }
                else
                {
                    Settings.InputGui = "";
                }
            }

            if (firstLoad && !Everest.Flags.AvoidRenderTargets)
            {
                SubHudRenderer.Buffer = VirtualContent.CreateRenderTarget("subhud-target", 1922, 1082);
            }
            if (Everest.Flags.AvoidRenderTargets && Celeste.HudTarget != null)
            {
                Celeste.HudTarget.Dispose();
                Celeste.HudTarget = null;
            }
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public void Alloc()
        {
            if (allocated)
            {
                return;
            }
            allocated = true;

            HudTarget = VirtualContent.CreateRenderTarget("hud-target", 1922, 1082);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
            }
        }
Exemplo n.º 10
0
        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);
            }
        }
Exemplo n.º 12
0
 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);
 }
Exemplo n.º 13
0
        public override void LoadContent(bool firstLoad)
        {
            // Check if the current input GUI override is still valid. If so, apply it.
            if (!string.IsNullOrEmpty(Settings.InputGui))
            {
                string inputGuiPath = $"controls/{Settings.InputGui}/";
                if (GFX.Gui.GetTextures().Any(kvp => kvp.Key.StartsWith(inputGuiPath)))
                {
                    Input.OverrideInputPrefix = Settings.InputGui;
                }
                else
                {
                    Settings.InputGui = "";
                }
            }

            if (firstLoad && !Everest.Flags.AvoidRenderTargets)
            {
                SubHudRenderer.Buffer = VirtualContent.CreateRenderTarget("subhud-target", 1922, 1082);
            }
            if (Everest.Flags.AvoidRenderTargets && Celeste.HudTarget != null)
            {
                Celeste.HudTarget.Dispose();
                Celeste.HudTarget = null;
            }

            if (Settings.NonThreadedGL)
            {
                GFX.Load();
                MTN.Load();
                GFX.LoadData();
                MTN.LoadData();
            }
            // Otherwise loaded in GameLoader.LoadThread

            // Celeste 1.3.0.0 gets rid of those.
            for (int i = 0; i <= 29; i++)
            {
                GFX.Game[$"objects/checkpoint/flag{i:D2}"] = GFX.Game["util/pixel"];
            }
            for (int i = 0; i <= 27; i++)
            {
                GFX.Game[$"objects/checkpoint/obelisk{i:D2}"] = GFX.Game["util/pixel"];
            }

            GFX.Gui["fileselect/assist"]    = GFX.Game["util/pixel"];
            GFX.Gui["fileselect/cheatmode"] = GFX.Game["util/pixel"];
        }
Exemplo n.º 14
0
        protected override void LoadContent()
        {
            // Note: You may instinctually call base.LoadContent();
            // DON'T! The original method is orig_LoadContent
            bool firstLoad = this.firstLoad;

            orig_LoadContent();

            if (firstLoad)
            {
                SubHudRenderer.Buffer = VirtualContent.CreateRenderTarget("subhud-target", 1922, 1082);
            }

            Everest.Invoke("LoadContent");
            Everest.Invoke("LoadContent", firstLoad);
        }
        public IEnumerator Enter()
        {
            PageIndex         = 0;
            Visible           = true;
            X                 = -1920f;
            turningPage       = false;
            turningScale      = 1f;
            rotation          = 0f;
            dot               = 0f;
            dotTarget         = 0f;
            dotEase           = 0f;
            leftArrowEase     = 0f;
            rightArrowEase    = 0f;
            NextPageBuffer    = VirtualContent.CreateRenderTarget("journal-a", 1610, 1000, false, true, 0);
            CurrentPageBuffer = VirtualContent.CreateRenderTarget("journal-b", 1610, 1000, false, true, 0);

            int num = 0;

            foreach (CustomJournalPage CustomJournalPage in Pages)
            {
                CustomJournalPage.PageIndex = num++;
            }
            Pages[0].Redraw(CurrentPageBuffer);
            //this.cameraStart = this.Overworld.Mountain.UntiltedCamera;
            //this.cameraEnd = this.cameraStart;
            //this.cameraEnd.Position = this.cameraEnd.Position + -this.cameraStart.Rotation.Forward() * 1f;
            //this.Overworld.Mountain.EaseCamera(this.Overworld.Mountain.Area, this.cameraEnd, new float?(2f), true, false);
            //this.Overworld.Mountain.AllowUserRotation = false;
            for (float p = 0f; p < 1f; p += Engine.DeltaTime / 0.4f)
            {
                rotation = -0.025f * Ease.BackOut(p);
                X        = -1920f + 1920f * Ease.CubeInOut(p);
                dotEase  = p;
                yield return(null);
            }
            dotEase = 1f;
            yield break;
        }
Exemplo n.º 16
0
 public override void Awake(Scene scene)
 {
     base.Awake(scene);
     renderTarget = VirtualContent.CreateRenderTarget("madelineparty-better-textmenu", Crop.Width, Crop.Height);
 }
 private void BeforeRender()
 {
     if (loading)
     {
         return;
     }
     if (screenBuffer == null || screenBuffer.IsDisposed)
     {
         screenBuffer = VirtualContent.CreateRenderTarget("WaveDash-Buffer", ScreenWidth, ScreenHeight, true, true, 0);
     }
     if (prevPageBuffer == null || prevPageBuffer.IsDisposed)
     {
         prevPageBuffer = VirtualContent.CreateRenderTarget("WaveDash-Screen1", ScreenWidth, ScreenHeight, false, true, 0);
     }
     if (currPageBuffer == null || currPageBuffer.IsDisposed)
     {
         currPageBuffer = VirtualContent.CreateRenderTarget("WaveDash-Screen2", ScreenWidth, ScreenHeight, false, true, 0);
     }
     if (pageTurning && PrevPage != null)
     {
         Engine.Graphics.GraphicsDevice.SetRenderTarget(prevPageBuffer);
         Engine.Graphics.GraphicsDevice.Clear(PrevPage.ClearColor);
         Draw.SpriteBatch.Begin();
         PrevPage.Render();
         Draw.SpriteBatch.End();
     }
     if (CurrPage != null)
     {
         Engine.Graphics.GraphicsDevice.SetRenderTarget(currPageBuffer);
         Engine.Graphics.GraphicsDevice.Clear(CurrPage.ClearColor);
         Draw.SpriteBatch.Begin();
         CurrPage.Render();
         Draw.SpriteBatch.End();
     }
     Engine.Graphics.GraphicsDevice.SetRenderTarget(screenBuffer);
     Engine.Graphics.GraphicsDevice.Clear(Color.Black);
     if (pageTurning)
     {
         if (CurrPage.Transition == WallbouncePresentationPage.Transitions.ScaleIn)
         {
             Draw.SpriteBatch.Begin();
             Draw.SpriteBatch.Draw(prevPageBuffer, Vector2.Zero, Color.White);
             Vector2 scale = Vector2.One * pageEase;
             Draw.SpriteBatch.Draw(currPageBuffer, ScaleInPoint, new Rectangle?(currPageBuffer.Bounds), Color.White, 0f, ScaleInPoint, scale, SpriteEffects.None, 0f);
             Draw.SpriteBatch.End();
             return;
         }
         if (CurrPage.Transition == WallbouncePresentationPage.Transitions.FadeIn)
         {
             Draw.SpriteBatch.Begin();
             Draw.SpriteBatch.Draw(prevPageBuffer, Vector2.Zero, Color.White);
             Draw.SpriteBatch.Draw(currPageBuffer, Vector2.Zero, Color.White * pageEase);
             Draw.SpriteBatch.End();
             return;
         }
         if (CurrPage.Transition == WallbouncePresentationPage.Transitions.Rotate3D)
         {
             float num = -1.57079637f * pageEase;
             RenderQuad(prevPageBuffer, pageEase, num);
             RenderQuad(currPageBuffer, pageEase, 1.57079637f + num);
             return;
         }
         if (CurrPage.Transition == WallbouncePresentationPage.Transitions.Blocky)
         {
             Draw.SpriteBatch.Begin();
             Draw.SpriteBatch.Draw(prevPageBuffer, Vector2.Zero, Color.White);
             uint num2 = 1u;
             int  num3 = ScreenWidth / 60;
             for (int i = 0; i < ScreenWidth; i += num3)
             {
                 for (int j = 0; j < ScreenHeight; j += num3)
                 {
                     if (WaveDashPresentation.PseudoRandRange(ref num2, 0f, 1f) <= pageEase)
                     {
                         Draw.SpriteBatch.Draw(currPageBuffer, new Rectangle(i, j, num3, num3), new Rectangle?(new Rectangle(i, j, num3, num3)), Color.White);
                     }
                 }
             }
             Draw.SpriteBatch.End();
             return;
         }
         if (CurrPage.Transition == WallbouncePresentationPage.Transitions.Spiral)
         {
             Draw.SpriteBatch.Begin();
             Draw.SpriteBatch.Draw(prevPageBuffer, Vector2.Zero, Color.White);
             Vector2 scale2   = Vector2.One * pageEase;
             float   rotation = (1f - pageEase) * 12f;
             Draw.SpriteBatch.Draw(currPageBuffer, Celeste.Celeste.TargetCenter, new Rectangle?(currPageBuffer.Bounds), Color.White, rotation, Celeste.Celeste.TargetCenter, scale2, SpriteEffects.None, 0f);
             Draw.SpriteBatch.End();
             return;
         }
     }
     else
     {
         Draw.SpriteBatch.Begin();
         Draw.SpriteBatch.Draw(currPageBuffer, Vector2.Zero, Color.White);
         Draw.SpriteBatch.End();
     }
 }
        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);
            }
        }