public frmGame() { InitializeComponent(); try { // graphics quality this.graphics = this.CreateGraphics(); this.graphics.SmoothingMode = SmoothingMode.HighQuality; this.graphics.CompositingMode = CompositingMode.SourceCopy; this.graphics.CompositingQuality = CompositingQuality.HighQuality; // background image string path = ConfigurationManager.AppSettings["pathImages"]; this.BackgroundImage = Image.FromFile(path + "GameBackground.png", false); // get the input method (keyboard/mouse) from settings string input = ConfigurationManager.AppSettings["input"]; this.inputType = (input == "Mouse" ? Balls.eInputType.Mouse : Balls.eInputType.Keyboard); if (inputType == Balls.eInputType.Mouse) { this.MouseMove += new MouseEventHandler(this.frmGame_MouseMove); } // world objects this.balls = new Balls(inputType); this.board = new Board(1); this.playerPad = new PlayerPad(); this.outputLine = new OutputLine(); this.gameControl = new GameControl(); this.scoreBoard = new ScoreBoard(); this.highScores = new HighScores(); this.particlesSystem = new ParticlesSystem(); this.collisionsSystem = new CollisionsSystem(); // add the listeners for objects comunication this.playerPad.DoubleBallRewardEvent += new PlayerPad.DoubleBallEventHandler(balls.DoubleBallEvent); this.playerPad.TripleBallRewardEvent += new PlayerPad.TripleBallEventHandler(balls.TripleBallEvent); this.playerPad.WinLevelRewardEvent += new PlayerPad.WinLevelEventHandler(gameControl.WinLevelEvent); this.playerPad.SlowBallRewardEvent += new PlayerPad.SlowBallEventHandler(balls.SlowBallEvent); this.playerPad.DemolitionBallRewardEvent += new PlayerPad.DemolitionBallEventHandler(balls.DemolitionBallEvent); // start this.tmrStart.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
public void Awake() { DontDestroyOnLoad(this); if (dust == null) { dust = this; } else { DestroyObject(gameObject); } }
public Window(GameWindowSettings gameWindowSettings, NativeWindowSettings nativeWindowSettings) : base(gameWindowSettings, nativeWindowSettings) { Load_resources(); m_entities = new List <Entity>(); ScreenSize = new vec2(1024.0f, 576.0f); var texture = m_textures.GetResource("test"); m_subTexs.AddResouce(0, SubTexture.CreateFromCoords(texture.textureID, new vec2(texture.Width, texture.Height), new vec2(1, 0), new vec2(64, 64))); props = ParticleProps.Effect2; props.Gravity = 0.0f; emiter = new ParticlesSystem(); }
private void GenerateExplosion() { int num = random.Next(1, 4); switch (num) { case 1: ExplodeEffect explodeEfect = new ExplodeEffect(this.Location); ParticlesSystem.RegisterEfect(explodeEfect); break; case 2: ExplodeEffectAlt explodeEfectAlt = new ExplodeEffectAlt(this.Location); ParticlesSystem.RegisterEfect(explodeEfectAlt); break; case 3: RainEffect rainEfect = new RainEffect(this.Location); ParticlesSystem.RegisterEfect(rainEfect); break; } }
public PlayerTest(Texture texture) : base(texture) { m_particleEmiter = new ParticlesSystem(); m_particleProps = new ParticleProps(); }