示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            Source.Engine.Globals.MyContent     = this.Content;
            Source.Engine.Globals.MySpriteBatch = new SpriteBatch(GraphicsDevice);
            // TODO: use this.Content to load your game content here

            _cursor = new Source.Engine.Asset2D("Assets\\UI\\cursor_arrow", Vector2.Zero, new Vector2(40, 40));

            Source.Engine.Globals.NormalEffect = Source.Engine.Globals.MyContent.Load <Effect>("Shaders\\basic_shader");

            Source.Engine.Globals.MyKeyboard = new Source.Engine.Input.MyKeyboard();
            Source.Engine.Globals.MyMouse    = new Source.Engine.Input.MyMouseControl();

            _mainMenu = new Source.GamePlay.MainMenu(ChangeGameState, ExitGame);
            _gameplay = new Source.GamePlay.GamePlay(ChangeGameState);
        }
示例#2
0
        public SquareGrid(Vector2 a_slotDims, Vector2 a_startPos, Vector2 a_gridDims, XElement a_map, float a_gravity = .8f, float a_friction = .5f)
        {
            _gravity  = a_gravity;
            _friction = a_friction;

            _showGrid = false;

            _slotDims = a_slotDims;
            _gridDims = a_gridDims;

            _physicalStartPos  = new Vector2((int)a_startPos.X, (int)a_startPos.Y);
            _totalPhysicalDims = new Vector2((int)_gridDims.X * a_slotDims.X, (int)_gridDims.Y * a_slotDims.Y);

            _topLeft  = Vector2.Zero;
            _botRight = new Vector2(_totalPhysicalDims.X, _totalPhysicalDims.Y);

            _currentHoverSlot = new Vector2(-1, -1);

            SetBaseGrid();

            _gridImg = new Asset2D("Assets\\UI\\shade", _slotDims / 2, new Vector2(_slotDims.X - 2, _slotDims.Y - 2));

            LoadData(a_map);
        }