本文整理汇总了C#中Microsoft.Xna.Framework.GameTimer.Start方法的典型用法代码示例。如果您正苦于以下问题:C# GameTimer.Start方法的具体用法?C# GameTimer.Start怎么用?C# GameTimer.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.GameTimer
的用法示例。
在下文中一共展示了GameTimer.Start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameBoard
Random rand; //random number generator
#endregion Fields
#region Constructors
//must pass lanewidth from Game1 object
public GameBoard( int displayWidth )
{
int laneWidth = displayWidth / ( laneCount );
//set up random numbers
this.rand = new Random();
this.Lanes = new int[7];
for( int i = 0; i < laneCount; i++ ) {
this.Lanes[i] = i * laneWidth;
}
this.currentNutList = new List<Nut>();
this.removeNutList = new List<Nut>();
//this.currentPineCones = new List<PineCone>();
//this.removePineCones = new List<PineCone>();
//sets up event, to affect frequency of nuts, adjust update interval...perhaps add randomness?
this.nutsFalling = new GameTimer();
nutsFalling.UpdateInterval = TimeSpan.FromSeconds(nutFrequency);
nutsFalling.Update += new EventHandler<GameTimerEventArgs>(generateNuts);
nutsFalling.Start();
//sets up level up timer
this.levelTimer = new GameTimer();
levelTimer.UpdateInterval = TimeSpan.FromSeconds(levelFrequency);
levelTimer.Update += new EventHandler<GameTimerEventArgs>(levelUp);
levelTimer.Start();
}
示例2: initializeGameTimer
public void initializeGameTimer()
{
Microsoft.Xna.Framework.GameTimer gameTimer = new Microsoft.Xna.Framework.GameTimer();
gameTimer.UpdateInterval = TimeSpan.FromMilliseconds(33);
gameTimer.Update += delegate { try { FrameworkDispatcher.Update(); } catch { } };
gameTimer.Start();
FrameworkDispatcher.Update();
}
示例3: InitializeXnaApplication
// Performs initialization of the XNA types required for the application.
private void InitializeXnaApplication()
{
// Create the service provider
Services = new AppServiceProvider();
// Add the SharedGraphicsDeviceManager to the Services as the IGraphicsDeviceService for the app
foreach (object obj in ApplicationLifetimeObjects)
{
if (obj is IGraphicsDeviceService)
Services.AddService(typeof(IGraphicsDeviceService), obj);
}
// Create the ContentManager so the application can load precompiled assets
Content = new ContentManager(Services, "Content");
// Create a GameTimer to pump the XNA FrameworkDispatcher
FrameworkDispatcherTimer = new GameTimer();
FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
FrameworkDispatcherTimer.Start();
}
示例4: InitializeXnaApplication
// Performs initialization of the XNA types required for the application.
private void InitializeXnaApplication()
{
// Create the ContentManager so the application can load precompiled assets
Content = new ContentManager(this, "Content");
// Create a GameTimer to pump the XNA FrameworkDispatcher
FrameworkDispatcherTimer = new GameTimer();
FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
FrameworkDispatcherTimer.Start();
}
示例5: MainPageViewModel
public MainPageViewModel(INavigationService n)
{
// XNA stuff for media control
GameTimer gameTimer = new GameTimer();
gameTimer.UpdateInterval = TimeSpan.FromMilliseconds(33);
gameTimer.Update += delegate { try { FrameworkDispatcher.Update(); } catch { } };
gameTimer.Start();
// navigation service
this.navigationService = n;
// event handlers
MediaPlayer.ActiveSongChanged += new EventHandler<EventArgs>(SongChanged);
MediaPlayer.MediaStateChanged += new EventHandler<EventArgs>(StateChanged);
FrameworkDispatcher.Update();
currentAccentColorHex = (System.Windows.Media.Color)Application.Current.Resources["PhoneAccentColor"];
if (MediaPlayer.GameHasControl)
{
MessageBox.Show(AppResources.TurnMusicOnLongWP7);
IsEnabled = false;
}
else
{
IsEnabled = true;
NextSongBackground = currentAccentColorHex.ToString();
UpdateView();
}
}
示例6: InitializeXnaApplication
// Performs initialization of the XNA types required for the application.
private void InitializeXnaApplication()
{
// Create the service provider
Services = new AppServiceProvider();
// Add the SharedGraphicsDeviceManager to the Services as the IGraphicsDeviceService for the app
foreach (object obj in ApplicationLifetimeObjects)
{
if (obj is IGraphicsDeviceService)
Services.AddService(typeof(IGraphicsDeviceService), obj);
}
// Create the ContentManager so the application can load precompiled assets
Content = new ContentManager(Services, "Content");
// Create a GameTimer to pump the XNA FrameworkDispatcher
FrameworkDispatcherTimer = new GameTimer();
FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
FrameworkDispatcherTimer.Start();
Settings = new Settings();
AudioManager = new AudioManager(Settings.SoundEnabled, Settings.Volume / Settings.MaxVolume, Settings.MusicEnabled, Settings.Volume / Settings.MaxVolume);
AudioManager.LoadSong("BasicDrumBeat", Content);
AudioManager.LoadSong("ParticleFusion", Content);
AudioManager.LoadSound("ClosedHihat", Content);
AudioManager.LoadSound("Cymbal", Content);
Leaderboard = new Leaderboard();
}
示例7: Initialize
protected override void Initialize()
#endif
{
// TODO: Add your initialization logic here
#if WINDOWS_RT
GraphicsDevice = _graphicsManager.GraphicsDevice;
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
BugSenseHandler.Instance.Init("e1821f8f");
BugSenseHandler.Instance.ScreenOrientation = "Landscape";
var pp = GraphicsDevice.PresentationParameters;
BugSenseHandler.Instance.ScreenSize.X = pp.BackBufferWidth;
BugSenseHandler.Instance.ScreenSize.Y = pp.BackBufferHeight;
BugSenseHandler.LogError(new Exception("WINRT Exception"), "This is an error");
_timer = new GameTimer();
_timer.UpdateInterval = TimeSpan.Zero;
_timer.Draw += (o, a) => Draw(new GameTime(a.TotalTime, a.ElapsedTime));
//_timer.Update += (o, a) => Update(new GameTime(a.TotalTime, a.ElapsedTime));
_timer.Start();
#else
base.Initialize();
#endif
}