/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here SetUpPayPal(); self = this; LoadConfig(); LoadWallpapers(); Wallpaper = walls[new Random().Next(6)]; //Wallpaper = Utils.CreateTexture(GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); // gd = GraphicsDevice; var spriteSheetLoader = new SpriteSheetLoader(Content, GraphicsDevice); sheet = spriteSheetLoader.Load("SpriteSheet.png"); hit4sheet = spriteSheetLoader.Load("hit4.png"); //sheet loginMenu = new LoginMenu(); loginMenu.Initialize(Content); registerMenu = new RegisterMenu(); registerMenu.Initialize(Content); menus.Add(loginMenu); menus.Add(registerMenu); base.Initialize(); }
public static void Init(params AvailableTextures[] sprite_sheet_textures) { SpriteSheet = new SpriteSheet(); var sprite_sheet_loader = new SpriteSheetLoader(); foreach (var available_texture in sprite_sheet_textures) { SpriteSheet.Add(sprite_sheet_loader.Load(ContentHolder.Get(available_texture), "NeonPartyGamesController." + Engine.Game.Content.RootDirectory + ".textures." + available_texture + ".json")); } }
/// <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. this.spriteBatch = new SpriteBatch(GraphicsDevice); this.spriteRender = new SpriteRender(this.spriteBatch); // TODO: use this.Content to load your game content here var spriteSheetLoader = new SpriteSheetLoader(Content, GraphicsDevice); spriteSheet = spriteSheetLoader.Load("salle.png"); }
public static SpriteSheet GetSheet(string file) { if (Sheets.ContainsKey(file)) { return(Sheets[file]); } var sheet = SpriteSheetLoader.Load(file); Sheets[file] = sheet; return(sheet); }
/// <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. spriteBatch = new SpriteBatch(GraphicsDevice); spriteSheetLoader = new SpriteSheetLoader(Content); //startMenuBackgroundSprite = Content.Load<Texture2D>("StartScreen.png"); //var s = File.OpenRead("Content/StartScreen.png"); startMenuBackgroundSprite = PngLoader.Load(this.GraphicsDevice, "Content/StartScreen.png"); backgroundAnimation.LoadBackGround(this.GraphicsDevice, Content); backgroundAnimation.spriteBatch = new SpriteBatch(GraphicsDevice); HealthBar.healthBarTexture = PngLoader.Load(this.GraphicsDevice, "Content/HealthBar.png"); EnemyClass.enemyTexture = PngLoader.Load(this.GraphicsDevice, "Content/EnemyShip.png"); player.InitializeAndLoadPlayer(this.GraphicsDevice, Content, initialPlayerPosition, new SpriteBatch(GraphicsDevice)); player.spriteBatch = new SpriteBatch(GraphicsDevice); playerShotHandler = new PlayerShotHandler(this.GraphicsDevice, Content, GraphicsDevice); playerShotHandler.playerShootingSpawnCounter = 0; playerShotHandler.shootingStartPositionCorrection = new Vector2((player.playerTexture.Width * player.shipScale.X) / 2, 0); arialFont = Content.Load <SpriteFont>("Arial"); arialFont28 = Content.Load <SpriteFont>("Arial_28"); TextureManager.enemySpriteSheet = spriteSheetLoader.Load(this.GraphicsDevice, "EnemyDeathAnimationTexture.png"); startButtonSprite = PngLoader.Load(this.GraphicsDevice, "Content/StartButton.png"); upgradeButtonSprite = PngLoader.Load(this.GraphicsDevice, "Content/UpgradesButton.png"); exitButtonSprite = PngLoader.Load(this.GraphicsDevice, "Content/ExitButton.png"); startMenuScreen.LoadStartMenu(GraphicsDevice, Content, screenWidth, startMenuBackgroundSprite, startButtonSprite, upgradeButtonSprite, exitButtonSprite); startMenuScreen.spriteBatch = new SpriteBatch(GraphicsDevice); gameStateWatcher.SubscribeStartButton(startMenuScreen.startButton); gameStateWatcher.SubscribeUpgradeButton(startMenuScreen.upgradeButton); gameStateWatcher.SubscribeExitButton(startMenuScreen.exitButton); gameOverScreen.LoadGameOverScreen(GraphicsDevice, Content, screenWidth, upgradeButtonSprite, exitButtonSprite); gameStateWatcher.SubscribeUpgradeButton(gameOverScreen.upgradeButton); gameStateWatcher.SubscribeExitButton(gameOverScreen.exitButton); }
protected override void LoadContent() { //Load textures, you can do this however you like. Textuer packer isn't free afterall. var loader = new SpriteSheetLoader(Content); var spriteSheet = loader.Load("texture"); //GUI Setup, can be adapted to suit game's texture atlas system. var screenBounds = new Rectangle(0, 0, 800, 600); texture = spriteSheet.Texture; //Load texture atlas var sourceRects = //Source rectangles and nine patch coordinates. new Dictionary <string, (Rectangle, int[])> {
/// <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. spriteBatch = new SpriteBatch(GraphicsDevice); spriteRender = new SpriteRender(spriteBatch); var spriteSheetLoader = new SpriteSheetLoader(Content, GraphicsDevice); spriteSheet = spriteSheetLoader.Load(GraphicsDevice.Viewport.Height > 768 ? "*****@*****.**" : "CapGuyDemo.png"); backgroundSprite = spriteSheet.Sprite(TexturePackerMonoGameDefinitions.CapGuyDemo.Background); centreScreen = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2); InitialiseAnimationManager(); }
/// <summary> /// Loads any component specific content /// </summary> protected override void LoadContent() { base.LoadContent(); fSpriteBatch = new SpriteBatch(Game.GraphicsDevice); fTexture = Game.Content.Load <Texture2D>("count/particle_32_2"); var spriteSheetLoader = new SpriteSheetLoader(Game.Content, GraphicsDevice); fSpriteSheet = spriteSheetLoader.Load("count/flowers.png"); fSpriteRender = new SpriteRender(fSpriteBatch); UpdateScale(); }
/// <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. spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load <SpriteFont>("Status"); SpriteSheetLoader loader = new SpriteSheetLoader(Content, _fileReader); var ss = loader.Load("fanatiblaster"); var frame = ss.SpriteList[SpriteNames.Down_spritesheetforthegame_1_0]; var animationCache = new AnimationCache(ss); animationCache.Animations.Add("down", new string[] { SpriteNames.Down_spritesheetforthegame_1_1, SpriteNames.Down_spritesheetforthegame_1_2, SpriteNames.Down_spritesheetforthegame_1_3, SpriteNames.Down_spritesheetforthegame_1_4, SpriteNames.Down_spritesheetforthegame_1_5, SpriteNames.Down_spritesheetforthegame_1_6, SpriteNames.Down_spritesheetforthegame_1_7, SpriteNames.Down_spritesheetforthegame_1_8 }); MovementSystem movementSystem = new MovementSystem(_channelManager, 25, new string[] { "default" }); TextRenderSystem textRenderSystem = new TextRenderSystem(spriteBatch, _channelManager, 100, "default"); TextureRenderSystem textureRenderSystem = new TextureRenderSystem(spriteBatch, _channelManager, 101, "default"); SpriteAnimationSystem spriteAnimationSystem = new SpriteAnimationSystem(animationCache, _channelManager, 30, "default"); _gameManager.AddSystem(textRenderSystem); _gameManager.AddSystem(movementSystem); _gameManager.AddSystem(textureRenderSystem); _gameManager.AddSystem(spriteAnimationSystem); var te = _gameManager.EntityManager.Get("text", new string[] { "default" }); te.CreateTextRenderEntity("Some Text", Color.Black, new Vector2(100, 100), 5, 1.0f, font); var teMove = _gameManager.EntityManager.Get("text2", new string[] { "default" }); teMove.CreateTextRenderEntity("I'm Moving!", Color.Black, new Vector2(1, 1), 5, 1.0f, font) .AddComponent(new VelocityComponent() { Direction = new Vector2(1, 1), Speed = new Vector2(15, 15) }); var teSprite = _gameManager.EntityManager.Get("sprite"); teSprite.MakeTextureRenderAspect(new Vector2(150, 150), frame.IsRotated, frame.Origin, frame.SourceRectangle, frame.Texture, SpriteEffects.None, Color.White, 1.0f, 0.0f) .AddComponent(new AnimationComponent() { Active = true, CurrentAnimation = "down", CurrentFrameIndex = 0, ShouldLoop = true, FPS = 8.0f }); _gameManager.AddEntity(te); _gameManager.AddEntity(teMove); _gameManager.AddEntity(teSprite); }