Esempio n. 1
0
        /// <summary>
        /// Render the decoration scene
        /// </summary>
        void RenderDecorationScene()
        {
            GlDecorationControl.MakeCurrent();
            Display.ClearBuffers();

            if (Batch != null && Maze != null)
            {
                Batch.Begin();

                Batch.DrawTile(Maze.WallTileset, 0, Point.Empty);

                TileDrawing td = DisplayCoordinates.GetWalls(ViewFieldPosition.L)[0];
                Batch.DrawTile(Maze.WallTileset, td.ID, td.Location);


                // Draw the decoration
                if (Maze.Decoration != null)
                {
                    Maze.Decoration.Draw(Batch, (int)DecorationIdBox.Value, ViewFieldPosition.L);
                }

                Batch.End();
            }


            GlDecorationControl.SwapBuffers();
        }
Esempio n. 2
0
        /// <summary>
        /// Draws the scene
        /// </summary>
        void RenderScene()
        {
            if (Batch == null)
            {
                return;
            }

            GLControl.MakeCurrent();

            Display.ClearBuffers();


            Batch.Begin();

            // Background
            Batch.DrawTile(Maze.WallTileset, 0, Point.Empty);

            // Draw the wall
            foreach (TileDrawing tmp in DisplayCoordinates.GetWalls(ViewFieldPosition.L))
            {
                Batch.DrawTile(Maze.WallTileset, tmp.ID, tmp.Location, Color.White, 0.0f, tmp.Effect, 0.0f);
            }


            // Draw the tile
            if (Maze.Decoration != null && Alcove != null)
            {
                Decoration deco = Maze.Decoration.GetDecoration(Alcove.Decoration);
                if (deco != null)
                {
                    Point loc = deco.GetLocation(ViewFieldPosition.L);
                    Batch.DrawTile(Maze.Decoration.Tileset, deco.GetTileId(ViewFieldPosition.L), loc);
                }
            }


            Batch.End();
            GLControl.SwapBuffers();
        }
Esempio n. 3
0
        /// <summary>
        /// Render the scene
        /// </summary>
        void RenderScene()
        {
            OpenGLBox.MakeCurrent();
            Display.ClearBuffers();

            Batch.Begin();

            // Background
            Batch.DrawTile(BgTileSet, 0, Point.Empty);

            // Render the walls
            if (DisplayWallBox.Checked)
            {
                foreach (TileDrawing tmp in DisplayCoordinates.GetWalls(ViewPositionBox.Position))
                {
                    Batch.DrawTile(BgTileSet, tmp.ID, tmp.Location, Color.White, 0.0f, tmp.Effect, 0.0f);
                }
            }


            #region Draw the decoration
            if (Decoration != null && DecorationSet.Tileset != null)
            {
                DecorationSet.Draw(Batch, (int)DecorationIdBox.Value, ViewPositionBox.Position);

                Tile tile = DecorationSet.Tileset.GetTile(Decoration.GetTileId(ViewPositionBox.Position));
                if (tile != null)
                {
                    Point     start = Decoration.GetLocation(ViewPositionBox.Position);
                    Rectangle rect  = new Rectangle(start, tile.Size);

                    // Red rectangle around tile
                    if (rect.Contains(OpenGLBox.PointToClient(Control.MousePosition)) && !ItemsModeSelected)
                    {
                        Batch.DrawRectangle(rect, Color.Red);
                    }
                }

                TileLocationBox.Text = Decoration.GetLocation(ViewPositionBox.Position).ToString();
            }
            else
            {
                TileLocationBox.Text = "";
            }
            #endregion


            #region Display item
            if (ItemsModeSelected && ItemTileset != null &&
                (ViewPositionBox.Position == ViewFieldPosition.L ||
                 ViewPositionBox.Position == ViewFieldPosition.H ||
                 ViewPositionBox.Position == ViewFieldPosition.C))
            {
                // Offset the item locations according to the distance
                Vector2 vect = DisplayCoordinates.GetMonsterScaleFactor(ViewPositionBox.Position);
                Point   loc  = Decoration.PrepareLocation(ViewPositionBox.Position);
                loc.Offset((int)(Decoration.ItemLocation.X * vect.X), (int)(Decoration.ItemLocation.Y * vect.Y));


                Batch.DrawTile(ItemTileset, (int)ItemIdBox.Value, loc,
                               DisplayCoordinates.GetDistantColor(ViewPositionBox.Position), 0.0f,
                               DisplayCoordinates.GetItemScaleFactor(ViewPositionBox.Position), SpriteEffects.None, 0.0f);

                ItemPositionBox.Text = Decoration.ItemLocation.ToString();
            }
            #endregion

            Batch.End();

            OpenGLBox.SwapBuffers();
        }