示例#1
0
 //removes necessity to specify starting screen type layout (e.g. single, multi)
 public ScreenManager(Game game, GraphicsDeviceManager graphics, Integer2 screenResolution,
                      ObjectManager objectManager, CameraManager cameraManager, KeyboardManager keyboardManager,
                      Keys pauseKey, EventDispatcher eventDispatcher, StatusType statusType)
     : this(game, graphics, screenResolution, ScreenUtility.ScreenType.SingleScreen, objectManager, cameraManager,
            keyboardManager, pauseKey, eventDispatcher, statusType)
 {
 }
示例#2
0
        public MenuManager(Main game, Texture2D[] menuTextures,
                           SpriteFont menuFont, Integer2 textureBorderPadding,
                           Color menuTextureBlendColor)
            : base(game)
        {
            this.game = game;

            //load the textures
            this.menuTextures = menuTextures;

            //background blend color for the menu
            this.menuTextureBlendColor = menuTextureBlendColor;

            //menu font
            this.menuFont = menuFont;

            //stores all menu item (e.g. Save, Resume, Exit) objects
            this.menuItemList = new List <MenuItem>();

            //set the texture background to occupy the entire screen dimension, less any padding
            this.textureRectangle = game.ScreenRectangle;

            //deflate the texture rectangle by the padding required
            this.textureRectangle.Inflate(-textureBorderPadding.X, -textureBorderPadding.Y);

            //show the menu
            ShowMenu();
        }
示例#3
0
        public override bool Equals(object obj)
        {
            Integer2 integer = obj as Integer2;

            return(integer != null &&
                   x == integer.x &&
                   y == integer.y);
        }
示例#4
0
        //used by dynamic sprites i.e. which need a look and right vector for movement
        public Transform2D(Vector2 translation, float rotationInDegrees, Vector2 scale,
                           Vector2 origin, Integer2 dimensions)
        {
            Initialize(translation, rotationInDegrees, scale, origin, dimensions);

            //store original values in case of reset
            this.originalTransform2D = new Transform2D();
            this.originalTransform2D.Initialize(translation, rotationInDegrees, scale, origin, dimensions);
        }
        //used by dynamic sprites i.e. which need a look and right vector for movement
        public Transform2D(Vector2 translation, float rotationInDegrees, Vector2 scale,
            Vector2 origin, Integer2 dimensions)
        {
            //set using properties
            Set(translation, rotationInDegrees, scale, origin, dimensions);

            //store defaults used for reset
            SetDefaults(translation, rotationInDegrees, scale, origin, dimensions);
        }
示例#6
0
 //store the original default values for any subsequent reset
 private void SetDefaults(Vector2 translation, float rotationInDegrees, Vector2 scale,
                          Vector2 origin, Integer2 dimensions)
 {
     this.originalTranslation       = translation;
     this.originalScale             = scale;
     this.originalRotationInDegrees = rotationInDegrees;
     this.originalDimensions        = dimensions;
     this.originalOrigin            = origin;
 }
示例#7
0
        //used by dynamic sprites i.e. which need a look and right vector for movement
        public Transform2D(Vector2 translation, float rotationInDegrees, Vector2 scale,
                           Vector2 origin, Integer2 dimensions)
        {
            //set using properties
            Set(translation, rotationInDegrees, scale, origin, dimensions);

            //store defaults used for reset
            SetDefaults(translation, rotationInDegrees, scale, origin, dimensions);
        }
示例#8
0
        //called by constructor to setup the object
        protected void Initialize(Vector2 translation, float rotationInDegrees, Vector2 scale, Vector2 origin, Integer2 dimensions)
        {
            this.Translation       = translation;
            this.Scale             = scale;
            this.RotationInDegrees = rotationInDegrees;
            this.Origin            = origin;

            //original bounding box based on the texture source rectangle dimensions
            this.originalBounds     = new Rectangle(0, 0, dimensions.X, dimensions.Y);
            this.originalDimensions = dimensions;
        }
        public MenuManager(Main game, Texture2D[] menuTextures, 
            SpriteFont menuFont, Integer2 textureBorderPadding,
            Color menuTextureBlendColor)
            : base(game)
        {
            this.game = game;

            //load the textures
            this.menuTextures = menuTextures;

            //background blend color for the menu
            this.menuTextureBlendColor = menuTextureBlendColor;

            //menu font
            this.menuFont = menuFont;

            //stores all menu item (e.g. Save, Resume, Exit) objects
            this.menuItemList = new List<MenuItem>();

            //set the texture background to occupy the entire screen dimension, less any padding
            this.textureRectangle = game.ScreenRectangle;

            //deflate the texture rectangle by the padding required
            this.textureRectangle.Inflate(-textureBorderPadding.X, -textureBorderPadding.Y);

            this.menuState = MenuData.MenuStateMain;

            this.numberBarsMusicMax = 6;
            this.numberBarsSFXMax = 6;
            this.numberBarsMusic = 3;
            this.numberBarsSFX = 3;

            this.volumeMusic = numberBarsMusic/(float)numberBarsMusicMax;
            this.volumeSFX = numberBarsSFX/(float)numberBarsSFXMax;

            this.muted = false;

            game.SoundManager.SetVolume(volumeMusic, "Music");
            game.SoundManager.SetVolume(volumeSFX, "SFX");

            //show the menu
            ShowMenu();
        }
示例#10
0
        public ScreenManager(Game game, GraphicsDeviceManager graphics, Integer2 screenResolution,
                             ScreenUtility.ScreenType screenType, ObjectManager objectManager, CameraManager cameraManager, KeyboardManager keyboardManager,
                             Keys pauseKey, EventDispatcher eventDispatcher, StatusType statusType)
            : base(game, eventDispatcher, statusType)
        {
            this.ScreenType    = screenType;
            this.objectManager = objectManager;
            this.cameraManager = cameraManager;

            //showing and hiding the menu - see ApplyUpdate()
            this.keyboardManager = keyboardManager;
            this.pauseKey        = pauseKey;

            this.graphics = graphics;

            //set the resolution using the property
            this.ScreenResolution   = screenResolution;
            this.fullScreenViewport = new Viewport(0, 0, screenResolution.X, screenResolution.Y);
        }
示例#11
0
 public void SetPosition(Integer2 position)
 {
     Mouse.SetPosition(position.X, position.Y);
 }
示例#12
0
 //Calculates the mouse pointer distance from the screen centre
 public Vector2 GetDeltaFromCentre(Integer2 screenCentre)
 {
     return(new Vector2(this.newState.X - screenCentre.X, this.newState.Y - screenCentre.Y));
 }
示例#13
0
 public FirstPersonCameraController(string id, ControllerType controllerType, Keys[] moveKeys, float moveSpeed, float strafeSpeed, float rotationSpeed,
                                    InputManagerParameters managerParameters, Integer2 screenCentre)
     : base(id, controllerType, moveKeys, moveSpeed, strafeSpeed, rotationSpeed, managerParameters)
 {
     this.screenCentre = screenCentre;
 }
 //store the original default values for any subsequent reset
 private void SetDefaults(Vector2 translation, float rotationInDegrees, Vector2 scale,
     Vector2 origin, Integer2 dimensions)
 {
     this.originalTranslation = translation;
     this.originalScale = scale;
     this.originalRotationInDegrees = rotationInDegrees;
     this.originalDimensions = dimensions;
     this.originalOrigin = origin;
 }
        //set all new values
        public void Set(Vector2 translation, float rotationInDegrees, Vector2 scale,
            Vector2 origin, Integer2 dimensions)
        {
            this.Translation = translation;
            this.Scale = scale;
            this.Rotation = rotationInDegrees;
            this.Origin = origin;

            //original bounding box based on the texture source rectangle dimensions
            this.originalBounds = new Rectangle(0, 0, dimensions.X, dimensions.Y);
            this.originalDimensions = dimensions;

            this.bBoundsDirty = true;
        }