예제 #1
0
        public void DrawIcons(Camera camera)
        {
            float offset = 0.0f;

            if (icons_top.Count != 0)
            {
                foreach (MarkerIcon icon in icons_top) { offset += icon.center.X; }
                foreach (MarkerIcon icon in icons_top)
                {
                    offset -= icon.center.X;
                    Vector2 position = camera.Map(pos + new Vector2(0, -radius)) - new Vector2(offset, ICON_HEIGHT_OFFSET + line_thickness + (icon.center.Y));
                    icon.Draw(camera, position);
                    offset -= icon.center.X;
                }
            }

            if (icons_bot.Count != 0)
            {

                offset = 0.0f;
                foreach (MarkerIcon icon in icons_bot) { offset += icon.center.X; }
                foreach (MarkerIcon icon in icons_bot)
                {
                    offset -= icon.center.X;
                    Vector2 position = camera.Map(pos + new Vector2(0, radius)) - new Vector2(offset, -ICON_HEIGHT_OFFSET - line_thickness - (icon.center.Y));
                    icon.Draw(camera, position);
                    offset -= icon.center.X;
                }
            }
        }
예제 #2
0
 public void Draw( Camera camera )
 {
     foreach (Entity ent in entities)
     {
         ent.Draw(camera);
     }
 }
예제 #3
0
        public override void Draw(Camera camera)
        {
            fill = Utility.Clamp(fill, 0.0f, 1.0f);
            Vector2 length = Utility.CosSin(angle) * size.X;
            Vector2 posm = camera.Map(pos);
            Vector2 mid = camera.Map(pos + length * fill);
            Vector2 end = camera.Map(pos + length);

            ArtPrimitive.DrawLine(posm, mid, full_color, size.Y);
            ArtPrimitive.DrawLine(mid, end, empty_color, size.Y);
        }
예제 #4
0
        /// LoadContent will be called once per game
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            camera = new Camera(GraphicsDevice, spriteBatch, window_res_x, window_res_y);

            ArtManager.sprites.Add("ship", new ArtSpriteResource("ship", 0.2f));
            ArtManager.Load(Content);

        }
예제 #5
0
        public override void Draw(Camera camera)
        {
            if (!InView(camera)) { return; }

            Vector2 center = camera.Map(pos);
            
            if (radius < minimum_radius * camera.ui_feature_scale)
            {
                DrawCenter(camera, center, line_color, minimum_radius * camera.ui_feature_scale);
            }
            else
            {
                DrawCenter(camera, center, fill_color, radius * camera.scale);
                ArtPrimitive.DrawPolyLine(center, radius * camera.scale, n, line_color, line_thickness * camera.ui_feature_scale, angle, dashing);
            }

            DrawIcons(camera);
        }
예제 #6
0
 public void DrawCenter(Camera camera, Vector2 center, Color color, float internal_radius)
 {
     if (n == 3)
     {
         ArtPrimitive.DrawTriangle(center, new Vector2(internal_radius, internal_radius), color, angle);
     }
     else if (n == 4)
     {
         ArtPrimitive.DrawSquare(center, new Vector2(internal_radius, internal_radius), color, angle + MathHelper.PiOver4);
     }
     else if (n == 5)
     {
         ArtPrimitive.DrawPentagon(center, new Vector2(internal_radius, internal_radius), color, angle + MathHelper.TwoPi/5.0f);
     }
 }
예제 #7
0
        public void Draw( Camera camera)
        {
           

            foreach (Physical phys in physicals)
            {
                phys.Draw(camera);
            }

            foreach (Projectile proj in projectiles)
            {
                proj.Draw(camera);
            }

            foreach (ArtTemporary temp in art_temp)
            {
                temp.Draw(camera);
            }

            if ( camera.DRAW_HITBOXES )
            {
                foreach (Physical phys in physicals)
                {
                    phys.DrawHitbox(camera);
                }
            }
        }
예제 #8
0
        public void Draw(Camera camera, float line_width)
        {
            for (int i = 0; i < armor.segment_count; i++)
            {
                Color color = ColorManager.HPColor(armor.integrity[i] / armor.max_integrity);
                List<Vector2> segments = nodes[i];

                int segment_count = nodes[i].Count - 1;

                Vector2 st = camera.Map(segments[0]);
                for (int k = 0; k < segment_count; k++)
                {
                    Vector2 en = camera.Map(segments[k + 1]);
                    ArtPrimitive.DrawLine(st, en, color, line_width * camera.ui_feature_scale);

                    if (k < segment_count - 1)
                    {
                        ArtPrimitive.DrawCircle(en, color, line_width * camera.ui_feature_scale / 2.0f);
                        st = en;
                    }
                }
            }
        }
예제 #9
0
        public override void Draw(Camera camera)
        {
            if (!InView(camera)) { return; }


            int i = index_start;
            int c = index_end - index_start;
            if (c < 0) { c += count; }

            while (c > 0)
            {
                Color k = ColorManager.GetThermo(temp[i]);
                this.DrawParticle(camera, i, k);

                c--;
                i++;
                if (i >= count) { i = 0; }
            }
        }
예제 #10
0
파일: Art.cs 프로젝트: Hoppelite/StarPixel
        public bool InView( Camera camera )
        {
            Vector2 onscreen = camera.Map(pos);
            float cull_radius = resource.radius * camera.scale;

            return onscreen.X + cull_radius > 0 &&
                   onscreen.Y + cull_radius > 0 &&
                   onscreen.X - cull_radius < camera.res.X &&
                   onscreen.Y - cull_radius < camera.res.Y;
        }
예제 #11
0
        public override void Draw(Camera camera)
        {
            pos = camera.Map(phys.pos);

            float scaled_line_width = line_width * camera.ui_feature_scale;

            float angle = phys.angle;
            float armor_bar_radius = radius * camera.scale;
            float shield_bar_radius = armor_bar_radius + (scaled_line_width * 2);
            
            float m_radius = MINIMUM_RADIUS * camera.ui_feature_scale;
            bool compact_view = shield_bar_radius < m_radius;
            
            
            if (phys.shield != null)
            {
                float s_integrity = phys.shield.integrity / phys.shield.max_integrity;

                if (compact_view)
                {
                    if (phys.shield.active)
                    {
                        Color shcolor = Color.Lerp(Color.Black, ColorManager.shield_color, s_integrity);
                        ArtPrimitive.DrawCircle(pos, shcolor, m_radius);
                    }
                }
                else
                {
                    Color shcolor = (phys.shield.active) ? ColorManager.shield_color : ColorManager.dead_shield_color;
                    ArtPrimitive.DrawArc(pos, -MathHelper.PiOver2, MathHelper.TwoPi * s_integrity, shield_bar_radius, shcolor, scaled_line_width);
                }
            }

            if (phys.armor != null)
            {
                if (compact_view)
                {
                    float a_integrity = 0.0f;
                    for (int i = 0; i < phys.armor.segment_count; i++)
                    {
                        a_integrity += phys.armor.integrity[i] / phys.armor.max_integrity;
                    }
                    a_integrity /= phys.armor.segment_count;

                    ArtPrimitive.DrawCircleTag(pos, m_radius * 0.9f, ColorManager.HPColor(a_integrity), phys.angle);

                }
                else
                {
                    float a1 = phys.armor.start_angle + angle;
                    a1 = Utility.WrapAngle(a1);

                    for (int i = 0; i < phys.armor.segment_count; i++)
                    {
                        float a2 = a1 + phys.armor.per_segment_angle;

                        float k = phys.armor.integrity[i] / phys.armor.max_integrity;
                        
                        ArtPrimitive.DrawArc(pos, a1 + armor_bar_sep, phys.armor.per_segment_angle - (2 * armor_bar_sep),
                                armor_bar_radius, ColorManager.HPColor(k), scaled_line_width);
                        

                        a1 = a2;
                    }
                }
            }
        }
예제 #12
0
 public virtual bool InView(Camera camera)
 {
     return false;
 }
예제 #13
0
 public void Draw(Camera camera)
 {
     art.Draw(camera);
 }
예제 #14
0
 public virtual void DrawHitbox(Camera camera)
 {
     hitbox.Draw(camera, Color.Red, 4.0f);
 }
예제 #15
0
        public void Draw(Camera camera)
        {
            if (!InView(camera)) { return; }


            for (int i = 0; i < count; i++)
            {

                Vector2 ppos = camera.Map( pos + Utility.CosSin(angle[i], depth[i]) );

                if (alpha[i] > 0.05)
                {
                    //Color k = color * alpha[i];
                    Color k = Color.Lerp(resource.particle_color_end, resource.particle_color_start, alpha[i]) * alpha[i];
                    camera.batch.Draw(resource.sprite, ppos, null, k, angle[i], resource.sprite_center, size[i] * new Vector2(0.3f, 1.0f) * camera.scale, SpriteEffects.None, 0);
                }
            }
        }
예제 #16
0
 public bool InView(Camera camera)
 {
     // shield not visible if alpha very low
     if (total_alpha < 0.05) { return false; }
     return camera.ContainsCircle(pos, radius);
 }
예제 #17
0
        public override void Draw(Camera camera)
        {
            DoubleCheckSubMarkers();
            
            radius = (startpoint.pos - endpoint.pos).Length() / 2.0f;
            pos = (startpoint.pos + endpoint.pos) / 2.0f;
            
            if (InView(camera))
            {
                Vector2 line_vector = (endpoint.pos - startpoint.pos);
                
                if (line_vector != Vector2.Zero) // if the startpoint and endpoint are set to the same, then line_vector.normalize fails
                {

                    line_vector.Normalize();
                    float angle = Utility.Angle(line_vector);

                    Vector2 st = startpoint.pos + (startpoint.LineRadius(camera.scale, angle) * line_vector);
                    Vector2 en = endpoint.pos - (endpoint.LineRadius(camera.scale, angle - MathHelper.TwoPi) * line_vector);

                    if (Utility.Dot(en - st, line_vector) > 0.0f)
                    {
                        float line_width = camera.ui_feature_scale * line_thickness *2.0f / (line_count + 1.0f);

                        if (line_count < 1) { line_count = 1; }
                        else if (line_count > 3) { line_count = 3; } // make sure its in range

                        else if (line_count == 1 || line_count == 3) // odd numbers get a center line
                        {
                            ArtPrimitive.DrawLine(camera.Map(st), camera.Map(en), line_color, line_width);
                        }
                        
                        if (line_count > 1) // two and three get edge lines
                        {
                            Vector2 delta = Utility.RotatePos(line_vector) * line_width * (line_count == 2 ? 1f: 2f);
                            ArtPrimitive.DrawLine(camera.Map(st) + delta, camera.Map(en) + delta, line_color, line_width);
                            ArtPrimitive.DrawLine(camera.Map(st) - delta, camera.Map(en) - delta, line_color, line_width);
                        }

                    }
                }
            }

            if (draw_startpoint) { startpoint.Draw(camera); }
            if (draw_endpoint) { endpoint.Draw(camera); }
        }
예제 #18
0
파일: Art.cs 프로젝트: Hoppelite/StarPixel
        public void Draw( Camera camera )
        {
            if (!InView(camera)) { return; }

            camera.batch.Draw(resource.sprite, camera.Map(pos), null, Color.White, angle, resource.center, camera.scale * resource.scale, SpriteEffects.None, 0);
            
        }
예제 #19
0
 public void Draw(Camera camera, Vector2 position)
 {
     // scale divided by 2, because there was a bug, and now im used to that size
     tile_sheet.Draw(camera.batch, symbol_no, position, camera.ui_feature_scale * scale / 2.0f, color);
 }
예제 #20
0
 public override bool InView(Camera camera)
 {
     return camera.ContainsCircle(pos, radius * camera.ui_feature_scale);
 }
예제 #21
0
        public void DrawParticle(Camera camera, int i, Color color)
        {
            Color k = color*alpha[i];
            Vector2 transform = (particle_size_0 + (particle_size_1 * alpha[i]));
            transform *= scale[i];

            camera.batch.Draw(resource.sprite, camera.Map(position[i]), null, k, angle[i], resource.sprite_center, transform * (camera.scale), SpriteEffects.None, 0);
        }
예제 #22
0
        public override void Draw(Camera camera)
        {
            if (!InView(camera)) { return; }

            if (icon == null)
            {
                ArtPrimitive.DrawCircle(camera.Map(pos), line_color, radius * camera.ui_feature_scale);
            }
            else
            {
                icon.Draw(camera, camera.Map(pos));
            }

            DrawIcons(camera);
        }
예제 #23
0
 public override bool InView(Camera camera)
 {
     if (camera.scale * particle_Radius < GameConst.minimum_draw_radius) { return false; }
     
     // if index_start == index_end we have no particles left!
     if (index_start != index_end)
     {
         int index_recent = index_end == 0 ? count - 1 : index_end - 1;
         // get the position of the most recent particle....
         return camera.ContainsCircle(position[index_recent], radius);
     }
     return false;
 }
예제 #24
0
 public override void Draw(Camera camera)
 {
     Vector2 center = camera.Map(origin);
     ArtPrimitive.DrawArc(center, start_angle, delta_angle * fill, radius, full_color, size.Y, segments_per_2pi:64);
     ArtPrimitive.DrawArc(center, end_angle, delta_angle * (fill - 1), radius, empty_color, size.Y, segments_per_2pi:64);
 }
예제 #25
0
        public virtual void Draw(Camera camera)
        {

        }
예제 #26
0
 public override bool InView(Camera camera)
 {
     return (camera.scale * particle_Radius > GameConst.minimum_draw_radius) && this.Visible() && camera.ContainsCircle(center, radius);
 }
예제 #27
0
        public override void Draw(Camera camera)
        {
            if (!InView(camera)) { return; }

            Vector2 center = camera.Map(pos);
            
            if (radius < minimum_radius * camera.ui_feature_scale)
            {
                ArtPrimitive.DrawCircle(center, line_color, minimum_radius * camera.ui_feature_scale);
            }
            else
            {
                ArtPrimitive.DrawCircle(center, fill_color, radius * camera.scale);

                if (line_color != Color.Transparent)
                {
                    ArtPrimitive.DrawCircleLine(center, radius * camera.scale, line_color, line_thickness * camera.ui_feature_scale, dashing);
                }
            }

            DrawIcons(camera);
        }
예제 #28
0
        public override void Draw(Camera camera)
        {
            if (!InView(camera)) { return; }

            if (resource.coloring_method == ParticleColoring.Blend)
            {
                for (int i = 0; i < count; i++)
                {
                    if (alpha[i] > 0)
                    {
                        Color k = Color.Lerp(resource.particle_color_end, resource.particle_color_start, alpha[i]);
                        this.DrawParticle(camera, i, k);
                    }
                }
            }
            else if (resource.coloring_method == ParticleColoring.Temp)
            {
                for (int i = 0; i < count; i++)
                {
                    if (alpha[i] > 0)
                    {
                        Color k = ColorManager.GetThermo(temp[i]);
                        this.DrawParticle(camera, i, k);
                    }
                }
            }

        }
예제 #29
0
파일: Ship.cs 프로젝트: Hoppelite/StarPixel
 public override void Draw(Camera camera)
 {
     hull_sprite.Draw(camera);
 }
예제 #30
0
 public virtual bool InView(Camera camera)
 {
     return camera.ContainsCircle(pos, radius);
 }