protected override void Draw(GameTime gameTime) { base.Draw(gameTime); if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } Application.FrameRate = gameTime.ElapsedGameTime.TotalSeconds; TickManager.Update(); }
public static Actor Spawn(string typeName, Vector2 position) { var actor = TickManager.Create(GameObjectNameSpace + typeName) as Actor; Debug.Assert(actor != null, "Cannot create actor."); if (actor.Transform.Position == Transform.Default.Position) { actor.Transform.Position = new Vector2(position.X, position.Y); } TickManager.Spawn(actor); return(actor); }
public static T Spawn <T>(Vector2 position, float rotation = 0, float scale = 1) where T : Actor, new() { var actor = TickManager.Create <T>(); if (actor.Transform.Position == Transform.Default.Position) { actor.Transform.Position = position; } if (actor.Transform.Rotation == Transform.Default.Rotation) { actor.Transform.Rotation = rotation; } if (actor.Transform.Scale == Transform.Default.Scale) { actor.Transform.Scale = scale; } TickManager.Spawn(actor); return(actor); }
protected override void Initialize() { base.Initialize(); IsMouseVisible = true; Application.GraphicsDevice = GraphicsDevice; Application.SpriteBatch = new SpriteBatch(GraphicsDevice); Application.GraphicsDeviceManager = graphics; Application.Content = Content; var viewportAdapter = new BoxingViewportAdapter( Window, GraphicsDevice, graphics.PreferredBackBufferWidth / 16, graphics.PreferredBackBufferHeight / 16); Application.ViewportAdapter = viewportAdapter; Application.MainCamera = new Camera2D(viewportAdapter); TickManager.Spawn <StartScene>(); }
public static void Destroy(Actor actor) { TickManager.Destroy(actor); }