public OctoGame() : base() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.Window.Title = "OctoAwesome"; graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; this.IsMouseVisible = false; this.Window.AllowUserResizing = true; this.TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 15); int viewrange; if (int.TryParse(ConfigurationManager.AppSettings["Viewrange"], out viewrange)) { if (viewrange < 1) throw new NotSupportedException("Viewrange in app.config darf nicht kleiner 1 sein"); SceneComponent.VIEWRANGE = viewrange; } int viewheight; if (int.TryParse(ConfigurationManager.AppSettings["Viewheight"], out viewheight)) { if (viewheight < 1) throw new NotSupportedException("Viewheight in app.config darf nicht kleiner 1 sein"); SceneComponent.VIEWHEIGHT = viewheight; } ResourceManager.CacheSize = ((viewrange * 2) + 1) * ((viewrange * 2) + 1) * ((viewheight * 2) + 1) * 2; input = new InputComponent(this); input.UpdateOrder = 1; Components.Add(input); simulation = new SimulationComponent(this); simulation.UpdateOrder = 3; Components.Add(simulation); player = new PlayerComponent(this, input, simulation); player.UpdateOrder = 2; Components.Add(player); camera = new CameraComponent(this, player); camera.UpdateOrder = 4; Components.Add(camera); scene = new SceneComponent(this, player, camera); scene.UpdateOrder = 5; scene.DrawOrder = 1; Components.Add(scene); hud = new HudComponent(this, player, scene, input); hud.UpdateOrder = 6; hud.DrawOrder = 2; Components.Add(hud); }
public EntityComponent(OctoGame game, SimulationComponent simulation) : base(game) { Simulation = simulation; Entities = new List <Entity>(); graphicsDevice = game.GraphicsDevice; effect = new BasicEffect(graphicsDevice); }
public OctoGame() : base() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1080; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; Window.Title = "OctoAwesome"; IsMouseVisible = true; Window.AllowUserResizing = true; TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 15); int viewrange; if (int.TryParse(SettingsManager.Get("Viewrange"), out viewrange)) { if (viewrange < 1) throw new NotSupportedException("Viewrange in app.config darf nicht kleiner 1 sein"); SceneControl.VIEWRANGE = viewrange; } Simulation = new SimulationComponent(this); Simulation.UpdateOrder = 4; Components.Add(Simulation); Player = new PlayerComponent(this); Player.UpdateOrder = 2; Components.Add(Player); Camera = new CameraComponent(this); Camera.UpdateOrder = 3; Components.Add(Camera); Screen = new ScreenComponent(this); Screen.UpdateOrder = 1; Screen.DrawOrder = 1; Components.Add(Screen); Window.ClientSizeChanged += (s, e) => { if (Window.ClientBounds.Height == graphics.PreferredBackBufferHeight && Window.ClientBounds.Width == graphics.PreferredBackBufferWidth) return; graphics.PreferredBackBufferHeight = Window.ClientBounds.Height; graphics.PreferredBackBufferWidth = Window.ClientBounds.Width; graphics.ApplyChanges(); }; }
public PlayerComponent(Game game, SimulationComponent simulation) : base(game) { this.simulation = simulation; }
public OctoGame() : base() { //graphics = new GraphicsDeviceManager(this); //graphics.PreferredBackBufferWidth = 1080; //graphics.PreferredBackBufferHeight = 720; //Content.RootDirectory = "Content"; Title = "OctoAwesome"; IsMouseVisible = true; Icon = Properties.Resources.octoawesome; //Window.AllowUserResizing = true; Settings = new Settings(); ExtensionLoader = new ExtensionLoader(Settings); ExtensionLoader.LoadExtensions(); Service = new GameService(ResourceManager); //TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 15); int width = Settings.Get("Width", 1080); int height = Settings.Get("Height", 720); Window.ClientSize = new Size(width, height); Window.Fullscreen = Settings.Get("EnableFullscreen", false); if (Settings.KeyExists("Viewrange")) { var viewrange = Settings.Get <int>("Viewrange"); if (viewrange < 1) { throw new NotSupportedException("Viewrange in app.config darf nicht kleiner 1 sein"); } SceneControl.VIEWRANGE = viewrange; } Assets = new AssetComponent(this); Components.Add(Assets); Screen = new ScreenComponent(this); Screen.UpdateOrder = 1; Screen.DrawOrder = 1; Components.Add(Screen); KeyMapper = new KeyMapper(Screen, Settings); #region GameComponents DefinitionManager = new DefinitionManager(ExtensionLoader); //var persistenceManager = new DiskPersistenceManager(ExtensionLoader, DefinitionManager, Settings); //ResourceManager = new ResourceManager(ExtensionLoader, DefinitionManager, Settings, persistenceManager); ResourceManager = new ContainerResourceManager(); Player = new PlayerComponent(this, ResourceManager); Player.UpdateOrder = 2; Components.Add(Player); Simulation = new Components.SimulationComponent(this, ExtensionLoader, ResourceManager); Entity = new Components.EntityComponent(this, Simulation); Entity.UpdateOrder = 2; Components.Add(Entity); Camera = new CameraComponent(this); Camera.UpdateOrder = 3; Components.Add(Camera); Simulation.UpdateOrder = 4; Components.Add(Simulation); #endregion GameComponents /*Resize += (s, e) => * { * //if (Window.ClientBounds.Height == graphics.PreferredBackBufferHeight && * // Window.ClientBounds.Width == graphics.PreferredBackBufferWidth) * // return; * * //graphics.PreferredBackBufferHeight = Window.ClientBounds.Height; * //graphics.PreferredBackBufferWidth = Window.ClientBounds.Width; * //graphics.ApplyChanges(); * };*/ SetKeyBindings(); }
public PlayerComponent(Game game, SimulationComponent simulation) : base(game) { this.simulation = simulation; }
public PlayerComponent(Game game, InputComponent input, SimulationComponent simulation) : base(game) { this.simulation = simulation; this.input = input; }
public OctoGame() { //graphics = new GraphicsDeviceManager(this); //graphics.PreferredBackBufferWidth = 1080; //graphics.PreferredBackBufferHeight = 720; //Content.RootDirectory = "Content"; Title = "OctoAwesome"; IsMouseVisible = true; Icon = Properties.Resources.octoawesome; //Window.AllowUserResizing = true; Settings = new Settings(); ResourceManager.Settings = Settings; //TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 15); int width = 1080, height = 720; if (Settings.KeyExists("Width")) width = Settings.Get<int>("Width"); if (Settings.KeyExists("Height")) height = Settings.Get<int>("Height"); Window.ClientSize = new Size(width, height); if (Settings.KeyExists("EnableFullscreen") && Settings.Get<bool>("EnableFullscreen")) Window.Fullscreen = true; if (Settings.KeyExists("Viewrange")) { var viewrange = Settings.Get<int>("Viewrange"); if (viewrange < 1) throw new NotSupportedException("Viewrange in app.config darf nicht kleiner 1 sein"); SceneControl.VIEWRANGE = viewrange; } Assets = new AssetComponent(this); Components.Add(Assets); Simulation = new SimulationComponent(this); Simulation.UpdateOrder = 4; Components.Add(Simulation); Player = new PlayerComponent(this); Player.UpdateOrder = 2; Components.Add(Player); Camera = new CameraComponent(this); Camera.UpdateOrder = 3; Components.Add(Camera); Screen = new ScreenComponent(this); Screen.UpdateOrder = 1; Screen.DrawOrder = 1; Components.Add(Screen); KeyMapper = new KeyMapper(Screen, Settings); /*Resize += (s, e) => { //if (Window.ClientBounds.Height == graphics.PreferredBackBufferHeight && // Window.ClientBounds.Width == graphics.PreferredBackBufferWidth) // return; //graphics.PreferredBackBufferHeight = Window.ClientBounds.Height; //graphics.PreferredBackBufferWidth = Window.ClientBounds.Width; //graphics.ApplyChanges(); };*/ SetKeyBindings(); }
public PlayerComponent(Game game, InputComponent input, SimulationComponent simulation) : base(game) { this.simulation = simulation; this.input = input; }