public MainWindow() { InitializeComponent(); _timer.reset(); _world1.getParticles().Add(_particle1); _world1.getParticles().Add(_particle2); _world1.getParticles().Add(_particle3); _world1.getParticles().Add(_particle4); _world1.getParticles().Add(_particleUser); _groundContactGenerator.init(_world1.getParticles()); _sphereContactGenerator.init(_world1.getParticles()); _world1.getForceRegistry().add(_particle1, _g); _world1.getForceRegistry().add(_particle2, _g); _world1.getForceRegistry().add(_particle3, _g); _world1.getForceRegistry().add(_particle4, _g); _world1.getForceRegistry().add(_particleUser, _g); _world1.getForceRegistry().add(_particleUser, _u); _world1.getContactGenerators().Add(_groundContactGenerator); _world1.getContactGenerators().Add(_sphereContactGenerator); _timer.start(); CompositionTarget.Rendering += UpdateChildren; }
public GameApplication(GameConfig game_cfg, GameWindow gameWindow) { Config = game_cfg; _gameWindow = gameWindow; Width = Config.WindowConfig.ScreenWidth; Height = Config.WindowConfig.ScreenHeight; _timer = new GameTimer(); world1 = new ParticleWorld(300, 16); respawn = new ParticleRespawn(1, 3); //radialWind = new ParticleWind(new ge.Vec3(100.0f, 100.0f, 0.0f), 10000.0f, 10.0f); //radialWind2 = new ParticleWind(new ge.Vec3(500.0f, 300.0f, 0.0f), 6000.0f, 15.0f); particleArray = new Particle[particleCount + freeParticles]; for (int i = 0; i < (particleCount + freeParticles); ++i) { particleArray[i] = new Particle(); } particleGravityArray = new ParticleGravity[(particleCount + freeParticles)]; //particleGravityArray2 = new ParticleGravity[(particleCount + freeParticles)]; for (int i = 0; i < (particleCount + freeParticles); i++) { world1.getParticles().Add(particleArray[i]); } groundContactGenerator = new GroundContact(); groundContactGenerator.init(world1.getParticles()); particleRods = new ParticleRod[cablesCount]; sphereContactGenerator = new SphereContact(); sphereContactGenerator.init(world1.getParticles()); world1.getContactGenerators().Add(groundContactGenerator); world1.getContactGenerators().Add(sphereContactGenerator); }