public void Draw(BaseCharacter character, SpriteBatch spriteBatch, BaseCamera camera)
 {
     this.DrawUnder (character, spriteBatch, camera);
     this.DrawBase (character, spriteBatch, camera);
     this.DrawMiddle (character, spriteBatch, camera);
     this.DrawTop (character, spriteBatch, camera);
 }
        private void DrawMiddle(BaseCharacter character, SpriteBatch spriteBatch, BaseCamera camera)
        {
            Vector2 location = new Vector2 ();
            location.X = (int)camera.Offset.X + character.Location.X + 32 / 2 - character.CurrentAnimation.FrameRectangle.Width / 2;
            location.Y = (int) camera.Offset.Y + character.Location.Y + 32 - character.CurrentAnimation.FrameRectangle.Height;

            spriteBatch.Draw (character.Sprite, location, character.CurrentAnimation.FrameRectangle, Color.White);
        }
        private void DrawTop(BaseCharacter character, SpriteBatch spriteBatch, BaseCamera camera)
        {
            Vector2 location = new Vector2 ();
            location.X = (int)camera.Offset.X + character.Location.X + 32 / 2 - character.CurrentAnimation.FrameRectangle.Width / 2;
            location.Y = (int)camera.Offset.Y + character.Location.Y + 32 - character.CurrentAnimation.FrameRectangle.Height;

            Color color = ((character.IsTalking) ? Color.Red : Color.Black);

            if(character is PokeCharacter)
            {
                string name = ((PokeCharacter) character).Name;
                spriteBatch.DrawString (PokeGame.font, name, new Vector2 (location.X - (PokeGame.font.MeasureString (name).X / 2) + 16, location.Y - 15), color);
            }
        }
 public void DrawLayer(BaseCharacter character, SpriteBatch spriteBatch, BaseCamera camera, MapLayers layer)
 {
     switch (layer)
     {
         case MapLayers.UnderLayer:
             this.DrawUnder (character, spriteBatch, camera);
             break;
         case MapLayers.BaseLayer:
             this.DrawBase (character, spriteBatch, camera);
             break;
         case MapLayers.MiddleLayer:
             this.DrawMiddle (character, spriteBatch, camera);
             break;
         case MapLayers.TopLayer:
             this.DrawTop (character, spriteBatch, camera);
             break;
     }
 }
Ejemplo n.º 5
0
 public BaseCamera(BaseCamera camera)
 {
     this.SetCamera(camera);
 }
Ejemplo n.º 6
0
        public void SetCamera(BaseCamera cam)
        {
            this.screen = new Rectangle(cam.Screen.X, cam.Screen.Y, cam.Screen.Width, cam.Screen.Height);
            this.halfscreen = new ScreenPoint(screen.Width / 2, screen.Height / 2);

            this.mapoffset = new ScreenPoint(cam.Location.X, cam.Location.Y);
        }
Ejemplo n.º 7
0
 public void Draw(BaseCamera camera)
 {
     camera.Location = new ScreenPoint(this.CurrentLocation.X * -1, this.CurrentLocation.Y * -1);
 }
Ejemplo n.º 8
0
 public void RenderFog(SpriteBatch batch, BaseCamera camera, List<Rectangle> infos, MapPoint rayorigin)
 {
 }
Ejemplo n.º 9
0
        public void BeginScene(BaseCamera camera)
        {
            Check.NullArgument<BaseCamera>(camera, "camera");

            currentcamera = camera;
            device.Viewport = currentcamera.Viewport;
            spritebatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullCounterClockwise,  null, currentcamera.TransformMatrix);

            this.isstarted = true;
        }
Ejemplo n.º 10
0
        private void DrawPass(SpriteBatch spriteBatch, BaseCamera camera, RenderFlags flags)
        {
            foreach (var header in this.context.WorldManager.GetWorld(camera.WorldName).Maps.Values)
            {
                if (!header.IsVisible(camera))
                    continue;

                // Draw under
                this.DrawLayerMap(spriteBatch, camera, MapLayers.UnderLayer);
                this.renderers[MapLayers.UnderLayer].ForEach(r => r.Draw(spriteBatch));

                // Draw base
                this.DrawLayerMap(spriteBatch, camera, MapLayers.BaseLayer);
                this.renderers[MapLayers.BaseLayer].ForEach(r => r.Draw(spriteBatch));

                // Draw middle
                this.DrawLayerMap(spriteBatch, camera, MapLayers.MiddleLayer);

                if ((flags & RenderFlags.NoPlayers) != RenderFlags.NoPlayers)
                {
                    foreach (BaseCharacter player in this.Players.GetItems().Values)
                        this.DrawPlayer (player);
                }

                this.renderers[MapLayers.MiddleLayer].ForEach(r => r.Draw(spriteBatch));

                //Draw top
                this.DrawLayerMap(spriteBatch, camera, MapLayers.TopLayer);
                this.renderers[MapLayers.TopLayer].ForEach(r => r.Draw(spriteBatch));
            }
        }
Ejemplo n.º 11
0
        private void DrawLayerMap(SpriteBatch spriteBatch, BaseCamera camera, MapLayers layer, MapHeader header, Color tint)
        {
            Check.NullArgument(spriteBatch, "spriteBatch");
            Check.NullArgument(header, "header");

            Map currentMap = header.Map;
            ScreenPoint camOffset = ScreenPoint.Zero;// camera.Offset;
            int tileSize = currentMap.TileSize;

            for (int y = 0; y < currentMap.MapSize.Y; y++)
            {
                for (int x = 0; x < currentMap.MapSize.X; x++)
                {
                    ScreenPoint pos = new MapPoint(x, y).ToScreenPoint() + camOffset + header.MapLocation.ToScreenPoint();
                    Rectangle des = new Rectangle(pos.IntX, pos.IntY, tileSize, tileSize);
                    MapPoint point = new MapPoint(x, y);

                    if (!camera.CheckIsVisible(des))
                        continue;

                    // Opaque only and not opaque
                    var opacity = currentMap.GetLayerValue(point, MapLayers.OpaqueLayer);

                    if (opacity >= 1)
                    {
                        var info = new Rectangle()
                        {
                            X = pos.IntX,
                            Y = pos.IntY,
                            Width = tileSize,
                            Height = tileSize
                        };

                        if(!this.lastfoginfos.Contains(info))
                            this.lastfoginfos.Add(info);
                    }

                    Rectangle sourceRectangle = currentMap.GetLayerSourceRect(point, layer);

                    if (sourceRectangle.IsEmpty)
                        continue;

                    spriteBatch.Draw(currentMap.Texture, des, sourceRectangle, tint);
                }
            }
        }
Ejemplo n.º 12
0
        private void DrawLayerMap(SpriteBatch spriteBatch, BaseCamera camera, MapLayers layer)
        {
            if(camera.CurrentMap == null)
                ResolvePositionableCurrentMap(camera);

            this.DrawLayerMap(spriteBatch, camera, layer, camera.CurrentMap, Color.White);
        }
Ejemplo n.º 13
0
 private void DrawCamera(SpriteBatch spriteBatch, BaseCamera camera, RenderFlags flags)
 {
     DrawPass(spriteBatch, camera, flags); // Draw only non opaque
 }
Ejemplo n.º 14
0
        public void EndScene()
        {
            currentcamera = null;
            spritebatch.End();

            this.isstarted = false;
        }
Ejemplo n.º 15
0
 public TweenEffect(BaseCamera camera, ScreenPoint endpoint, int time)
     : this(new ScreenPoint((int)camera.Location.X * -1, (int)camera.Location.Y * -1), endpoint, time)
 {
 }
 private void DrawUnder(BaseCharacter character, SpriteBatch spriteBatch, BaseCamera camera)
 {
 }
Ejemplo n.º 17
0
 public ValkyrieCamera(BaseCamera camera)
     : base(camera)
 {
 }