public void Draw()
        {
            GL.Clear(ClearBufferMask.DepthBufferBit);

            OpenGLDrawer.Draw(_playerSprite,
                              new Vector2(this.Position.X * Constants.GRIDSIZE, (this.Position.Y) * Constants.GRIDSIZE),
                              new Vector2((float)Constants.GRIDSIZE / Constants.TILESETSIZE),
                              Color.Transparent,
                              Vector2.Zero,
                              new RectangleF(PositionToCut.X * Constants.TILESETSIZE, PositionToCut.Y * Constants.TILESETSIZE,
                                             Constants.TILESETSIZE, Constants.TILESETSIZE));
        }
Beispiel #2
0
        private void DrawBoard()
        {
            _view.GetTransformMatrix();
            for (int x = 0; x < _board.Width; x++)
            {
                for (int y = 0; y < _board.Height; y++)
                {
                    RectangleF source = new RectangleF(0, 0, 0, 0);

                    switch (_board[x, y].Type)
                    {
                    case EnumBlockType.TerrainBoard:
                        source = new RectangleF(1 * Constants.TILESETSIZE, 47 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.Path:
                        source = new RectangleF(2 * Constants.TILESETSIZE, 30 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.StartPoint:
                        source = new RectangleF(4 * Constants.TILESETSIZE, 38 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.EndPoint:
                        source = new RectangleF(5 * Constants.TILESETSIZE, 5 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.Dice:
                        source = new RectangleF(47 * Constants.TILESETSIZE, 47 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.Twister:
                        source = new RectangleF(2 * Constants.TILESETSIZE, 47 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.SpeedBoots:
                        source = new RectangleF(0 * Constants.TILESETSIZE, 40 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.GreenSkull:
                        source = new RectangleF(9 * Constants.TILESETSIZE, 38 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.Hole:
                        source = new RectangleF(21 * Constants.TILESETSIZE, 46 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.BadluckRedSpot:
                        source = new RectangleF(43 * Constants.TILESETSIZE, 43 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    case EnumBlockType.Dynamite:
                        source = new RectangleF(33 * Constants.TILESETSIZE, 47 * Constants.TILESETSIZE,
                                                Constants.TILESETSIZE, Constants.TILESETSIZE);
                        break;

                    default:
                        break;
                    }

                    OpenGLDrawer.Draw(_tileSet,
                                      new Vector2(x * Constants.GRIDSIZE, y * Constants.GRIDSIZE),
                                      new Vector2((float)Constants.GRIDSIZE / Constants.TILESETSIZE),
                                      Color.Transparent,
                                      Vector2.Zero,
                                      source);
                }
            }
        }