public MenuManager(Main game, String[] strMenuTextures, String strMenuFont, Integer2 textureBorderPadding) : base(game) { this.game = game; //nmcg - create an array of textures this.menuTextures = new Texture2D[strMenuTextures.Length]; //nmcg - load the textures for (int i = 0; i < strMenuTextures.Length; i++) { this.menuTextures[i] = game.Content.Load<Texture2D>(@"" + strMenuTextures[i]); } //nmcg - load menu font this.menuFont = game.Content.Load<SpriteFont>(@"" + strMenuFont); //nmcg - stores all menu item (e.g. Save, Resume, Exit) objects this.menuItemList = new List<MenuItem>(); //sets menu texture to fullscreen minus and padding on XY this.textureRectangle = menuTextures[0].Bounds; }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Main game = new Main()) { game.Run(); } }
public Camera2D(Main game, Vector2 translation, float rotation, float scale) : base(game) { this.game = game; //we need access to viewport to get dimensions of screen //we cant use windowDimensions because we may want to create more than one viewport (i.e. for splitscreen) this.viewPort = game.GraphicsDevice.Viewport; //sets the position of the camera this.translation = translation; //sets any rotation around Z (i.e. coming out of the screen) this.rotation = rotation; //sets the zoom level (i.e. if > 1 zoom in, if < 1 zoom out, bounded at minimum value) //call property and not this.scale to ensure scale not set to less than minimum SCALE = scale; //stored for reset this.originalTranslation = translation; this.originaRotation = rotation; this.originalScale = scale; //Calc this properly, with game data etc. this.minY = 300; this.maxY = GameData.LEVEL_HEIGHT-300; this.minX = 400; this.maxX = GameData.LEVEL_WIDTH - 400; this.cameraElasticity = 0.1f; this.difference = Vector2.Zero; }
public SpriteManager(Main theGame) : base(theGame) { this.list = new List<Sprite>(); //store static pointer to game game = theGame; }
public TextureData(Main game, Texture2D texture) { this.texture = texture; setColorData(texture); this.fullSourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); this.centreOrigin = new Vector2(texture.Width / 2, texture.Height / 2); }
public TextureData(Main game, string path) { this.texture = game.Content.Load<Texture2D>(@"" + path); setColorData(texture); this.fullSourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); this.centreOrigin = new Vector2(texture.Width / 2, texture.Height / 2); }
public ShadowCastManager(Main game) : base(game) { this.game = game; this.shadowCastingPosition = Vector2.Zero; this.paused = false; this.contactLines = new List<Line>(); this.light = new Color(0, 0, 0, 60); this.dark = new Color(0, 0, 0, 120); this.shadowColor = light; }
public TextureManager(Main game) { //Debug to allow us to visualise the bounding rectangle - remove for release if (GameData.DEBUG_SHOW_BOUNDING_RECTANGLES) { DEBUG_BOUNDING_RECTANGLE_TEXTURE = game.Content.Load<Texture2D>(@"Assets\\Debug\\debugrect"); } this.game = game; this.textureDictionary = new Dictionary<string, TextureData>(); }
public CloudFactory(Main game, List<Rectangle> cloudSources, float minSpeed, int maxClouds, Rectangle boundary) : base(game) { this.minSpeed = minSpeed; this.maxClouds = maxClouds; this.boundary = boundary; //level boundary this.currentClouds = new List<Cloud>(); this.cloudSources = cloudSources; this.random = new Random(); this.backgroundDepth = 0.4f; }
public MouseManager(Main game, bool isVisible) : base(game) { //allows us to set mouse visibility this.isVisible = isVisible; game.IsMouseVisible = isVisible; this.game = game; this.bounds = new Rectangle(0,0,1,1); this.game.IsMouseVisible = true; }
public UIManager(Main game) : base(game) { this.depth = 0.05f; this.healthBar = new Sprite("healthBar", SpriteManager.GAME.TEXTUREMANAGER.Get("HealthBar"), new SpritePresentationInfo(new Rectangle(0, 0, 128, 26), depth), new SpritePositionInfo(new Vector2(10, 15), 128, 28)); this.key = new Sprite("keySheet", SpriteManager.GAME.TEXTUREMANAGER.Get("keySheet"), new SpritePresentationInfo(new Rectangle(0, 0, 58, 58), depth), new SpritePositionInfo(new Vector2(10, 50), 58, 58)); }
//code repition not good. public AnimatedTextureData(Main game, Texture2D texture, List<Rectangle> frameSources) : base() { this.texture = texture; this.numberOfFrames = frameSources.Count; this.frameWidth = frameSources[0].Width; this.frameHeight = frameSources[0].Height; this.fullSourceRectangle = new Rectangle(0, 0, frameWidth, frameHeight); this.centreOrigin = new Vector2(frameWidth / 2, frameHeight / 2); this.frameSources = frameSources; this.textureColorData2DList = new List<Color[,]>(numberOfFrames); setColorData(texture); }
public SoundEffectInfo(Main game, string effectName, string effectFileName, float volume, float pitch, float pan, bool loop) { set(game, effectName, effectFileName, volume, pitch, pan, loop); }
public void set(Main game, string effectName, string effectFileName, float volume, float pitch, float pan, bool loop) { this.soundEffect = game.Content.Load<SoundEffect>(@"" + effectFileName); this.effectFileName = effectFileName; this.effectName = effectName; this.volume = volume; this.pitch = pitch; this.pan = pan; this.loop = loop; }