private void UpdateGraphics()
        {
            Sigil.update();
            Banner.update();
            Banner_Bg.update();
            Black_Fill.update();
            Text.update();

            if (AlternateTitle != null)
            {
                AlternateTitle.Update();
            }
        }
Ejemplo n.º 2
0
 protected void draw_background(SpriteBatch sprite_batch)
 {
     if (Background != null)
     {
         sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
         Black_Backing.draw(sprite_batch);
         Background.draw(sprite_batch);
         sprite_batch.End();
     }
     if (Black_Fill != null && !level_up_layer_resort())
     {
         sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
         Black_Fill.draw(sprite_batch);
         sprite_batch.End();
     }
 }
Ejemplo n.º 3
0
        private void draw_masked_screen_darken(SpriteBatch sprite_batch, Effect battle_shader, Texture2D render)
        {
            // Draws the render normally
            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            sprite_batch.Draw(render, Vector2.Zero, Color.White);
            sprite_batch.End();

            if (Black_Fill == null || !level_up_layer_resort())
            {
                return;
            }

            // Uses the render as a mask and draws a black screen
            if (battle_shader != null)
            {
                battle_shader.CurrentTechnique = battle_shader.Techniques["Mask"];
                battle_shader.Parameters["mask_rect"].SetValue(new Vector4(0, 0, render.Width, render.Height) /
                                                               new Vector4(render.Width, render.Height,
                                                                           render.Width, render.Height));
                Vector2 mask_size_ratio = new Vector2(Config.WINDOW_WIDTH / (float)render.Width,
                                                      Config.WINDOW_HEIGHT / (float)render.Height);
                battle_shader.Parameters["mask_size_ratio"].SetValue(Vector2.One / mask_size_ratio);
                Vector2 sprite_offset = Vector2.Zero; //(Map_Sprites[Global.game_map.new_turn_unit_id].offset +
                //new Vector2(Map_Sprites[Global.game_map.new_turn_unit_id].src_rect.X, Map_Sprites[Global.game_map.new_turn_unit_id].src_rect.Y)) /
                //new Vector2(render.Width, render.Height);
                Vector2 effect_offset = Vector2.Zero; //Status_Heal.offset /
                //new Vector2(Status_Heal.src_rect.Width, Status_Heal.src_rect.Height);
                battle_shader.Parameters["alpha_offset"].SetValue(-(effect_offset * mask_size_ratio - sprite_offset));

#if __ANDROID__
                // There has to be a way to do this for both
                battle_shader.Parameters["Map_Alpha"].SetValue(render);
#else
                sprite_batch.GraphicsDevice.Textures[1] = render;
#endif
                sprite_batch.GraphicsDevice.SamplerStates[1] = SamplerState.PointClamp; //Yeti
            }

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
                               SamplerState.PointClamp, null, null, battle_shader);
            Black_Fill.draw(sprite_batch);
            sprite_batch.End();
        }
        public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2))
        {
            if (texture != null)
            {
                if (visible)
                {
                    // Background/Sigil
                    sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    Rectangle src_rect = this.src_rect;
                    Vector2   offset   = this.offset;
                    if (mirrored)
                    {
                        offset.X = src_rect.Width - offset.X;
                    }
                    for (int y = 0; y < Loop; y++)
                    {
                        for (int x = 0; x < Loop; x++)
                        {
                            sprite_batch.Draw(texture, loc + draw_vector() + new Vector2(x * Bmp_Width, y * Bmp_Width),
                                              src_rect, tint, angle, offset, scale,
                                              mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z);
                        }
                    }
                    Sigil.draw(sprite_batch);
                    Banner_Bg.draw(sprite_batch);
                    sprite_batch.End();

                    // Banner
                    Effect text_shader = Global.effect_shader();
                    if (text_shader != null)
                    {
                        text_shader.CurrentTechnique = text_shader.Techniques["Technique2"];
                        text_shader.Parameters["color_shift"].SetValue(Banner_Color.ToVector4());
                    }
                    sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Text_Scissor_Rect);
                    if (sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0 && sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0)
                    {
                        sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, Text_State, text_shader);
                        Banner.draw(sprite_batch);
                        sprite_batch.End();
                    }
                    // Text
                    if (text_shader != null)
                    {
                        text_shader.CurrentTechnique = text_shader.Techniques["Technique2"];
                        text_shader.Parameters["color_shift"].SetValue(Text_Color.ToVector4());
                    }
                    sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Text_Scissor_Rect);
                    if (sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0 && sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0)
                    {
                        sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, Text_State, text_shader);
                        Text.draw(sprite_batch);
                        sprite_batch.End();
                    }

                    // Alternate Title
                    if (AlternateTitle != null)
                    {
                        AlternateTitle.Draw(sprite_batch);
                    }

                    sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    // Black screen
                    Black_Fill.draw(sprite_batch);
                    sprite_batch.End();
                }
            }
        }