当前位置: 首页>>代码示例>>C#>>正文


C# ScreenManager类代码示例

本文整理汇总了C#中ScreenManager的典型用法代码示例。如果您正苦于以下问题:C# ScreenManager类的具体用法?C# ScreenManager怎么用?C# ScreenManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScreenManager类属于命名空间,在下文中一共展示了ScreenManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        public static void Init(ScreenManager nScreenManager)
        {
            mScreenManager = nScreenManager;

            string[] pieces;
            string relpath;
            bool inSounds;
            foreach (string filepath in Directory.GetFiles(Directory.GetCurrentDirectory() + "\\" + mScreenManager.Content.RootDirectory + "\\Sounds", "*.wav", SearchOption.AllDirectories))
            {
                pieces = filepath.Split('\\');
                relpath = "";
                inSounds = false;
                foreach (string piece in pieces)
                {
                    if (piece == "Content")
                    {
                        inSounds = true;
                    }
                    else if (inSounds)
                    {
                        if (!piece.Contains('.'))
                        {
                            relpath += piece + "\\";
                        }
                        else
                        {
                            relpath += piece.Substring(0, piece.Length - (piece.Length - piece.LastIndexOf('.')));
                        }
                    }
                }
                relpath = relpath.Replace('\\', '/');
                mSounds.Add(relpath.Substring(relpath.LastIndexOf('/') + 1), mScreenManager.Content.Load<SoundEffect>(relpath));
            }
        }
开发者ID:WilHall,项目名称:hakyn-client,代码行数:34,代码来源:Sfx.cs

示例2: CircularGame

        public CircularGame()
        {
            Window.Title = "Circular";
            _graphics = new GraphicsDeviceManager ( this ) {
                                                               PreferMultiSampling = true,
                                                               PreferredBackBufferWidth = 1280,
                                                               PreferredBackBufferHeight = 720
                                                           };

            #if WINDOWS || XBOX
            ConvertUnits.SetDisplayUnitToSimUnitRatio ( 24f );
            IsFixedTimeStep = true;
            #elif WINDOWS_PHONE
            _graphics.PreferredBackBufferWidth = 800;
            _graphics.PreferredBackBufferHeight = 480;
            ConvertUnits.SetDisplayUnitToSimUnitRatio(16f);
            IsFixedTimeStep = false;
            #endif

            #if WINDOWS
            _graphics.IsFullScreen = false;
            #elif XBOX || WINDOWS_PHONE
            _graphics.IsFullScreen = true;
            #endif

            Content.RootDirectory = "Content";

            //new-up components and add to Game.Components
            ScreenManager = new ScreenManager ( this );
            Components.Add ( ScreenManager );

            var frameRateCounter = new FPSComponent ( ScreenManager ) { DrawOrder = 101 };
            Components.Add ( frameRateCounter );
        }
开发者ID:headdetect,项目名称:Circular,代码行数:34,代码来源:CircularGame.cs

示例3: Main

 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 public static void Main()
 {
     using (ScreenManager scrManager = new ScreenManager())
     {
         scrManager.Run();
     }
 }
开发者ID:Zieg,项目名称:XNAsteroids_Astrofighter3000X,代码行数:10,代码来源:Program.cs

示例4: FarseerPhysicsGame

        public FarseerPhysicsGame(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtFPS, TextBlock txtDebug)
            : base(userControl, drawingCanvas, debugCanvas, txtDebug)
        {
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);
            IsFixedTimeStep = true;

            //new-up components and add to Game.Components
            ScreenManager = new ScreenManager(this);
            Components.Add(ScreenManager);

            if (txtFPS != null)
            {
                FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager, txtFPS);
                Components.Add(frameRateCounter);
            }

            Demo1Screen demo1 = new Demo1Screen();
            Demo2Screen demo2 = new Demo2Screen();
            Demo3Screen demo3 = new Demo3Screen();
            Demo4Screen demo4 = new Demo4Screen();
            Demo5Screen demo5 = new Demo5Screen();
            Demo6Screen demo6 = new Demo6Screen();
            Demo7Screen demo7 = new Demo7Screen();
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo1.GetTitle(), demo1);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo2.GetTitle(), demo2);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo3.GetTitle(), demo3);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo4.GetTitle(), demo4);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo5.GetTitle(), demo5);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo6.GetTitle(), demo6);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo7.GetTitle(), demo7);

            ScreenManager.GoToMainMenu();
        }
开发者ID:tinco,项目名称:Farseer-Physics,代码行数:33,代码来源:FarseerPhysicsGame.cs

示例5: Graphics

        public Graphics()
        {
            this.graphics = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth = Convert.ToInt32(ProgramSettings.ResolutionWidth);
            this.graphics.PreferredBackBufferHeight = Convert.ToInt32(ProgramSettings.ResolutionHeight);
            this.graphics.IsFullScreen = ProgramSettings.FullscreenMode;
            Content.RootDirectory = "Content";

            // Create the screen factory and add it to the Services
            screenFactory = new ScreenFactory();
            Services.AddService(typeof(IScreenFactory), screenFactory);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);
            screenManager.GraphicsDeviceManager = this.graphics;

            MultiInputManager manager = new MultiInputManager();
            if (ProgramSettings.KinectEnabled && KinectHelper.Instance().isRunning())
                manager.AddInputDevice(new GestureEventManager());

            screenManager.OtherInput = manager;
            Components.Add(screenManager);

            // Create the first screen
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);
        }
开发者ID:VincentBLortie,项目名称:Virtual-Anatomy-Lab,代码行数:27,代码来源:Graphics.cs

示例6: Initialize

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _screens = new ScreenManager(this);
            Components.Add(_screens);

            base.Initialize();
        }
开发者ID:Raion,项目名称:Samurai,代码行数:13,代码来源:SamuraiGame.cs

示例7: Platformer

        public Platformer()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            screenManager = new ScreenManager(this);
        }
开发者ID:GarethIW,项目名称:Platformer,代码行数:7,代码来源:Platformer.cs

示例8: Graphics

        public Graphics(Game game, SpriteBatch spriteBatch, ContentManager contentManager, GraphicsDeviceManager graphicsDeviceManager)
        {
            this.spriteBatch = spriteBatch;
            this.contentManager = contentManager;
            this.graphicsDeviceManager = graphicsDeviceManager;

            screenManager = new ScreenManager();
            overlayManager = new OverlayManager();

            textures = new Dictionary<string, Texture2D>();
            spriteFonts = new Dictionary<string, SpriteFont>();

            //Hooking up initial event so we can notify and shit.
            game.Window.ClientSizeChanged += (sender, e) =>
            {
                if(ResolutionChanged != null)
                {
                    Rectangle newSize = new Rectangle(0, 0,
                        graphicsDeviceManager.GraphicsDevice.Viewport.Width,
                        graphicsDeviceManager.GraphicsDevice.Viewport.Height
                    );
                    ResolutionChanged(this, newSize);
                }
            };

            _Rectangle = new Texture2D(graphicsDeviceManager.GraphicsDevice, 1, 1);
            _Rectangle.SetData(new Color[] { Color.White });
        }
开发者ID:Luigifan,项目名称:Minecraft2D,代码行数:28,代码来源:Graphics.cs

示例9: Game1

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            GameServices.AddService<GraphicsDeviceManager>(graphics);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferHeight = (int)(1080);
            graphics.PreferredBackBufferWidth = (int)(1920);

            graphics.PreferredBackBufferHeight = (int)(720);
            graphics.PreferredBackBufferWidth = (int)(1280);

            graphics.IsFullScreen = false;

            Window.Title = "The Drunken Dream Maker (With a Cold)";

            ScreenManager = new ScreenManager(this);
            ScreenManager.initParameters();
            Components.Add(ScreenManager);

            SoundManager = new SoundManager(this);
            Components.Add(SoundManager);

            particleComponent = new ParticleComponent(this);
            Components.Add(particleComponent);

               // FrameRateCounter myFrameCounter = new FrameRateCounter(this, new Vector2(25, 25), Color.White, Color.Black);
               // Components.Add(myFrameCounter);
        }
开发者ID:rroveri,项目名称:triolozzi,代码行数:29,代码来源:Game1.cs

示例10: FrameRateCounter

		public FrameRateCounter(ScreenManager screenManager)
            : base(screenManager.Game)
        {
            _screenManager = screenManager;
            _format = new NumberFormatInfo();
            _format.NumberDecimalSeparator = ".";
        }
开发者ID:ayls,项目名称:Ayls.Game.Framework,代码行数:7,代码来源:FramerateCounterComponent.cs

示例11: SpriteManager

        public SpriteManager(ContentManager c, ScreenManager s)
        {
            isNetworkGame = false;
            screenManager = s;
            content = c;
            screenWidth = screenManager.GraphicsDevice.Viewport.Width;
            screenHeight = screenManager.GraphicsDevice.Viewport.Height;
            titleSafeLeft = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Left;
            titleSafeTop = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Top;
            titleSafeBottom = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Bottom;
            titleSafeRight = screenManager.GraphicsDevice.Viewport.TitleSafeArea.Right;

            player = new UserControlledSprite(content.Load<Texture2D>(@"images\player1"),
            new Vector2(screenWidth / 2, screenHeight / 2),
            new Point(156, 128), 10, new Point(1, 1), new Point(4, 1), new Vector2(6, 6), 120);

            #if(XBOX360)
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 10),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 80),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 65, titleSafeTop + 150),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            #else
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 30),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 100),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            lifeList.Add(new MeatSprite(content.Load<Texture2D>(@"images\parm"), 0, new Vector2(titleSafeRight - 100, titleSafeTop + 170),
                                new Point(65, 65), 0, new Point(0, 0), new Point(0, 0), new Vector2(0, 0)));
            #endif
        }
开发者ID:nchoumitsky,项目名称:Meatieroids,代码行数:32,代码来源:SpriteManager.cs

示例12: Pixelize

        /// <summary>
        /// A Bubbles transition
        /// </summary>
        /// <param name="sceneManager">The <c>SceneManager</c></param>
        public Pixelize(ScreenManager sceneManager)
            : base(sceneManager)
        {
            waitTime = 200;
            div = 5;

            larguraColuna = viewport.Height / div;
            alturaLinha = viewport.Height / div;

            colunas = (viewport.Width / larguraColuna) + 1;
            linhas = viewport.Height / alturaLinha;

            int larguratotal = larguraColuna * colunas;
            offset = (larguratotal - viewport.Width) / 2;

            quant = colunas * linhas;

            quadrados = new List<Quadrado>(quant);
            posicoes = new List<Vector2>(quant);

            for (int i = 0; i < colunas; i++)
                for (int j = 0; j < linhas; j++)
                    posicoes.Add(new Vector2((i*larguraColuna)-offset, (j*alturaLinha)));

            newsize = new Vector2(larguraColuna, alturaLinha);
        }
开发者ID:BGCX261,项目名称:zone-of-fighters-svn-to-git,代码行数:30,代码来源:Pixelize.cs

示例13: Initialize

 public override void Initialize(GraphicsDevice Device, ScreenManager manager)
 {
     base.Initialize(Device, manager);
     Settings.LoadSettings();
     Panel panel = new Panel(this, new Vector2(300, 160), new Vector2(200, 280), Content.ContentInterface.LoadTexture("UITest"));
     Button button = new Button(this, new Vector2(60, 30), new Vector2(80, 40), Content.ContentInterface.LoadTexture("UITest"),
         delegate { Settings.ServerAddress = "localhost";
             _manager.RemoveScreen(this); GameScreen screen = new GameScreen();
             screen.SetupLocalServer(); _manager.AddScreen(screen); },
         "Local");
     AddChild(panel);
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 90), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { _manager.RemoveScreen(this); _manager.AddScreen(new GameScreen()); },
     "Online");
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 150), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { Console.WriteLine("Test2"); },
     "Testbutton2");
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 210), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { Console.WriteLine("Test3"); },
     "Testbutton3");
     panel.AddChild(button);
 }
开发者ID:MyEyes,项目名称:Igorr,代码行数:25,代码来源:MainMenuScreen.cs

示例14: Puzzle3D

		public Puzzle3D() {
			if( mInstance != null )
				throw new InvalidOperationException( "Only one instance of Puzzle3D may be created." );

			mInstance = this;

			graphics = new GraphicsDeviceManager( this );
			graphics.MinimumVertexShaderProfile = ShaderProfile.VS_2_0;
			graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;

			graphics.PreferredBackBufferWidth = 800;
			graphics.PreferredBackBufferHeight = 600;
			Window.AllowUserResizing = true;
			graphics.IsFullScreen = false;

			Content.RootDirectory = "Content";

			ScreenManager screenManager = new ScreenManager( this );
			Components.Add( screenManager );

			PictureDatabase.Initialize();
			if( PictureDatabase.Count >= 2 ) {
				screenManager.AddScreen( new MainMenuScreen() );
			} else {
				MessageBoxScreen messageBox = new MessageBoxScreen( "Unable to find enough pictures to play.", false );
				messageBox.Accepted += new EventHandler<EventArgs>( messageBox_Accepted );
				screenManager.AddScreen( messageBox );
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:29,代码来源:Core.cs

示例15: SpeedTrainerHud

        public SpeedTrainerHud(ScreenManager screenManager, Metronome metronome, Rectangle rect)
            : base(screenManager, metronome, rect)
        {
            // Initialize Texts
            mTexts = new [,]{{"Increase By", "BMP"},{"Increase After", "Bars"},{ "Increase Up To", "BMP"}};
            mTextPositions = new Vector2[mTexts.GetLength(0)];
            for (var i = 0; i < mTexts.GetLength(0); i++)
            {
                var xpos = mRectangle.X + 10;
                var ypos = mRectangle.Y + 70 + i * 40;
                mTextPositions[i] = new Vector2(xpos, ypos);
            }

            // Initialize TextBoxes
            mTextBoxes = new TextBox[mTexts.GetLength(0)];
            for (var i = 0; i < mTextBoxes.Length; i++)
            {
                mTextBoxes[i] = new TextBox(new Rectangle(mRectangle.X + mRectangle.Width - 120, (int) mTextPositions[i].Y, 60, 25), true);
            }

            mTextBoxes[0].SetDefaultText("10");
            mTextBoxes[1].SetDefaultText("8");
            mTextBoxes[2].SetDefaultText("200");

            // Initialize values from Metronome
            mTextBoxes[0].SetText(mMetronome.mIncreaseBy.ToString());
            mTextBoxes[1].SetText(mMetronome.mIncreaseAfter.ToString());
            mTextBoxes[2].SetText(mMetronome.mIncreaseUpTo.ToString());
        }
开发者ID:flackbash,项目名称:Drumtronome,代码行数:29,代码来源:SpeedTrainerHud.cs


注:本文中的ScreenManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。