//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) { }
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(); }
public override bool Equals(object obj) { Integer2 integer = obj as Integer2; return(integer != null && x == integer.x && y == integer.y); }
//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); }
//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; }
//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(); }
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); }
public void SetPosition(Integer2 position) { Mouse.SetPosition(position.X, position.Y); }
//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)); }
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; }
//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; }