示例#1
0
文件: Graphics.cs 项目: Kukks/CryBits
    private static void Editor_Maps_Map_Weather(short Index)
    {
        // Somente se necessário
        if (!Editor_Maps.Objects.butVisualization.Checked || Lists.Map[Index].Weather.Type == (byte)Globals.Weathers.Normal)
        {
            return;
        }

        // Dados
        byte x = 0;

        if (Lists.Map[Index].Weather.Type == (byte)Globals.Weathers.Snowing)
        {
            x = 32;
        }

        // Desenha as partículas
        for (int i = 1; i < Lists.Weather.Length; i++)
        {
            if (Lists.Weather[i].Visible)
            {
                Render(Win_Map, Tex_Weather, new Rectangle(x, 0, 32, 32), Editor_Maps.Zoom(new Rectangle(Lists.Weather[i].x, Lists.Weather[i].y, 32, 32)), CColor(255, 255, 255, 150));
            }
        }
    }
示例#2
0
文件: Graphics.cs 项目: Kukks/CryBits
    private static void Editor_Maps_Map_Fog(short Index)
    {
        Lists.Structures.Map_Fog Data = Lists.Map[Index].Fog;
        Point Position;

        // Somente se necessário
        if (Data.Texture <= 0)
        {
            return;
        }
        if (!Editor_Maps.Objects.butVisualization.Checked)
        {
            return;
        }

        // Dados
        Size Textura_Tamanho = TSize(Tex_Fog[Data.Texture]);

        for (int x = -1; x <= Editor_Maps.Map_Size.Width * Globals.Grid / Textura_Tamanho.Width + 1; x++)
        {
            for (int y = -1; y <= Editor_Maps.Map_Size.Height * Globals.Grid / Textura_Tamanho.Height + 1; y++)
            {
                // Desenha a fumaça
                Position = new Point(x * Textura_Tamanho.Width + Globals.Fog_X, y * Textura_Tamanho.Height + Globals.Fog_Y);
                Render(Win_Map, Tex_Fog[Data.Texture], Editor_Maps.Zoom(new Rectangle(Position, Textura_Tamanho)), CColor(255, 255, 255, Data.Alpha));
            }
        }
    }
示例#3
0
文件: Graphics.cs 项目: Kukks/CryBits
    private static void Editor_Maps_Map_Panorama(short Index)
    {
        short Texture = Lists.Map[Index].Panorama;
        Size  Size    = TSize(Tex_Panorama[Texture]);

        // Limitações
        Size TempSize = new Size
        {
            Width  = (Lists.Map[Index].Width + 1 - Editor_Maps.Objects.scrlMapX.Value) * Globals.Grid_Zoom,
            Height = (Lists.Map[Index].Height + 1 - Editor_Maps.Objects.scrlMapY.Value) * Globals.Grid_Zoom
        };

        // Não permite que o tamanho ultrapasse a tela de jogo
        if (Size.Width > TempSize.Width)
        {
            Size.Width = TempSize.Width;
        }
        if (Size.Height > TempSize.Height)
        {
            Size.Height = TempSize.Height;
        }

        // Desenha o panorama
        if (Editor_Maps.Objects.butVisualization.Checked && Lists.Map[Index].Panorama > 0)
        {
            Render(Win_Map, Tex_Panorama[Texture], Editor_Maps.Zoom(new Rectangle(new Point(0), Size)));
        }
    }
示例#4
0
文件: Graphics.cs 项目: Kukks/CryBits
    private static void Editor_Maps_Map_Light(short Index)
    {
        Editor_Maps Objects         = Editor_Maps.Objects;
        byte        GlobalLight_Tex = Lists.Map[Index].Light_Global;
        Point       Begin           = Globals.Zoom(Editor_Maps.Objects.scrlMapX.Value, Editor_Maps.Objects.scrlMapY.Value);
        byte        Light           = (byte)((255 * ((decimal)Lists.Map[Index].Lighting / 100) - 255) * -1);

        // Somente se necessário
        if (!Editor_Maps.Objects.butVisualization.Checked)
        {
            return;
        }

        // Escuridão
        Win_Map_Lighting.Clear(CColor(0, 0, 0, Light));

        // Desenha o ponto iluminado
        if (Lists.Map[Index].Light.Count > 0)
        {
            for (byte i = 0; i < Lists.Map[Index].Light.Count; i++)
            {
                Render(Win_Map_Lighting, Tex_Lighting, Editor_Maps.Zoom_Grid(Lists.Map[Index].Light[i].Rec), null, new RenderStates(BlendMode.Multiply));
            }
        }

        // Pré visualização
        if (Editor_Maps.Objects.butMLighting.Checked)
        {
            Render(Win_Map_Lighting, Tex_Lighting, Globals.Zoom(Editor_Maps.Map_Selection), null, new RenderStates(BlendMode.Multiply));
        }

        // Apresenta o que foi renderizado
        Win_Map_Lighting.Display();
        Win_Map.Draw(new Sprite(Win_Map_Lighting.Texture));

        // Luz global
        if (GlobalLight_Tex > 0)
        {
            Render(Win_Map, Tex_Light[GlobalLight_Tex], Editor_Maps.Zoom(new Rectangle(new Point(-Begin.X, -Begin.Y), TSize(Tex_Light[GlobalLight_Tex]))), CColor(255, 255, 255, 175), new RenderStates(BlendMode.Add));
        }

        // Ponto de remoção da luz
        if (Objects.butMLighting.Checked)
        {
            if (Lists.Map[Index].Light.Count > 0)
            {
                for (byte i = 0; i < Lists.Map[Index].Light.Count; i++)
                {
                    RenderRectangle(Win_Map, Lists.Map[Index].Light[i].Rec.X * Globals.Grid_Zoom, Lists.Map[Index].Light[i].Rec.Y * Globals.Grid_Zoom, Globals.Grid_Zoom, Globals.Grid_Zoom, CColor(175, 42, 42, 175));
                }
            }
        }

        // Trovoadas
        Size Size = new Size(Editor_Maps.Zoom((Lists.Map[Index].Width + 1) * Globals.Grid), Editor_Maps.Zoom((Lists.Map[Index].Height + 1) * Globals.Grid));

        Render(Win_Map, Tex_Blank, 0, 0, 0, 0, Size.Width, Size.Height, CColor(255, 255, 255, Globals.Lightning));
    }
示例#5
0
文件: Graphics.cs 项目: Kukks/CryBits
    private static void Editor_Maps_Map_Grids(short Index)
    {
        Editor_Maps Objects = Editor_Maps.Objects;
        Rectangle   Source = Editor_Maps.Tile_Source, Destiny = new Rectangle();
        Point       Begin = new Point(Editor_Maps.Map_Selection.X - Objects.scrlMapX.Value, Editor_Maps.Map_Selection.Y - Objects.scrlMapY.Value);

        // Dados
        Destiny.Location = Globals.Zoom(Begin.X, Begin.Y);
        Destiny.Size     = new Size(Source.Width / Editor_Maps.Zoom(), Source.Height / Editor_Maps.Zoom());

        // Desenha as grades
        if (Objects.butGrid.Checked || !Objects.butGrid.Enabled)
        {
            for (byte x = 0; x <= Editor_Maps.Map_Size.Width; x++)
            {
                for (byte y = 0; y <= Editor_Maps.Map_Size.Height; y++)
                {
                    RenderRectangle(Win_Map, x * Globals.Grid_Zoom, y * Globals.Grid_Zoom, Globals.Grid_Zoom, Globals.Grid_Zoom, CColor(25, 25, 25, 70));
                    Editor_Maps_Map_Zones(Index, x, y);
                    Editor_Maps_Map_Attributes(Index, x, y);
                    Editor_Maps_Map_DirBlock(Index, x, y);
                }
            }
        }

        if (!Objects.chkAuto.Checked && Objects.butMNormal.Checked)
        {
            // Normal
            if (Objects.butPencil.Checked)
            {
                Render(Win_Map, Tex_Tile[Objects.cmbTiles.SelectedIndex + 1], Source, Destiny);
            }
            // Retângulo
            else if (Objects.butRectangle.Checked)
            {
                for (int x = Begin.X; x < Begin.X + Editor_Maps.Map_Selection.Width; x++)
                {
                    for (int y = Begin.Y; y < Begin.Y + Editor_Maps.Map_Selection.Height; y++)
                    {
                        Render(Win_Map, Tex_Tile[Objects.cmbTiles.SelectedIndex + 1], Source, new Rectangle(Globals.Zoom(x, y), Destiny.Size));
                    }
                }
            }
        }

        // Desenha a grade
        if (!Objects.butMAttributes.Checked || !Editor_Maps.Objects.optA_DirBlock.Checked)
        {
            RenderRectangle(Win_Map, Destiny.X, Destiny.Y, Editor_Maps.Map_Selection.Width * Globals.Grid_Zoom, Editor_Maps.Map_Selection.Height * Globals.Grid_Zoom);
        }
    }
示例#6
0
文件: Graphics.cs 项目: Kukks/CryBits
    private static void Editor_Maps_AutoTile(Point Position, Lists.Structures.Map_Tile_Data Data, SFML.Graphics.Color Color)
    {
        // Desenha os 4 mini azulejos
        for (byte i = 0; i <= 3; i++)
        {
            Point Destiny = Position, Source = Data.Mini[i];

            // Partes do azulejo
            switch (i)
            {
            case 1: Destiny.X += 16; break;

            case 2: Destiny.Y += 16; break;

            case 3: Destiny.X += 16; Destiny.Y += 16; break;
            }

            // Renderiza o mini azulejo
            Render(Win_Map, Tex_Tile[Data.Tile], new Rectangle(Source.X, Source.Y, 16, 16), Editor_Maps.Zoom(new Rectangle(Destiny, new Size(16, 16))), Color);
        }
    }
示例#7
0
文件: Graphics.cs 项目: Kukks/CryBits
    private static void Editor_Maps_Map_Tiles(short Index)
    {
        Editor_Maps Objects = Editor_Maps.Objects;

        Lists.Structures.Map           Map = Lists.Map[Index];
        Lists.Structures.Map_Tile_Data Data;
        int Begin_X = Objects.scrlMapX.Value, Begin_Y = Objects.scrlMapY.Value;

        SFML.Graphics.Color Color; System.Drawing.Color TempCor = System.Drawing.Color.FromArgb(Map.Color);

        // Desenha todos os azulejos
        for (byte c = 0; c < Map.Layer.Count; c++)
        {
            // Somente se necessário
            if (!Objects.lstLayers.Items[c].Checked)
            {
                continue;
            }

            // Transparência da camada
            Color = CColor(255, 255, 255);
            if (Objects.butEdition.Checked && Objects.butMNormal.Checked)
            {
                if (Editor_Maps.Objects.lstLayers.SelectedIndices.Count > 0)
                {
                    if (c != Editor_Maps.Objects.lstLayers.SelectedItems[0].Index)
                    {
                        Color = CColor(255, 255, 255, 150);
                    }
                }
            }
            else
            {
                Color = CColor(TempCor.R, TempCor.G, TempCor.B);
            }

            // Continua
            for (int x = Begin_X; x <= Editor_Maps.Map_Size.Width; x++)
            {
                for (int y = Begin_Y; y <= Editor_Maps.Map_Size.Height; y++)
                {
                    if (Map.Layer[c].Tile[x, y].Tile > 0)
                    {
                        // Dados
                        Data = Map.Layer[c].Tile[x, y];
                        Rectangle Source  = new Rectangle(new Point(Data.X * Globals.Grid, Data.Y * Globals.Grid), Globals.Grid_Size);
                        Rectangle Destiny = new Rectangle(new Point((x - Begin_X) * Globals.Grid, (y - Begin_Y) * Globals.Grid), Globals.Grid_Size);

                        // Desenha o azulejo
                        if (!Map.Layer[c].Tile[x, y].Auto)
                        {
                            Render(Win_Map, Tex_Tile[Data.Tile], Source, Editor_Maps.Zoom(Destiny), Color);
                        }
                        else
                        {
                            Editor_Maps_AutoTile(Destiny.Location, Data, Color);
                        }
                    }
                }
            }
        }
    }