示例#1
0
        protected override void Initialize()
        {
            graphics.PreferMultiSampling = true;
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.SynchronizeWithVerticalRetrace = true;
            graphics.PreferMultiSampling = true;
            graphics.ApplyChanges();

            Utility.Initialize(graphics, Content, "content");

            testSprite = Sprite.LoadSprite("characters/elisa-spritesheet.png");

            var tmxMap = TmxMap.Load("content/maps/twilight_test/twilight_test.json");
            world = new World(this, tmxMap);
            worldRenderer = new WorldRenderer(this, world);

            Components.Add(world);
            Components.Add(worldRenderer);

            Components.Add(new SpritebatchEnder(this, Utility.SpriteBatch, Utility.GuiSpritebatch) {DrawOrder = Int32.MaxValue});

            fontTest = new BMFont(GraphicsDevice, "content/fonts/open_sans", false);

            Utility.Camera.Position = world.Map.Layers.First(layer => layer.Type == TmxLayerType.Object).Objects["PlayerSpawn"][0].Position * world.Scale;

            oldState = state = Keyboard.GetState();
            base.Initialize();
        }
示例#2
0
 public static void DrawString(this SpriteBatch spriteBatch, BMFont font, string text, Vector2 position, Color color, float rotation, float size)
 {
     font.Draw(spriteBatch, text, position, color, rotation, size);
 }
示例#3
0
 public static void DrawString(this SpriteBatch spriteBatch, BMFont font, string text, Vector2 position, Color color, float rotation) { DrawString(spriteBatch, font, text, position, color, rotation, 1); }
示例#4
0
 public static void DrawString(this SpriteBatch spriteBatch, BMFont font, string text, Vector2 position) { DrawString(spriteBatch, font, text, position, Color.White); }
示例#5
0
 public static void DrawString(this SpriteBatch spriteBatch, BMFont font, string text, Vector2 position, Color color, float rotation, float size)
 {
     font.Draw(spriteBatch, text, position, color, rotation, size);
 }
示例#6
0
 public static void DrawString(this SpriteBatch spriteBatch, BMFont font, string text, Vector2 position, Color color, float rotation)
 {
     DrawString(spriteBatch, font, text, position, color, rotation, 1);
 }
示例#7
0
 public static void DrawString(this SpriteBatch spriteBatch, BMFont font, string text, Vector2 position)
 {
     DrawString(spriteBatch, font, text, position, Color.White);
 }