protected virtual void Update(GameTime gameTime) { lock (updateableComponents) { for (int i = 0; i < updateableComponents.Count; i += 1) { currentlyUpdatingComponents.Add(updateableComponents[i]); } } foreach (IUpdateable updateable in currentlyUpdatingComponents) { if (updateable.Enabled) { updateable.Update(gameTime); } } currentlyUpdatingComponents.Clear(); FrameworkDispatcher.Update(); }
public Game() { _instance = this; LaunchParameters = new LaunchParameters(); _services = new GameServiceContainer(); _components = new GameComponentCollection(); _content = new ContentManager(_services); Platform = GamePlatform.PlatformCreate(this); Platform.Activated += OnActivated; Platform.Deactivated += OnDeactivated; _services.AddService(typeof(GamePlatform), Platform); // Calling Update() for first time initializes some systems FrameworkDispatcher.Update(); // Allow some optional per-platform construction to occur too. PlatformConstruct(); }
public Game() { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; LaunchParameters = new LaunchParameters(); Components = new GameComponentCollection(); Services = new GameServiceContainer(); Content = new ContentManager(Services); updateableComponents = new List <IUpdateable>(); currentlyUpdatingComponents = new List <IUpdateable>(); drawableComponents = new List <IDrawable>(); currentlyDrawingComponents = new List <IDrawable>(); IsMouseVisible = false; IsFixedTimeStep = true; TargetElapsedTime = TimeSpan.FromTicks(166667); // 60fps InactiveSleepTime = TimeSpan.FromSeconds(0.02); for (int i = 0; i < previousSleepTimes.Length; i += 1) { previousSleepTimes[i] = TimeSpan.FromMilliseconds(1); } textInputControlDown = new bool[FNAPlatform.TextInputCharacters.Length]; textInputControlRepeat = new int[FNAPlatform.TextInputCharacters.Length]; hasInitialized = false; suppressDraw = false; isDisposed = false; gameTime = new GameTime(); Window = FNAPlatform.CreateWindow(); Mouse.WindowHandle = Window.Handle; TouchPanel.WindowHandle = Window.Handle; FrameworkDispatcher.Update(); // Ready to run the loop! RunApplication = true; }
public Game() { _instance = this; LaunchParameters = new LaunchParameters(); _services = new GameServiceContainer(); _components = new GameComponentCollection(); _content = new ContentManager(_services); Platform = GamePlatform.PlatformCreate(this); Platform.Activated += OnActivated; Platform.Deactivated += OnDeactivated; _services.AddService(typeof(GamePlatform), Platform); // Calling Update() for first time initializes some systems FrameworkDispatcher.Update(); #if WINDOWS_STOREAPP && !WINDOWS_PHONE81 Platform.ViewStateChanged += Platform_ApplicationViewChanged; #endif }
public Game(string rootDir) { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; RootDirectory = rootDir; LaunchParameters = new LaunchParameters(); Components = new GameComponentCollection(); Services = new GameServiceContainer(); Content = new ContentManager(Services); updateableComponents = new List <IUpdateable>(); currentlyUpdatingComponents = new List <IUpdateable>(); drawableComponents = new List <IDrawable>(); currentlyDrawingComponents = new List <IDrawable>(); IsMouseVisible = false; IsFixedTimeStep = true; TargetElapsedTime = TimeSpan.FromTicks(166667); // 60fps InactiveSleepTime = TimeSpan.FromSeconds(0.02); hasInitialized = false; suppressDraw = false; isDisposed = false; gameTime = new GameTime(); Window = FNAPlatform.CreateWindow(); Mouse.WindowHandle = Window.Handle; TouchPanel.WindowHandle = Window.Handle; FrameworkDispatcher.Update(); Renderer = new Renderer(this); // Ready to run the loop! RunApplication = true; }
protected virtual void Update(GameTime gameTime) { FrameworkDispatcher.Update(); }