protected virtual void draw_units(SpriteBatch spriteBatch)
        {
            Vector2 offset = this.loc + draw_vector();

            // Map sprite (first one, if not scrolling)
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            if (Scroll < UnitNodes.Count() && Offset.Y == Scroll * this.RowSize)
            {
                int scroll = Scroll * this.Columns;
                UnitNodes.Draw(spriteBatch,
                               Enumerable.Range(scroll,
                                                Math.Min(UnitNodes.Count - scroll, this.Columns)),
                               Offset - offset);
            }
            spriteBatch.End();

            // Draw other units
            spriteBatch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Unit_Scissor_Rect);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, Scissor_State);

            var visible_range = visible_indexes_range();

            if (visible_range.IsValid())
            {
                UnitNodes.Draw(spriteBatch, visible_range.Enumerate(),
                               Offset - offset);
            }

            spriteBatch.End();
        }
        public void draw(SpriteBatch sprite_batch)
        {
            Vector2 offset = this.loc + draw_vector();

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            // Window
            draw_window(sprite_batch);
            // Scroll Bar
            if (Scrollbar != null)
            {
                Scrollbar.draw(sprite_batch, -offset);
            }
            sprite_batch.End();

            // Map Sprites
            draw_units(sprite_batch);

            sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Unit_Scissor_Rect);
            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, Scissor_State);
            draw_selected_cursor(sprite_batch);
            sprite_batch.End();

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            if (Active)
            {
                UnitCursor.draw(sprite_batch, -draw_vector());
            }
            sprite_batch.End();
        }
Example #3
0
        protected override void draw_window(SpriteBatch sprite_batch)
        {
            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            // Scroll Bar
            if (Scrollbar != null)
            {
                Scrollbar.draw(sprite_batch);
            }
            Description_Window.draw(sprite_batch);
            Description.draw(sprite_batch);
            CancelButton.Draw(sprite_batch);
            Banner.draw(sprite_batch);
            Banner_Text.draw(sprite_batch);
            sprite_batch.End();
            // Labels
            sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Data_Scissor_Rect);
            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, Scissor_State);
            OptionsNodes.Draw(sprite_batch, Offset);
            SettingsNodes.Draw(sprite_batch, Offset);

            if (on_soloanim && SoloAnim_Allowed)
            {
                Solo_Icon.draw(sprite_batch);
            }
            sprite_batch.End();

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            // Cursor
            OptionsCursor.draw(sprite_batch);
            SettingsCursor.draw(sprite_batch);
            // Page Arrows
            Up_Page_Arrow.draw(sprite_batch);
            Down_Page_Arrow.draw(sprite_batch);
            sprite_batch.End();
        }
        public override Rectangle scissor_rect()
        {
            Rectangle rect = base.scissor_rect();

            rect.Y      += (int)Text_Offset.Y;
            rect.Height -= (int)Text_Offset.Y;
            return(Scene_Map.fix_rect_to_screen(rect));
        }
        public virtual Rectangle scissor_rect()
        {
            int       width = Window_Img == null ? this.Width : Window_Img.width;
            Rectangle rect  = new Rectangle((int)loc.X + 8, (int)loc.Y + 8, width - 16, Rows * 16);

            rect.X      += 0;
            rect.Y      += 0;
            rect.Width  += (int)(Size_Offset.X - 0);
            rect.Height += (int)(Size_Offset.Y - 0);
            return(Scene_Map.fix_rect_to_screen(rect));
        }
Example #6
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (DataDisplayed)
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                Background.draw(spriteBatch);
                if (Scrollbar != null)
                {
                    Scrollbar.draw(spriteBatch);
                }
                spriteBatch.End();


                RasterizerState scissorState = new RasterizerState {
                    ScissorTestEnable = true
                };
                Rectangle textClip = new Rectangle(
                    (int)BASE_OFFSET.X, (int)BASE_OFFSET.Y,
                    Config.WINDOW_WIDTH - (int)(BASE_OFFSET.X * 2),
                    Config.WINDOW_HEIGHT - (int)(BASE_OFFSET.Y * 2));
                spriteBatch.GraphicsDevice.ScissorRectangle =
                    Scene_Map.fix_rect_to_screen(textClip);

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, scissorState);
                foreach (var text in CreditsText)
                {
                    text.draw(spriteBatch, ScrollOffset - BASE_OFFSET);
                }
                spriteBatch.End();

                if (FullCreditsButton != null)
                {
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                    FullCreditsButton.Draw(spriteBatch);
                    spriteBatch.End();
                }
            }

            base.Draw(spriteBatch);
        }
        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();
                }
            }
        }