コード例 #1
0
        public static void Draw(GameTime gameTime, SpriteFont fnt, SpriteBatch sb, LineBatch lb, int resx, int resy)
        {
            _frameCounter++;

            string fps = string.Format(_format, "{0}x{1} {2} fps", resx, resy, insec.Sum());
            string mem = string.Format(_format, "{0} MiB", memo);

            sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp,
                     DepthStencilState.Default, RasterizerState.CullCounterClockwise, null);
            sb.DrawString(fnt, fps, _position + Vector2.One, Color.Black);
            sb.DrawString(fnt, fps, _position, Color.White);

            sb.DrawString(fnt, mem, _position + Vector2.One + ofs, Color.Black);
            sb.DrawString(fnt, mem, _position + ofs, Color.White);


            var offset = new Vector2(150, 15);

            for (int index = 0; index < max_gr; index++)
            {
                var   a   = (int)(((float)graph[index]) / (_max) * 100);
                Color col = Color.Lerp(Color.Blue, Color.Red, (float)graph[index] / (_max));
                if (index == _curent - 1)
                {
                    col.G = 255;
                    col.B = 255;
                }
                if (index == _curent - 2)
                {
                    col.G = 200;
                    col.B = 200;
                }
                if (index == _curent - 3)
                {
                    col.G = 150;
                    col.B = 150;
                }
                if (index == _curent - 4)
                {
                    col.G = 75;
                    col.B = 75;
                }

                if (a > 0)
                {
                    lb.AddLine(new Vector2(10 + index, 100) + offset, new Vector2(10 + index, 100 - a) + offset, col, 1);
                }
            }

            int average = graph.Sum();

            average /= graph.Length;
            sb.DrawString(fnt, string.Concat("average = ", average), new Vector2(10, 115) + offset, Color.Red);

            sb.End();
        }
コード例 #2
0
ファイル: FPSCounter.cs プロジェクト: ishellstrike/Mork
        public static void Draw(GameTime gameTime, SpriteFont fnt, SpriteBatch sb, LineBatch lb, int resx, int resy)
        {
            _frameCounter++;

            string fps = string.Format(_format, "{0}x{1} {2} fps", resx, resy, insec.Sum());
            string mem = string.Format(_format, "{0} MiB", memo);

            sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp,
                     DepthStencilState.Default, RasterizerState.CullCounterClockwise, null);
            sb.DrawString(fnt, fps, _position + Vector2.One, Color.Black);
            sb.DrawString(fnt, fps, _position, Color.White);

            sb.DrawString(fnt, mem, _position + Vector2.One + ofs, Color.Black);
            sb.DrawString(fnt, mem, _position + ofs, Color.White);

            var offset = new Vector2(150, 15);
            for (int index = 0; index < max_gr; index++) {
                var a = (int) (((float) graph[index])/(_max)*100);
                Color col = Color.Lerp(Color.Blue, Color.Red, (float) graph[index]/(_max));
                if (index == _curent - 1) {
                    col.G = 255;
                    col.B = 255;
                }
                if (index == _curent - 2) {
                    col.G = 200;
                    col.B = 200;
                }
                if (index == _curent - 3) {
                    col.G = 150;
                    col.B = 150;
                }
                if (index == _curent - 4) {
                    col.G = 75;
                    col.B = 75;
                }

                if (a > 0) {
                    lb.AddLine(new Vector2(10 + index, 100) + offset, new Vector2(10 + index, 100 - a) + offset, col, 1);
                }
            }

            int average = graph.Sum();
            average /= graph.Length;
            sb.DrawString(fnt, string.Concat("average = ", average), new Vector2(10, 115) + offset, Color.Red);

            sb.End();
        }
コード例 #3
0
ファイル: LoadContent.cs プロジェクト: ishellstrike/Mork
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            lineBatch = new LineBatch(GraphicsDevice);

            base.LoadContent();
            object_tex = ContentLoad(@"Textures\Objects\Blocks\Blocks");

            texatlas = Content.Load<Texture2D>(@"Textures\BlocktexAtlas");
            Commons.TextureAtlas.Y = texatlas.Height;
            Commons.TextureAtlas.X = texatlas.Width;

            var temp = new Texture2D[5];
            for (int i = 0; i <= 4; i++) {
                temp[i] =
                    ContentLoad(@"Textures\Objects\OnStore\wood_log" + (i + 1));
            }
            onstore_tex.Add(OnStoreTexes.Wood_log, temp);

            temp = new Texture2D[5];
            for (int i = 0; i <= 4; i++) {
                temp[i] = ContentLoad(@"Textures\Objects\OnStore\stone" + (i + 1));
            }
            onstore_tex.Add(OnStoreTexes.Stone, temp);

            LoadTexture2D(unit_tex, @"Textures\transparent_pixel"); //0
            LoadTexture2D(unit_tex, @"Textures\Units\human1"); //1
            LoadTexture2D(unit_tex, @"Textures\Units\human2"); //2
            LoadTexture2D(unit_tex, @"Textures\Units\human3"); //3

            LoadTexture2D(interface_tex, @"Textures\Interface\Selector2"); //0
            LoadTexture2D(interface_tex, @"Textures\Interface\PointBar"); //1
            LoadTexture2D(interface_tex, @"Textures\Interface\Selector3_1"); //2
            LoadTexture2D(interface_tex, @"Textures\Interface\Selector3_2"); //3
            LoadTexture2D(interface_tex, @"Textures\Interface\dig"); //4
            LoadTexture2D(interface_tex, @"Textures\Interface\digpit"); //5
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_up"); //6
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_10x50"); //7
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_10x100"); //8
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_1x15"); //9
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_left"); //10
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_10x10"); //11
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_5x5"); //12
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_5x5cross"); //13
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_5x5pike"); //14
            LoadTexture2D(interface_tex, @"Textures\Interface\mork1"); //15
            LoadTexture2D(interface_tex, @"Textures\Interface\Saving"); //16
            LoadTexture2D(interface_tex, @"Textures\Interface\Building_41x28_16fr"); //17
            LoadTexture2D(interface_tex, @"Textures\Interface\build"); //18
            LoadTexture2D(interface_tex, @"Textures\Interface\supply"); //19

            gears = new List<Texture2D>();
            gears.Add(Content.Load<Texture2D>(@"Textures\Interface\g1"));
            gears.Add(Content.Load<Texture2D>(@"Textures\Interface\g2"));
            gears.Add(Content.Load<Texture2D>(@"Textures\Interface\g3"));

            g1r = gears[0].Height/2;
            g2r = gears[1].Height/2;
            g3r = gears[2].Height/2;

            Font1 = Content.Load<SpriteFont>(@"Textures\SpriteFont1");
            Font2 = Content.Load<SpriteFont>(@"Textures\SpriteFont2");

            dbobject = new DB_LMO(); //!!!!
            dbcreatures = new DB_LMC(); //!!!!
            //buildings = new Stores(); //!!!!
            gmap = new GMap(); //!!!!

            WindowsDesigner();

            var blockeffect = Content.Load<Effect>(@"Effects\SolidBlockEffect");

            smap = new SectorMap(GraphicsDevice, blockeffect);
            imap = new IntersectMap();

            players.Add(new Player(GraphicsDevice, texatlas, "Player us"));
            player_us = players[0];

            MeTexoncurA = 1;
            MeTexoncurB = 5;
        }
コード例 #4
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            lineBatch   = new LineBatch(GraphicsDevice);

            base.LoadContent();
            object_tex = ContentLoad(@"Textures\Objects\Blocks\Blocks");

            texatlas = Content.Load <Texture2D>(@"Textures\BlocktexAtlas");
            Commons.TextureAtlas.Y = texatlas.Height;
            Commons.TextureAtlas.X = texatlas.Width;

            var temp = new Texture2D[5];

            for (int i = 0; i <= 4; i++)
            {
                temp[i] =
                    ContentLoad(@"Textures\Objects\OnStore\wood_log" + (i + 1));
            }
            onstore_tex.Add(OnStoreTexes.Wood_log, temp);

            temp = new Texture2D[5];
            for (int i = 0; i <= 4; i++)
            {
                temp[i] = ContentLoad(@"Textures\Objects\OnStore\stone" + (i + 1));
            }
            onstore_tex.Add(OnStoreTexes.Stone, temp);

            LoadTexture2D(unit_tex, @"Textures\transparent_pixel");                  //0
            LoadTexture2D(unit_tex, @"Textures\Units\human1");                       //1
            LoadTexture2D(unit_tex, @"Textures\Units\human2");                       //2
            LoadTexture2D(unit_tex, @"Textures\Units\human3");                       //3

            LoadTexture2D(interface_tex, @"Textures\Interface\Selector2");           //0
            LoadTexture2D(interface_tex, @"Textures\Interface\PointBar");            //1
            LoadTexture2D(interface_tex, @"Textures\Interface\Selector3_1");         //2
            LoadTexture2D(interface_tex, @"Textures\Interface\Selector3_2");         //3
            LoadTexture2D(interface_tex, @"Textures\Interface\dig");                 //4
            LoadTexture2D(interface_tex, @"Textures\Interface\digpit");              //5
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_up");              //6
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_10x50");           //7
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_10x100");          //8
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_1x15");            //9
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_left");            //10
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_10x10");           //11
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_5x5");             //12
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_5x5cross");        //13
            LoadTexture2D(interface_tex, @"Textures\Interface\Int_5x5pike");         //14
            LoadTexture2D(interface_tex, @"Textures\Interface\mork1");               //15
            LoadTexture2D(interface_tex, @"Textures\Interface\Saving");              //16
            LoadTexture2D(interface_tex, @"Textures\Interface\Building_41x28_16fr"); //17
            LoadTexture2D(interface_tex, @"Textures\Interface\build");               //18
            LoadTexture2D(interface_tex, @"Textures\Interface\supply");              //19

            gears = new List <Texture2D>();
            gears.Add(Content.Load <Texture2D>(@"Textures\Interface\g1"));
            gears.Add(Content.Load <Texture2D>(@"Textures\Interface\g2"));
            gears.Add(Content.Load <Texture2D>(@"Textures\Interface\g3"));

            g1r = gears[0].Height / 2;
            g2r = gears[1].Height / 2;
            g3r = gears[2].Height / 2;

            Font1 = Content.Load <SpriteFont>(@"Textures\SpriteFont1");
            Font2 = Content.Load <SpriteFont>(@"Textures\SpriteFont2");


            dbobject    = new DB_LMO(); //!!!!
            dbcreatures = new DB_LMC(); //!!!!
            //buildings = new Stores(); //!!!!
            gmap = new GMap();          //!!!!

            WindowsDesigner();

            var blockeffect = Content.Load <Effect>(@"Effects\SolidBlockEffect");

            smap = new SectorMap(GraphicsDevice, blockeffect);
            imap = new IntersectMap();

            players.Add(new Player(GraphicsDevice, texatlas, "Player us"));
            player_us = players[0];

            MeTexoncurA = 1;
            MeTexoncurB = 5;
        }