コード例 #1
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     base.Initialize ();
     this.Components.Add (new InputHandler(this));
     _camera =  new Camera(_screen);
     MakeWindow(_screen);
 }
コード例 #2
0
        public void Draw(SpriteBatch sb, Camera c)
        {
            if(Index == Blocks.AIR)
                return;

            Rectangle newdrawrect = DrawRect;
            newdrawrect.X -= c.Position.X;
            newdrawrect.Y -= c.Position.Y;

            Color color = ShowInfluence ? InfluenceColor : Color;

            sb.Draw(Assets.GetBuildingTexture(Index, Blocks.BASE),
                    newdrawrect,
                    null,
                    color,
                    0f, Vector2.Zero, SpriteEffect, 0f);

            //Draw Features Here
            if(HasShading)
                sb.Draw(Assets.GetBuildingTexture(Index, Blocks.SHADING),
                        newdrawrect,
                        null,
                        Color.White * Blocks.SHADEALPHA,
                        0f, Vector2.Zero, SpriteEffect, 0f);
            if(HasLighting)
                sb.Draw(Assets.GetBuildingTexture(Index, Blocks.LIGHTING),
                        newdrawrect,
                        null,
                        Color.White * Blocks.LIGHTALPHA,
                        0f, Vector2.Zero, SpriteEffect, 0f);
            if(HasFeature)
                sb.Draw(Assets.GetBuildingTexture(Index, Blocks.FEATURE),
                        newdrawrect, null, FeatureColor);
        }
コード例 #3
0
        public void Draw(SpriteBatch sb, Camera c)
        {
            Rectangle newdrawrect = DrawRect;
            newdrawrect.X -= c.Position.X;
            newdrawrect.Y -= c.Position.Y;

            Color color = ShowInfluence ? InfluenceColor : Color;

            if(Index != Tiles.NONE)
                sb.Draw(Assets.GetTileTexture(Index), newdrawrect, null, color, 0f, Vector2.Zero, SpriteEffect, 0f);
        }
コード例 #4
0
 /// <summary>
 /// Draws the blocks.
 /// </summary>
 /// <param name='sb'>
 /// Sb.
 /// </param>
 /// <param name='c'>
 /// C.
 /// </param>
 public void DrawBlocks(SpriteBatch sb, Camera c)
 {
     for (int x = 0; x < Game1.MAXX; x++) {
         for (int y = 0; y < Game1.MAXY; y++) {
             for (int z = 0; z < Game1.MAXZ; z++) {
                 _blocks [x, y, z].Draw (sb, c);
             }
         }
     }
 }
コード例 #5
0
 /// <summary>
 /// Draws the grid.
 /// </summary>
 /// <param name='sb'>
 /// Sb.
 /// </param>
 /// <param name='c'>
 /// C.
 /// </param>
 public void DrawGrid(SpriteBatch sb, Camera c)
 {
     for (int x = 0; x < Game1.MAXX; x++) {
         for (int y = 0; y < Game1.MAXY; y++) {
             _tiles [x, y].Draw (sb, c);
         }
     }
 }