public Game() { // Create the main window window = new RenderWindow(new VideoMode(Configuration.Width, Configuration.Height), "Simulation", Styles.Fullscreen); // Set our frame rate to 60fps so the screen is responsive. window.SetFramerateLimit(60); // Handle window events window.Closed += OnClose; window.Resized += OnResize; // Create a simulation screen. Note that screens can be stacked on top of one another // in the screen manager that has been omitted from this specific repository. screen = new SimulationScreen(window, Configuration.SinglePlayer); // Create our world world = new World(); // Clock to track frame time. If we dont do this, and instead assume we are hitting 60fps, we can get stutters // in our camera movement. clock = new Clock(); // Create a new generation clock to only DoGeneration once per second. generationClock = new Clock(); }
/// <summary> /// Initialises a new instance of the <see cref="Program"/> class, /// </summary> static Program() { ReadConfigFile(); bodies = BodyGenerator.GenerateBodies(configuration.BodyCount, true); bodyShapeMap = BodyGenerator.GenerateShapes(bodies, BodyGenerator.DefaultRadiusDelegate, BodyGenerator.RainbowColourDelegate); UpdateDelegate bodyPositionUpdater = BodyUpdater.UpdateBodiesBarnesHut; ContextSettings customContextSettings = new ContextSettings { AntialiasingLevel = 8, DepthBits = 24, StencilBits = 8 }; RenderWindow simulationWindow = new RenderWindow(VideoMode.DesktopMode, "N-Body Simulation: FPS ", Styles.Default, customContextSettings); PrintContextSettings(customContextSettings); IInputHandler simulationInputHandler = new SimulationInputHandler(ref bodies); simulationScreen = new SimulationScreen(simulationWindow, simulationInputHandler, ref bodies, ref bodyShapeMap, bodyPositionUpdater) { Configuration = configuration, }; }
public Game() { // Create the main window window = new RenderWindow(new VideoMode(Configuration.Width, Configuration.Height), "Simulation"); window.SetFramerateLimit(1); // Handle window events window.Closed += OnClose; // Create a simulation screen. Note that screens can be stacked on top of one another // in the screen manager that has been omitted from this specific repository. screen = new SimulationScreen(window, Configuration.SinglePlayer); // Create our world world = new World(); }
public Game() { // Create the main window window = new RenderWindow( new VideoMode(Configuration.Width, Configuration.Height), "World Simulation", Styles.Fullscreen, new ContextSettings() { AntialiasingLevel = 8 }); // Set our frame rate to 60fps so the screen is responsive. window.SetFramerateLimit(60); // Handle window events window.Closed += OnClose; window.Resized += OnResize; // Create our world world = new World(); screenManager = new ScreenManager(window); // Create a simulation screen. Note that screens can be stacked on top of one another // in the screen manager that has been omitted from this specific repository. pathScreen = new SimulationScreen(window, Configuration.SinglePlayer); paretoScreen = new ParetoVisualScreen(window, Configuration.SinglePlayer, world.Population); // Add the screens to the manager screenManager.AddScreen(paretoScreen); screenManager.AddScreen(pathScreen); // Configure the pareto screen to be centred, hidden & appropriately sized SetParetoConfiguration(); // Clock to track frame time. If we dont do this, and instead assume we are hitting 60fps, we can get stutters // in our camera movement. clock = new Clock(); // Create a new generation clock to only DoGeneration once per second. generationClock = new Clock(); }