private Ballz() { Teamnames = new List<string>(); Graphics = new GraphicsDeviceManager(this); InitSettings(); Content.RootDirectory = "Content"; if(GameSettings.MSAASamples.Value > 1) { Graphics.PreferMultiSampling = true; msaaSettingsHandler = (object sender, PreparingDeviceSettingsEventArgs args) => { args.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = GameSettings.MSAASamples.Value; }; Graphics.PreparingDeviceSettings += msaaSettingsHandler; } Graphics.IsFullScreen = GameSettings.Fullscreen.Value; Graphics.PreferredBackBufferHeight = GameSettings.ScreenResolution.Value.Height; Graphics.PreferredBackBufferWidth = GameSettings.ScreenResolution.Value.Width; Window.AllowUserResizing = true; IsFixedTimeStep = false; Camera = new Camera(); // create the Game Components MenuRenderer = new MenuRenderer(this); //var physics = new PhysicsControl(this); Input = new InputTranslator(this); Network = new Network.Network(this); Components.Add(Input); //Components.Add(physics); Components.Add(Network); Components.Add(MenuRenderer); Components.Add(new PerformanceRenderer(this)); Logic = new LogicControl(this); Services.AddService(Logic); Services.AddService(Input); Services.AddService(new SoundControl(this)); //add eventhandlers to events Input.Input += Logic.HandleInputMessage; //input.Input += physics.HandleMessage; Input.Input += Network.HandleMessage; //Logic.Message += physics.HandleMessage; Logic.Message += Network.HandleMessage; //Logic.Message += gameRendering.HandleMessage; Logic.Message += MenuRenderer.HandleMessage; Network.Message += Logic.HandleNetworkMessage; }
private Ballz() { Graphics = new GraphicsDeviceManager(this); initSettings(); Content.RootDirectory = "Content"; Graphics.IsFullScreen = GameSettings.Fullscreen.Value; Graphics.PreferredBackBufferHeight = GameSettings.ScreenResolution.Value.Height; Graphics.PreferredBackBufferWidth = GameSettings.ScreenResolution.Value.Width; Window.AllowUserResizing = true; IsFixedTimeStep = false; Camera = new Camera(); // create the Game Components var menuRendering = new MenuRenderer(this, DefaultMenu()); //var physics = new PhysicsControl(this); var input = new InputTranslator(this); Network = new Network.Network(this); Components.Add(input); //Components.Add(physics); Components.Add(Network); Components.Add(menuRendering); Components.Add(new PerformanceRenderer(this)); MainMenu = DefaultMenu(); Logic = new LogicControl(this); Services.AddService(Logic); Services.AddService(input); Services.AddService(new SoundControl(this)); //add eventhandlers to events input.Input += Logic.HandleInputMessage; //input.Input += physics.HandleMessage; input.Input += Network.HandleMessage; //Logic.Message += physics.HandleMessage; Logic.Message += Network.HandleMessage; //Logic.Message += gameRendering.HandleMessage; Logic.Message += menuRendering.HandleMessage; Network.Message += Logic.HandleNetworkMessage; }
/// <summary> /// Checks the input mode. /// TODO: refactor the Menu logic to a menuLogic class or use a partial class definition as this file seems to become messy /// </summary> void CheckInputMode(InputTranslator translator) { if (rawInput) translator.Mode = InputTranslator.InputMode.RAW; }
/// <summary> /// Checks the input mode. /// TODO: refactor the Menu logic to a menuLogic class or use a partial class definition as this file seems to become messy /// </summary> void CheckInputMode(InputTranslator translator) { if (rawInput) { translator.Mode = InputTranslator.InputMode.RAW; ButtonRepeat.Stop(); ButtonDelay.Stop(); } }