本文整理汇总了C#中GameStateManagement.ScreenManager类的典型用法代码示例。如果您正苦于以下问题:C# ScreenManager类的具体用法?C# ScreenManager怎么用?C# ScreenManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScreenManager类属于GameStateManagement命名空间,在下文中一共展示了ScreenManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoadingScreen
/// <summary>
/// The constructor is private: loading screens should
/// be activated via the static Load method instead.
/// </summary>
private LoadingScreen (ScreenManager screenManager,bool loadingIsSlow,
GameScreen[] screensToLoad)
{
this.loadingIsSlow = loadingIsSlow;
this.screensToLoad = screensToLoad;
TransitionOnTime = TimeSpan.FromSeconds (0.5);
// If this is going to be a slow load operation, create a background
// thread that will update the network session and draw the load screen
// animation while the load is taking place.
if (loadingIsSlow) {
backgroundThread = new Thread (BackgroundWorkerThread);
backgroundThreadExit = new ManualResetEvent (false);
graphicsDevice = screenManager.GraphicsDevice;
// Look up some services that will be used by the background thread.
IServiceProvider services = screenManager.Game.Services;
networkSession = (NetworkSession)services.GetService (
typeof(NetworkSession));
messageDisplay = (IMessageDisplay)services.GetService (
typeof(IMessageDisplay));
}
}
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:31,代码来源:LoadingScreen.cs
示例2: CatapultGame
public CatapultGame ()
{
graphics = new GraphicsDeviceManager (this);
//graphics.SynchronizeWithVerticalRetrace = false;
Content.RootDirectory = "Content";
// Frame rate is 30 fps by default for Windows Phone.
TargetElapsedTime = TimeSpan.FromTicks (333333);
//Create a new instance of the Screen Manager
screenManager = new ScreenManager (this);
Components.Add (screenManager);
Components.Add (new MessageDisplayComponent (this));
Components.Add (new GamerServicesComponent (this));
//Add two new screens
screenManager.AddScreen (new BackgroundScreen (), null);
screenManager.AddScreen (new MainMenuScreen (), null);
// Listen for invite notification events.
NetworkSession.InviteAccepted += (sender, e) => NetworkSessionComponent.InviteAccepted (screenManager, e);
IsMouseVisible = true;
#if !WINDOWS && !XBOX && !MONOMAC && !LINUX
//Switch to full screen for best game experience
graphics.IsFullScreen = true;
#else
graphics.PreferredBackBufferHeight = 480;
graphics.PreferredBackBufferWidth = 800;
#endif
AudioManager.Initialize (this);
}
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:34,代码来源:CatapultGame.cs
示例3: GameMain
SpriteBatch spriteBatch; // this is for FPS counter
#endregion Fields
#region Constructors
public GameMain()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "main";
#if XBOX
// Create Gamer Service Component
SignedInGamer.SignedOut += new EventHandler<SignedOutEventArgs>(SignedInGamer_SignedOut);
GamerServicesComponent gamerServiceComp = new GamerServicesComponent(this);
Components.Add(gamerServiceComp);
#if DEBUG
Guide.SimulateTrialMode = true;
#endif
#endif
// 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);
Components.Add(screenManager);
// On Windows and Xbox we just add the initial screens
AddInitialScreens();
}
开发者ID:rossmas,项目名称:zomination,代码行数:32,代码来源:GameMain.cs
示例4: BlackjackGame
/// <summary>
/// Initializes a new instance of the game.
/// </summary>
public BlackjackGame()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
screenManager = new ScreenManager(this);
screenManager.AddScreen(new BackgroundScreen(), null);
screenManager.AddScreen(new MainMenuScreen(), null);
Components.Add(screenManager);
#if WINDOWS || MACOS || LINUX
IsMouseVisible = true;
#elif WINDOWS_PHONE || IOS || ANDROID
// Frame rate is 30 fps by default for Windows Phone.
TargetElapsedTime = TimeSpan.FromTicks(333333);
graphics.IsFullScreen = true;
#else
Components.Add(new GamerServicesComponent(this));
#endif
// Initialize sound system
AudioManager.Initialize(this);
}
开发者ID:Ezekoka,项目名称:MonoGame-StarterKits,代码行数:29,代码来源:BlackjackGame.cs
示例5: CatapultGame
public CatapultGame()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
// Frame rate is 30 fps by default for Windows Phone.
TargetElapsedTime = TimeSpan.FromTicks(333333);
//Create a new instance of the Screen Manager
screenManager = new ScreenManager(this);
Components.Add(screenManager);
//Switch to full screen for best game experience
graphics.IsFullScreen = true;
//Add two new screens
screenManager.AddScreen(new BackgroundScreen(), null);
screenManager.AddScreen(new MainMenuScreen(), null);
//Create Chooser and Launcher
InitializeChooserAndLauncher();
AudioManager.Initialize(this);
InitializePhoneServices();
}
开发者ID:elixir67,项目名称:Sandbox,代码行数:25,代码来源:CatapultGame.cs
示例6: GameStateManagementGame
/// <summary>
/// The main game constructor.
/// </summary>
public GameStateManagementGame()
{
instance = this;
Content.RootDirectory = "Content";
graphics = new GraphicsDeviceManager(this);
//graphics.PreferredBackBufferWidth = 853;
//graphics.PreferredBackBufferHeight = 480;
graphics.PreferredBackBufferWidth = 640;
graphics.PreferredBackBufferHeight = 480;
//graphics.IsFullScreen = true;
// Create the screen manager component.
screenManager = new ScreenManager(this);
contentManager = new ContentManager(screenManager.Game.Services, "Content");
SoundManager.contentManager = content;
SoundManager.LoadContent();
Components.Add(screenManager);
// Activate the first screens.
screenManager.AddScreen(new BackgroundScreen(), null);
screenManager.AddScreen(new MainMenuScreen(), null);
}
开发者ID:lioralterman,项目名称:xnapacman,代码行数:32,代码来源:Game.cs
示例7: Game
public Game()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
TargetElapsedTime = TimeSpan.FromTicks(333333);
graphics.IsFullScreen = true;
graphics.PreferredBackBufferWidth = 480;
graphics.PreferredBackBufferHeight = 800;
screenFactory = new ScreenFactory();
Services.AddService(typeof(IScreenFactory), screenFactory);
screenManager = new ScreenManager(this);
Components.Add(screenManager);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Launching +=
new EventHandler<Microsoft.Phone.Shell.LaunchingEventArgs>(GameLaunching);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Activated +=
new EventHandler<Microsoft.Phone.Shell.ActivatedEventArgs>(GameActivated);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Deactivated +=
new EventHandler<Microsoft.Phone.Shell.DeactivatedEventArgs>(GameDeactivated);
}
开发者ID:V1ncam,项目名称:Tetris,代码行数:25,代码来源:Game.cs
示例8: GameStateManagementGame
/// <summary>
/// The main game constructor.
/// </summary>
public GameStateManagementGame()
{
Content.RootDirectory = "Content";
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1024;
graphics.PreferredBackBufferHeight = 768;
// Create the screen manager component.
screenManager = new ScreenManager(this);
Components.Add(screenManager);
// Activate the first screens.
screenManager.AddScreen(new BackgroundScreen());
screenManager.AddScreen(new MainMenuScreen());
m_kInfoBox = new Utils.InfoBox(this, new Vector2(Window.ClientBounds.Width, Window.ClientBounds.Height - 10));
//Components.Add(m_kInfoBox);
IsFixedTimeStep = true;
graphics.SynchronizeWithVerticalRetrace = true;
// For testing purposes, let's disable fixed time step and vsync.
//IsFixedTimeStep = false;
//graphics.SynchronizeWithVerticalRetrace = false;
}
开发者ID:shalynnho,项目名称:airplane,代码行数:31,代码来源:Game.cs
示例9: Load
public static void Load(ScreenManager screenManager, bool loadingIsSlow, params GameScreen[] screensToLoad)
{
foreach (GameScreen screen in screenManager.GetScreens())
screen.ExitScreen();
LoadingScreen loadingScreen = new LoadingScreen(screenManager, loadingIsSlow, screensToLoad);
screenManager.AddScreen(loadingScreen);
}
开发者ID:BenFradet,项目名称:OldXnaStuff,代码行数:7,代码来源:LoadingScreen.cs
示例10: insertLineBreaks
public static string insertLineBreaks(string post, float maxSize, ScreenManager MyScreenManager)
{
float maxSizeScaled = maxSize * SpriteDrawer.drawScale.X;
string result = "";
string wordToAdd = "";
string tryAdd;
foreach (char c in post) {
if (c == ' ') {
// this char is a white space. word to add contains the next word to add
tryAdd = result + (result == "" ? "" : " ") + wordToAdd;
if (MyScreenManager.Fonts["tahoma"].MeasureString(tryAdd).X < maxSizeScaled) {
result = tryAdd;
} else {
result += "\n" + wordToAdd;
}
wordToAdd = "";
} else {
// keep building our word
wordToAdd += c;
}
}
// add the last word
tryAdd = result + (result == "" ? "" : " ") + wordToAdd;
if (MyScreenManager.Fonts["tahoma"].MeasureString(tryAdd).X < maxSizeScaled) {
result = tryAdd;
} else {
result += "\n" + wordToAdd;
}
return result;
}
开发者ID:kktseng,项目名称:CritterCampClient,代码行数:32,代码来源:NewsScreen.cs
示例11: GameStateManagementGame
/// <summary>
/// The main game constructor.
/// </summary>
public GameStateManagementGame()
{
Content.RootDirectory = "Content";
graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = true;
TargetElapsedTime = TimeSpan.FromTicks(333333);
// you can choose whether you want a landscape or portait
// game by using one of the two helper functions.
//InitializePortraitGraphics();
InitializeLandscapeGraphics();
// Create the screen manager component.
screenManager = new ScreenManager(this);
Components.Add(screenManager);
// attempt to deserialize the screen manager from disk. if that
// fails, we add our default screens.
if (!screenManager.DeserializeState())
{
// Activate the first screens.
screenManager.AddScreen(new MenuBackgroundScreen("mainMenubackground"), null);
screenManager.AddScreen(new MainMenuScreen(), null);
}
}
开发者ID:skakri09,项目名称:GameOfThreeTards-w-xTILE-Farseer,代码行数:30,代码来源:Game.cs
示例12: MadLabGame
/// <summary>
/// The main game constructor
/// </summary>
public MadLabGame()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 60f);
// Setup window
Window.Title = "MadLab";
graphics.PreferredBackBufferWidth = GameConstants.X_RESOLUTION;
graphics.PreferredBackBufferHeight = GameConstants.Y_RESOLUTION;
graphics.IsFullScreen = false;
graphics.ApplyChanges();
// 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);
// component for screenManager
Components.Add(screenManager);
# if(XBOX)
Components.Add(new GamerServicesComponent(this));
#endif
}
开发者ID:matthewlouis,项目名称:MadScienceLab,代码行数:30,代码来源:MadLabGame.cs
示例13: BlackjackGame
/// <summary>
/// Initializes a new instance of the game.
/// </summary>
public BlackjackGame()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
screenManager = new ScreenManager(this);
screenManager.AddScreen(new BackgroundScreen(), null);
screenManager.AddScreen(new MainMenuScreen(), null);
Components.Add(screenManager);
#if WINDOWS
IsMouseVisible = true;
#elif WINDOWS_PHONE
// Frame rate is 30 fps by default for Windows Phone.
TargetElapsedTime = TimeSpan.FromTicks(333333);
graphics.IsFullScreen = true;
#else
Components.Add(new GamerServicesComponent(this));
#endif
// Initialize sound system
AudioManager.Initialize(this);
#if XBOX
graphics.PreferredBackBufferHeight = graphics.GraphicsDevice.DisplayMode.Height;
graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width;
#elif WINDOWS
graphics.PreferredBackBufferHeight = 480;
graphics.PreferredBackBufferWidth = 800;
#endif
}
开发者ID:liwq-net,项目名称:SilverSprite,代码行数:36,代码来源:BlackjackGame.cs
示例14: Game1
public Game1()
{
// jazyk
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("cs-CZ");
this.graphics = new GraphicsDeviceManager(this);
// rozmìry okna
this.graphics.PreferredBackBufferWidth = 733;
this.graphics.PreferredBackBufferHeight = 608;
this.Content.RootDirectory = "Content";
TargetElapsedTime = TimeSpan.FromTicks(333333);
// 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);
Components.Add(screenManager);
this.AddInitialScreens();
}
开发者ID:kubakista,项目名称:Battle-City,代码行数:25,代码来源:Game.cs
示例15: Game
public Game()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
_graphics.PreferredBackBufferWidth = PREFERRED_WIDTH;
_graphics.PreferredBackBufferHeight = PREFERRED_HEIGHT;
// Krzysztoff has an ancient computer and that's why he needs manual resolution settings
// If you are lucky enough to have a more powerful machine, feel free to uncomment the following lines.
_graphics.PreparingDeviceSettings += graphics_PreparingDeviceSettings;
#if !DEBUG
_graphics.IsFullScreen = true;
#endif
//why was it turned off?
IsFixedTimeStep = true;
// disable FPS throttling
_graphics.SynchronizeWithVerticalRetrace = false;
_screenFactory = new ScreenFactory();
Services.AddService(typeof (IScreenFactory), _screenFactory);
// Create the screen manager component.
_screenManager = new ScreenManager(this);
Components.Add(_screenManager);
IsMouseVisible = false;
AddInitialScreens();
}
开发者ID:szyszart,项目名称:Junkyard,代码行数:29,代码来源:Game.cs
示例16: InputHelper
/// <summary>
/// Constructs a new input state.
/// </summary>
public InputHelper(ScreenManager manager)
{
_currentKeyboardState = new KeyboardState();
_currentGamePadState = new GamePadState();
_currentMouseState = new MouseState();
_currentVirtualState = new GamePadState();
_lastKeyboardState = new KeyboardState();
_lastGamePadState = new GamePadState();
_lastMouseState = new MouseState();
_lastVirtualState = new GamePadState();
_manager = manager;
_cursorIsVisible = false;
_cursorMoved = false;
#if WINDOWS_PHONE
_cursorIsValid = false;
#else
_cursorIsValid = true;
#endif
_cursor = Vector2.Zero;
_handleVirtualStick = false;
}
开发者ID:Clancey,项目名称:BMX_MonoGame,代码行数:28,代码来源:InputHelper.cs
示例17: Game
public Game()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics.IsFullScreen = true;
InitializeLandscapeGraphics();
// Frame rate is 30 fps by default for Windows Phone.
TargetElapsedTime = TimeSpan.FromTicks(333333);
// Extend battery life under lock.
InactiveSleepTime = TimeSpan.FromSeconds(1);
screenFactory = new ScreenFactory();
Services.AddService(typeof(IScreenFactory), screenFactory);
screenManager = new ScreenManager(this);
Components.Add(screenManager);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Launching +=
new EventHandler<Microsoft.Phone.Shell.LaunchingEventArgs>(GameLaunching);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Activated +=
new EventHandler<Microsoft.Phone.Shell.ActivatedEventArgs>(GameActivated);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Deactivated +=
new EventHandler<Microsoft.Phone.Shell.DeactivatedEventArgs>(GameDeactivated);
}
开发者ID:TheFerrango,项目名称:SpotASheep,代码行数:25,代码来源:Game.cs
示例18: GameStateManagementGame
/// <summary>
/// The main game constructor.
/// </summary>
public GameStateManagementGame()
{
Content.RootDirectory = "Content";
graphics = new GraphicsDeviceManager(this);
TargetElapsedTime = TimeSpan.FromTicks(333333);
#if WINDOWS_PHONE
graphics.IsFullScreen = true;
// Choose whether you want a landscape or portait game by using one of the two helper functions.
InitializeLandscapeGraphics();
// InitializePortraitGraphics();
#endif
// 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);
Components.Add(screenManager);
#if WINDOWS_PHONE
// Hook events on the PhoneApplicationService so we're notified of the application's life cycle
Microsoft.Phone.Shell.PhoneApplicationService.Current.Launching +=
new EventHandler<Microsoft.Phone.Shell.LaunchingEventArgs>(GameLaunching);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Activated +=
new EventHandler<Microsoft.Phone.Shell.ActivatedEventArgs>(GameActivated);
Microsoft.Phone.Shell.PhoneApplicationService.Current.Deactivated +=
new EventHandler<Microsoft.Phone.Shell.DeactivatedEventArgs>(GameDeactivated);
#else
// On Windows and Xbox we just add the initial screens
AddInitialScreens();
#endif
}
开发者ID:wuwenhuang,项目名称:RobotContra,代码行数:38,代码来源:Game.cs
示例19: GameStateManagementGame
/// <summary>
/// The main game constructor.
/// </summary>
public GameStateManagementGame()
{
Content.RootDirectory = "Content";
graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = true;
TargetElapsedTime = TimeSpan.FromTicks(333333);
// you can choose whether you want a landscape or portait
// game by using one of the two helper functions.
// This game only supports Landscape view, both left and right
//InitializePortraitGraphics();
InitializeLandscapeGraphics();
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
// Create the screen manager component.
screenManager = new ScreenManager(this);
// Note make sure to render in correct order
Components.Add(screenManager);
// attempt to deserialize the screen manager from disk. if that
// fails, we add our default screens.
if (!screenManager.DeserializeState())
{
// Activate the first screens.
screenManager.AddScreen(new BackgroundScreen(), null);
screenManager.AddScreen(new MainMenuScreen(), null);
}
}
开发者ID:bohesp10,项目名称:Game,代码行数:33,代码来源:Game.cs
示例20: SplashScreenLoading
private SplashScreenLoading(ScreenManager screenManager, bool loadingIsSlow,
MainMenuScreen[] screensToLoad)
{
this.loadingIsSlow = loadingIsSlow;
this.screensToLoad = screensToLoad;
TransitionOnTime = TimeSpan.FromSeconds(0.5);
}
开发者ID:Rhodderz,项目名称:CuteKillers,代码行数:8,代码来源:SplashScreenLoading.cs
注:本文中的GameStateManagement.ScreenManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论