// Class constructor public CSpong() { try { // Pre-load images mcPaddleImage = Image.FromFile("../../Data/Images/SpongPaddle.png"); mcBallImage = Image.FromFile("../../Data/Images/SpongBall.png"); // Pre-load sounds CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/SpongBallBounce.wav", FMOD.MODE.DEFAULT, ref msSoundBallBounce), "FMOD Create Sound Error"); CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/SpongBallDied.wav", FMOD.MODE.DEFAULT, ref msSoundBallDied), "FMOD Create Sound Error"); CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/SpongGameOver.wav", FMOD.MODE.DEFAULT, ref msSoundGameOver), "FMOD Create Sound Error"); } catch (Exception e) { MessageBox.Show(e.ToString(), "Exception caught"); } // Seed the Random number generator mcRandom = new Random(Environment.TickCount); // Mouse turned off by default mbMouseEnabled = false; miMouseYLastFrame = 0; // Setup the Walls mrLeftWall = new Rectangle(60, 50, 10, 460); mrRightWall = new Rectangle(770, 50, 10, 460); mrTopWall = new Rectangle(60, 50, 720, 10); mrBottomWall = new Rectangle(60, 500, 720, 10); // Setup the Pitch Meter mcPitchMeter = new CPitchMeter(26, 125); mcPitchMeter.ShowHalfPointMarker(true); // Setup the Fonts mcFontText = new Font("Arial", 20, FontStyle.Regular); mcFontPause = new Font("Arial", 50, FontStyle.Regular); // Set the other variables default values Reset(); }
// Form Constructor public formProfileSettings() { // Initializes form controls InitializeComponent(); try { // Pre-load images // Pre-load Sounds CFMOD.CheckResult(CFMOD.GetSystem().createSound("../../Data/Sounds/ProfileSettingsExample.wav", FMOD.MODE.DEFAULT, ref msSoundPitchTransitionExample), "FMOD Create Sound Error"); } catch (Exception e) { MessageBox.Show(e.ToString(), "Exception caught"); } // Setup the Update Timer mcUpdateTimer = new Timer(); mcUpdateTimer.Tick += new EventHandler(UpdateTimer_Tick); mcUpdateTimer.Interval = 16; mcUpdateTimer.Enabled = true; mcUpdateTimer.Start(); // Set all of the Pitch Hits to zero for (int i = 0; i < miaPitchHits.Length; i++) { miaPitchHits[i] = 0; } // Display the Profiles in the Profiles combo box UpdateShownProfilesAndCurrentSettings(); // Set the initial Pitch Meter Indicators position mcPitchMeter = new CPitchMeter(350, 125); mcPitchMeter.ShowHalfPointMarker(true); }