/// <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); map = Content.Load <TiledMap>("CastleLevel1"); mapRenderer = new TiledMapRenderer(GraphicsDevice); SetUpTiles(); LoadObjects(); player.Load(Content, this); arialFont = Content.Load <SpriteFont>("arial"); heart = Content.Load <Texture2D>("Heart"); BoxingViewportAdapter viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height); camera = new Camera2D(viewportAdapter); camera.Position = new Vector2(0, graphics.GraphicsDevice.Viewport.Height); gameMusic = Content.Load <Song>("Foreboding"); MediaPlayer.Play(gameMusic); }
/// <summary> /// A gaming screen which consists of a single Camera and multiple entities /// </summary> public LevelScreen() { _graphics = new GraphicsDeviceManager(this); _graphics.SynchronizeWithVerticalRetrace = false; _graphics.PreparingDeviceSettings += (sender, e) => { e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.Immediate; }; _graphics.ApplyChanges(); Content.RootDirectory = "Content"; GameDatas.AssetManager = Content; // Setting properties IsMouseVisible = true; //Window.Position = Point.Zero; _adapter = new BoxingViewportAdapter(Window, GraphicsDevice, GameSettings.Width, GameSettings.Height); GameDatas.MainCamera = new ControllableCamera2D(_adapter, 100); // Launch the GameLogic thread _physicLoop = new PhysicsLoop(GameSettings.PhysicRefreshingRate); //_graphicsLoop = new GraphicsLoop(GameSettings.GraphicRefreshingRate, this); _graphicsLoop = new GraphicsLoop(0, this); _level = new ALevel("Content/Map/map_test.json"); }
protected override void LoadContent() { base.LoadContent(); StaticServiceLocator.AddService(GraphicsDevice); _spriteBatch = new SpriteBatch(GraphicsDevice); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, ScreenSize.Width, ScreenSize.Height); _rpgScene = new TopDownRpgScene(viewportAdapter, _spriteBatch); StaticServiceLocator.AddService(viewportAdapter); var screens = new List <Screen> { new MainMenuScreen(viewportAdapter, Services, this), new LoadGameScreen(viewportAdapter, Services), new OptionsScreen(viewportAdapter, Services), new AudioOptionsScreen(viewportAdapter, Services), new VideoOptionsScreen(viewportAdapter, Services), new KeyboardOptionsScreen(viewportAdapter, Services), new MouseOptionsScreen(viewportAdapter, Services), new HelpScreen(viewportAdapter, Services), _rpgScene }; foreach (var screen in screens) { screen.LoadContent(); _screenComponent.Register(screen); } }
/// <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); // TODO: use this.Content to load your game content here player.Load(Content); enemy.Load(Content); var ViewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, ScreenWidth, ScreenHeight); Camera = new Camera2D(ViewportAdapter); Camera.Position = new Vector2(0, ScreenHeight); Map = Content.Load <TiledMap>("Level1"); foreach (TiledTileLayer Layer in Map.TileLayers) { if (Layer.Name == "Collisions") { CollisionLayer = Layer; } } Arialfont = Content.Load <SpriteFont>("Arial"); Heart = Content.Load <Texture2D>("Heart"); AIE.StateManager.CreateState("Splash", new SplashState()); AIE.StateManager.CreateState("Game", new GameState()); AIE.StateManager.CreateState("GamerOver", new GameOverState()); AIE.StateManager.PushState("Splash"); foreach (TiledObjectGroup Group in Map.ObjectGroups) { if (Group.Name == "Enemies") { foreach (TiledObject Obj in Group.Objects) { Enemy enemy = new Enemy(this); enemy.Load(Content); enemy.Position = new Vector2(Obj.X, Obj.Y); Enemies.Add(enemy); } } if (Group.Name == "Goal") { TiledObject Obj = Group.Objects[0]; if (Obj != null) { AnimatedTexture Anim = new AnimatedTexture(Vector2.Zero, 0, 1, 1); Anim.Load(Content, "Goal", 1, 1); Goal = new Sprite(); Goal.Add(Anim, 0, 5); Goal.position = new Vector2(Obj.X, Obj.Y); } } } GameMusic = Content.Load <Song>("SuperHero_original_no_Intro"); MediaPlayer.Play(GameMusic); }
public override void LoadContent() { base.LoadContent(); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _camera = new Camera2D(viewportAdapter); _map = Content.Load <TiledMap>("level-1"); _mapRenderer = new TiledMapRenderer(GraphicsDevice); _entityComponentSystem = new EntityComponentSystem(); _entityFactory = new EntityFactory(_entityComponentSystem, Content); var service = new TiledObjectToEntityService(_entityFactory); var spawnPoint = _map.GetLayer <TiledMapObjectLayer>("entities").Objects.Single(i => i.Type == "Spawn").Position; _entityComponentSystem.RegisterSystem(new PlayerMovementSystem()); _entityComponentSystem.RegisterSystem(new EnemyMovementSystem()); _entityComponentSystem.RegisterSystem(new CharacterStateSystem(_entityFactory, spawnPoint)); _entityComponentSystem.RegisterSystem(new BasicCollisionSystem(gravity: new Vector2(0, 1150))); _entityComponentSystem.RegisterSystem(new ParticleEmitterSystem()); _entityComponentSystem.RegisterSystem(new AnimatedSpriteSystem()); _entityComponentSystem.RegisterSystem(new SpriteBatchSystem(GraphicsDevice, _camera) { SamplerState = SamplerState.PointClamp }); service.CreateEntities(_map.GetLayer <TiledMapObjectLayer>("entities").Objects); }
protected override void Initialize() { //Definir nova textura background = new Texture2D(graphics.GraphicsDevice, 18 * 18, 18 * 8); //Colorir a textura do background Color[] data = new Color[(18 * 18) * (18 * 8)]; for (int i = 0; i < data.Length; ++i) { data[i] = new Color(200, 212, 93); } background.SetData(data); //Criar novo jogo board = new Board(ui, coroutines, new Point(0, 0), panelColumns, panelRows - 1, (panelColumns * (panelRows - 1)) / 4, 12, 16, 16); //Criar camera 2D var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, (panelColumns * gridSize), (panelRows * gridSize)); camera = new Camera2D(viewportAdapter) { Position = Vector2.Zero }; base.Initialize(); }
/// <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); player.Load(Content, this); // Call the "Load" function in the Player class arialFont = Content.Load <SpriteFont>("Arial"); heart = Content.Load <Texture2D>("heart"); BoxingViewportAdapter viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height); camera = new Camera2D(viewportAdapter); camera.Position = new Vector2(0, graphics.GraphicsDevice.Viewport.Height); map = Content.Load <TiledMap>("Level1"); mapRenderer = new TiledMapRenderer(GraphicsDevice); // Load the game music gameMusic = Content.Load <Song>("SuperHero_original_no_Intro"); MediaPlayer.Play(gameMusic); SetUpTiles(); LoadObjects(); }
protected override void LoadContent() { var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _camera = new Camera2D(viewportAdapter); var titleScreen = LoadScreen(@"Content/title-screen.json"); var guiRenderer = new GuiSpriteBatchRenderer(GraphicsDevice, titleScreen.Skin.DefaultFont, _camera.GetViewMatrix); _guiSystem = new GuiSystem(viewportAdapter, guiRenderer) { Screen = titleScreen }; var panel = titleScreen.FindControl <GuiPanel>("MainPanel"); var closeButton = titleScreen.FindControl <GuiButton>("CloseButton"); closeButton.Clicked += (sender, args) => { panel.IsVisible = false; }; var quitButton = titleScreen.FindControl <GuiButton>("QuitButton"); quitButton.Clicked += (sender, args) => Exit(); _progressBar = titleScreen.FindControl <GuiProgressBar>("ProgressBar"); }
public Stage(ContentManager content, BoxingViewportAdapter view) { camera.Pos = new Vector2(0, 0); xmlMap.Load("Content/maps/teste.tmx"); /* Makes a list of every layer in the given stage */ xmlLayers = xmlMap.GetElementsByTagName("layer"); /* These instructions will determine the size of the stage matrix */ mapWidth = int.Parse(xmlMap.DocumentElement.Attributes.GetNamedItem("width").Value); mapHeight = int.Parse(xmlMap.DocumentElement.Attributes.GetNamedItem("height").Value); /* */ layers = new List <Tile[, ]>(); depthSorting = new Vector2[3, 3]; /* Makes an instance of the Texture List */ textureList = new Texture2D[2]; /* Sometimes the thread doesn't load everything, since it's all happening so fast */ //Thread tFillStageMatrix = new Thread(ConvertToInt); //tFillStageMatrix.Start(); LoadTextures(content); ChangeStage(1); mainCharacter = new Character(content, view); mainCharacter.setPosition(IsometricCoord.MapToIso(new Vector2(1, 1))); // X = J Y = I // The number inside this instruction tell // the position inside the matrix }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); _bitmapFont = Content.Load <BitmapFont>("Fonts/montserrat-32"); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _camera = new OrthographicCamera(viewportAdapter) { Zoom = 2.0f }; _sceneGraph = new SceneGraph(); var carHullTexture = Content.Load <Texture2D>("Textures/car-hull"); var carHullSprite = new Sprite(carHullTexture); var carWheelTexture = Content.Load <Texture2D>("Textures/car-wheel"); var carWheelSprite = new Sprite(carWheelTexture); _carNode = new SceneNode("car-hull", viewportAdapter.Center.ToVector2()); _carNode.Entities.Add(new SpriteEntity(carHullSprite)); _leftWheelNode = new SceneNode("left-wheel", new Vector2(-29, 17)); _leftWheelNode.Entities.Add(new SpriteEntity(carWheelSprite)); _rightWheelNode = new SceneNode("right-wheel", new Vector2(40, 17)); _rightWheelNode.Entities.Add(new SpriteEntity(carWheelSprite)); _carNode.Children.Add(_rightWheelNode); _carNode.Children.Add(_leftWheelNode); _sceneGraph.RootNode.Children.Add(_carNode); }
/// <summary> /// Sets up user interface using MonoGame.Extended.Gui. /// </summary> private void SetupUserInterface() { var viewportAdapter = new BoxingViewportAdapter( this.Window, this.GraphicsDevice, this.ScreenWidth, this.ScreenHeight); var guiRenderer = new GuiSpriteBatchRenderer(this.GraphicsDevice, () => Matrix.Identity); BitmapFont guiFont = this.Content.Load <BitmapFont>("fonts/PixelAzureBondsBitmap24"); BitmapFont.UseKernings = false; Skin.CreateDefault(guiFont); this.guiSystem = new GuiSystem(viewportAdapter, guiRenderer) { ActiveScreen = new MonoGame.Extended.Gui.Screen { Content = new StackPanel { Width = this.ScreenWidth, Height = this.ScreenHeight, } } }; this.guiSystem.ActiveScreen.Hide(); }
public void Init(BoxingViewportAdapter adapter) { //Create Controllers Drawer = new Controller_Draw(); Updater = new Controller_Update(); //Init drawer Drawer.Init(adapter); //Init ship Ship = new Ship(); //Init random Random = new Random(); //Init asteroid bag Asteroids = new Bag <Asteroid>(); //Init laser bag Lasers = new Bag <Laser>(); //Init explosion bag Explosions = new Bag <Explosion>(); //Init large asteroid textures bag LargeAsteroidTextures = new Bag <Texture2D>(); //Init small asteroid textures bag SmallAsteroidTextures = new Bag <Texture2D>(); //Init game vars Score = 0; Lives = 3; Level = 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. spriteBatch = new SpriteBatch(GraphicsDevice); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 1280, 720); camera = new OrthographicCamera(viewportAdapter); // TODO: use this.Content to load your game content here Player.LoadTextures(Content, GraphicsDevice); //player.GetCurrentLocation().LoadTextures(Content); testArea.LoadTextures(Content); slimeCity.LoadTextures(Content); slimeHut.LoadTextures(Content); InfoBox.LoadTextures(Content); InventoryItem.LoadTextures(Content); Tiles.Wall.LoadTextures(Content); font = Content.Load <SpriteFont>("NPCText"); ItemManager.LoadTextures(Content); }
public World(MainGame game, BoxingViewportAdapter viewport) { _game = game; _camera = new OrthographicCamera(viewport); _cameraScale = 4f; _camera.ZoomIn(_cameraScale); }
/// <summary> /// Initializes the visualizer and audio capture. /// </summary> protected override void Initialize() { IsMouseVisible = true; graphics.HardwareModeSwitch = false; graphics.PreferredBackBufferWidth = ViewportWidth; graphics.PreferredBackBufferHeight = ViewportHeight; //graphics.IsFullScreen = true; graphics.ApplyChanges(); viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, ViewportWidth, ViewportHeight); Camera = new Camera2D(viewportAdapter); soundIn = new WasapiLoopbackCapture(); //soundIn = new WasapiCapture(); soundIn.Initialize(); SoundInSource inSource = new SoundInSource(soundIn); ISampleSource sampleSource = inSource.ToSampleSource(); SetupSampleSource(sampleSource); byte[] buffer = new byte[source.WaveFormat.BytesPerSecond / 2]; inSource.DataAvailable += (s, e) => { int read; while ((read = source.Read(buffer, 0, buffer.Length)) > 0) ; }; soundIn.Start(); base.Initialize(); }
protected override void Initialize() { _gui = new Gui(_desktop); base.Initialize(); foreach (Blocks name in Enum.GetValues(typeof(Blocks))) { Materials.Add(name, Content.Load <Texture2D>(name.ToString())); } _virtualWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; _virtualHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, _virtualWidth, _virtualHeight); _world = new World(); Player1 = new Player(0, 0, _world); _cam = new OrthographicCamera(viewportAdapter); _cam.LookAt(new Vector2(Player.X, Player.Y)); _cam.Zoom = IRestrictions.Zoom; _spriteBatch = new SpriteBatch(GraphicsDevice); _playerMouse = new PlayerMouse(Content, _spriteBatch, _cam); _inputController = new InputController(_cam, _spriteBatch, Content, this, _world, Player1, _playerMouse); WorldRenderer = new WorldRenderer(_playerMouse, _inputController, _spriteBatch, this, _world); }
/// <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() { var virtualSize = SceneManager.Instance.VirtualSize; ViewportAdapter = new BoxingViewportAdapter(this.Window, GraphicsDevice, (int)virtualSize.X, (int)virtualSize.Y); base.Initialize(); }
/// <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); player.Load(Content); arialFont = Content.Load <SpriteFont>("Arial"); heart = Content.Load <Texture2D>("heart"); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, viewWidth, viewHeight); camera = new Camera2D(viewportAdapter); camera.Position = new Vector2(0, viewHeight); map = Content.Load <TiledMap>("Level"); mapRenderer = new TiledMapRenderer(GraphicsDevice); gameoverSound = Content.Load <Song>("GameOver"); winSound = Content.Load <Song>("Win"); foreach (TiledMapTileLayer layer in map.TileLayers) { if (layer.Name == "Solid") { collisionLayer = layer; } } gameMusic = Content.Load <Song>("SuperHero_original_no_Intro"); // TODO: use this.Content to load your game content here }
protected override void LoadContent() { var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 1280, 720); spriteBatch = new SpriteBatch(GraphicsDevice); fonte = Content.Load <SpriteFont>("font"); stage1 = new Stage(Content, viewportAdapter); }
protected override void LoadContent() { SpriteBatch = new SpriteBatch(GraphicsDevice); _boxingViewport = new BoxingViewportAdapter(Window, GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height); Camera = new OrthographicCamera(_boxingViewport); base.LoadContent(); }
protected override void Initialize() { var viewportadapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 600); _camera = new OrthographicCamera(viewportadapter); base.Initialize(); }
protected override void Initialize() { var viewPortAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); regularCoin.InitializeList(coins); camera = new Camera2D(viewPortAdapter); base.Initialize(); }
protected override void Initialize() { base.Initialize(); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _camera = new Camera2D(viewportAdapter); }
protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _camera = new Camera2D(viewportAdapter); }
protected override void LoadContent() { BoxingViewportAdapter viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, _width, _height); MainCamera = new Camera2D(viewportAdapter); SpriteBatch = new SpriteBatch(_graphics.GraphicsDevice); base.LoadContent(); }
/// <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); // TODO: use this.Content to load your game content here player.Load(Content); arialFont = Content.Load <SpriteFont>("Arial"); heart = Content.Load <Texture2D>("heart"); var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, (int)(graphics.GraphicsDevice.Viewport.Width), (int)(graphics.GraphicsDevice.Viewport.Height)); camera = new Camera2D(viewportAdapter); camera.Position = player.Position - new Vector2(ScreenWidth, ScreenHeight); map = Content.Load <TiledMap>("Level1"); foreach (TiledTileLayer layer in map.TileLayers) { if (layer.Name == "Collisions") { collisionLayer = layer; } } foreach (TiledObjectGroup group in map.ObjectGroups) { if (group.Name == "enemies") { foreach (TiledObject obj in group.Objects) { Enemy enemy = new Enemy(this); enemy.Load(Content); enemy.Position = new Vector2(obj.X, obj.Y); enemies.Add(enemy); } } if (group.Name == "goal") { TiledObject obj = group.Objects[0]; if (obj != null) { AnimatedTexture anim = new AnimatedTexture( Vector2.Zero, 0, 1, 1); anim.Load(Content, "chest", 1, 1); goal = new Sprite(); goal.Add(anim, 0, 5); goal.position = new Vector2(obj.X, obj.Y); } } } gameMusic = Content.Load <Song>("Superhero_Violin"); MediaPlayer.Play(gameMusic); }
public Camera(Scene scene) { this.scene = scene; _viewportWidth = scene.Graphics.Viewport.Width; _viewportHeight = scene.Graphics.Viewport.Height; var viewportAdapter = new BoxingViewportAdapter(scene.XNAWindow.Window, scene.Graphics, scene.XNAWindow.XResolution, scene.XNAWindow.YResolution); _internalCamera = new OrthographicCamera(viewportAdapter); }
protected override void LoadContent() { _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _backgroundTexture = Content.Load <Texture2D>("vignette"); _bitmapFontImpact = Content.Load <BitmapFont>("impact-32"); _bitmapFontMontserrat = Content.Load <BitmapFont>("montserrat-32"); _spriteBatch = new SpriteBatch(GraphicsDevice); }
public EditorState(MainGame g) : base(g) { var viewPortAdapter = new BoxingViewportAdapter(game.Window, graphics, 1920, 1080); cam = new Camera2D(viewPortAdapter); world = game.gameData.world; cam.Zoom = 1f; cam.MaximumZoom = 2f; cam.MinimumZoom = 0.5f; }
protected override void LoadContent() { var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); _camera = new OrthographicCamera(viewportAdapter); _spriteBatch = new SpriteBatch(GraphicsDevice); _backgroundTexture = Content.Load <Texture2D>("Textures/vignette"); _bitmapFont = Content.Load <BitmapFont>("Fonts/montserrat-32"); }