コード例 #1
0
        public void LoadContent(ContentManager Content, WindowsGame1.Game1 gaming)
        {
            content = Content;
            gaming.IsMouseVisible = true;
            textureLevel          = Content.Load <Texture2D>(@"images\level_chk");
            textureDeform         = Content.Load <Texture2D>(@"images\deform");
            textureman            = Content.Load <Texture2D>(@"images\man3");
            font  = Content.Load <SpriteFont>(@"Fonts\ScoreFont");
            windy = Content.Load <SoundEffect>("Audios\\wind");
            mScrollingBackground = new HorizontallyScrollingBackground(gaming.GraphicsDevice.Viewport);
            mScrollingBackground.AddBackground(@"images\Clear1");

            // Declare an array to hold the pixel data
            pixelDeformData    = new uint[(textureDeform.Width) * (textureDeform.Height)];
            chk_pixelLevelData = new uint[textureLevel.Width * textureLevel.Height];

            pixelLevelData = new uint[textureLevel.Width * textureLevel.Height];


            // Populate the array

            textureLevel.GetData(chk_pixelLevelData, 0, textureLevel.Width * textureLevel.Height);
            // Populate the array
            textureDeform.GetData(pixelDeformData, 0, textureDeform.Width * textureDeform.Height);


            //Load the content for the Scrolling background
            mScrollingBackground.LoadContent(Content);
            temp_dis = temptime / 60;
        }
コード例 #2
0
 private void MenuEventHandler(Screen s,MenuEventType et)
 {
     if (s is MenuScreen)
     {
         if (et == MenuEventType.Exit) Exit();
         else if (et == MenuEventType.Continue)
         {
             nextScreen = gameScreen;
             toBeRemoved.Add(s);
         }
         else if (et == MenuEventType.MainMenu)
         {
             nextScreen = titleScreen;
             toBeRemoved.Add(s);
         }
         else if (et == MenuEventType.Start)
         {
             gameScreen = new WindowsGame1.Game1();
             gameScreen.Initialize(Services);
             gameScreen.LoadContent();
             gameScreen.Event += new Game1.EventHandler(MenuEventHandler);
             nextScreen = gameScreen;
             toBeRemoved.Add(s);
         }
         Console.Out.WriteLine("Title!" + et);
     }
     else if (s == gameScreen)
     {
         if(et == MenuEventType.Load){
                 loadingScreen = new LoadingScreen();
                 loadingScreen.Initialize(Services);
                 loadingScreen.LoadContent();
                 nextScreen = loadingScreen;
                 toBeRemoved.Add(s);
         }
         if (et == MenuEventType.Pause)
         {
             pauseScreen = new PauseScreen();
             pauseScreen.Initialize(Services);
             pauseScreen.LoadContent();
             pauseScreen.Event += new PauseScreen.EventHandler(MenuEventHandler);
             nextScreen = pauseScreen;
             toBeRemoved.Add(s);
         }
         else if (et == MenuEventType.Exit)
         {
             gameScreen = null;
             nextScreen = titleScreen;
             toBeRemoved.Add(s);
         }
     }
 }