Exemplo n.º 1
0
        public override void LoadContent(ContentManager content)
        {
            SpriteFont font = content.Load<SpriteFont>("large9");
            SpriteFont titlefont = content.Load<SpriteFont>("Abstract");
            title = new SpriteElement(new StringBuilder("Virulent"), titlefont);
            el_newgame = new SpriteElement(new StringBuilder("Start Game"), font);
            el_options = new SpriteElement(new StringBuilder("Options"), font);
            el_endgame = new SpriteElement(new StringBuilder("End Game"), font);
            el_quit = new SpriteElement(new StringBuilder("Quit Game"), font);
            cursor = new SpriteElement(content.Load<Texture2D>("cursor"));
            title.pos.X = 0.5f;
            title.scale = 0.25f;
            title.pos.Y = 0.4f;
            el_newgame.pos.X = 0.5f;
            el_newgame.scale = 0.5f;
            el_newgame.pos.Y = 0.5f;
            el_options.pos.X = 0.5f;
            el_options.scale = 0.5f;
            el_options.pos.Y = 0.55f;
            el_endgame.pos.X = 0.5f;
            el_endgame.scale = 0.5f;
            el_endgame.pos.Y = 0.6f;
            el_quit.pos.X = 0.5f;
            el_quit.scale = 0.5f;
            el_quit.pos.Y = 0.65f;
            cursor.pos.X = 0.35f;
            cursor.scale = 0.5f;
            cursor.pos.Y = 0.4f;
            cursor.scale = 0.5f;
            cursorpos = 0;

            startGamePage = new StartGamePage(this);
            startGamePage.LoadContent(content);
        }
Exemplo n.º 2
0
 public SpriteElement(SpriteElement spriteCopy)
 {
     col = spriteCopy.col;
     font = spriteCopy.font;
     text = spriteCopy.text;
     rotation = spriteCopy.rotation;
     scale = spriteCopy.scale;
     texture = spriteCopy.texture;
     transformedPos = spriteCopy.transformedPos;
     orig = spriteCopy.orig;
 }
Exemplo n.º 3
0
        public void LoadContent(ContentManager content)
        {
            inGameMenu.LoadContent(content);
            titleMenu.LoadContent(content);

            darken = new SpriteElement(content.Load<Texture2D>("white"));
            darken.pos.X = 0.5f;
            darken.pos.Y = 0.5f;
            darken.col = new Color(0, 0, 0, 0.5f);
            darken.scale = 100f;
        }
Exemplo n.º 4
0
 public void LoadContent(ContentManager content)
 {
     bg = new SpriteElement(content.Load<Texture2D>("placeholder_cinematic_background"));
     bg.pos.X = 0.5f;
     bg.pos.Y = 0.5f;
     bg.scale = 0.65f;
     bg.col = new Color(0, 0, 0);
     thing = new SpriteElement(content.Load<Texture2D>("placeholder_button_test"));
     thing.pos.X = -0.5f;
     thing.pos.Y = 0.5f;
     thing.scale = 0.5f;
 }
Exemplo n.º 5
0
        public static void CopyMembers(SpriteElement subject, SpriteElement target)
        {
            subject.pos.X = target.pos.X;
            subject.pos.Y = target.pos.Y;
            subject.scale = target.scale;
            subject.rotation = target.rotation;

            subject.col.R = target.col.R;
            subject.col.G = target.col.G;
            subject.col.B = target.col.B;
            subject.col.A = target.col.A;

            if (target.text != null)
            {
                if (subject.text == null) subject.text = new StringBuilder();
                subject.text.Length = 0;
                subject.text.Append(target.text.ToString());
            }
            subject.texture = target.texture;
            subject.font = target.font;
            if (target.texture != null)
                subject.orig = target.orig;
            else if (target.font != null)
                subject.orig = target.font.MeasureString(subject.text) / 2;
            else
                subject.orig = Vector2.Zero;
        }
Exemplo n.º 6
0
 public static SpriteElement CreateCopy(SpriteElement target)
 {
     SpriteElement subject = new SpriteElement();
     CopyMembers(subject, target);
     return subject;
 }
Exemplo n.º 7
0
        public void PoseSpriteElementTween(SpriteElement s, int spriteNum, float x, float y, float rot, Pose next, float ratio)
        {
            if (spriteNum >= sprites.Count) return;
            if (spriteNum >= next.sprites.Count) return;
            SEInfo spriteInfo = sprites[spriteNum];
            SEInfo nextSpriteInfo = next.sprites[spriteNum];

            if (ratio > 1.0f) ratio = 1.0f;
            if (ratio < 0.0f) ratio = 0.0f;

            s.pos.X = x + ((spriteInfo.x * (1f - ratio)) + (nextSpriteInfo.x * ratio));
            s.pos.Y = y + ((spriteInfo.y * (1f - ratio)) + (nextSpriteInfo.y * ratio));
            s.scale = ((spriteInfo.scale * (1f - ratio)) + (nextSpriteInfo.scale * ratio));
            s.rotation = rot + ((spriteInfo.rot * (1f - ratio)) + (nextSpriteInfo.rot * ratio));
            s.col = new Color(((spriteInfo.r * (1f - ratio)) + (nextSpriteInfo.r * ratio)),
                                ((spriteInfo.g * (1f - ratio)) + (nextSpriteInfo.g * ratio)),
                                ((spriteInfo.b * (1f - ratio)) + (nextSpriteInfo.b * ratio)));
        }
Exemplo n.º 8
0
        public void PoseSpriteElement(SpriteElement s, int spriteNum, float x, float y, float rot)
        {
            if (spriteNum >= sprites.Count) return;
            SEInfo spriteInfo = sprites[spriteNum];

            s.pos.X = x + spriteInfo.x;
            s.pos.Y = y + spriteInfo.y;
            s.scale = spriteInfo.scale;
            s.rotation = rot + spriteInfo.rot;
            s.col = new Color(spriteInfo.r, spriteInfo.g, spriteInfo.b);
        }
Exemplo n.º 9
0
        public override void LoadContent(ContentManager content)
        {
            brick = new Block[3];
            brick[0] = new Block("platforms/platform1");
            brick[0].LoadContent(content);
            brick[0].SetPosition(0, 150);
            brick[0].SetScale(0.4f);
            brick[0].SetColor(new Color(1.0f, 0.1f, 0.0f));

            brick[1] = new Block("platforms/platform1");
            brick[1].LoadContent(content);
            brick[1].SetPosition(-100, 0);
            brick[1].SetScale(0.4f);
            brick[1].SetColor(new Color(0.0f, 0.5f, 1.0f));

            brick[2] = new Block("platforms/platform1");
            brick[2].LoadContent(content);
            brick[2].SetPosition(100, 0);
            brick[2].SetScale(0.4f);
            brick[2].SetColor(new Color(1.0f, 0.1f, 1.0f));

            bg = new SpriteElement(content.Load<Texture2D>("gradient"));
            bg.scale = 5;
            bg.pos.X = 0.5f;
            bg.pos.Y = 0.5f;

            prevSpawnTime = new TimeSpan();

            e = new Entity();
            e.state = new Player();
            e.LoadContent(content);
        }