public void Go()
        {
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Sprite Sorting Example";
            screen = Video.SetVideoMode(200, 200, false, false, false);

            s  = new Sprite(new Surface(100, 100), new Point(10, 10));
            s2 = new Sprite(new Surface(100, 100), new Point(10, 10));

            s.Surface.Fill(Color.Red);
            s2.Surface.Fill(Color.Blue);

            manager.Add(s);
            manager.Add(s2);

            s2.X = 50;
            s2.Y = 50;

            //Red on top of Blue
            s.Z  = 1;
            s2.Z = 0;

            manager.EnableTickEvent();
            SdlDotNet.Core.Events.Tick += new EventHandler <TickEventArgs>(Events_Tick);
            SdlDotNet.Core.Events.Quit += new EventHandler <QuitEventArgs>(Events_Quit);
            Events.Fps = 5;
            SdlDotNet.Core.Events.Run();
        }
        public Manager()
        {
            mVideo = Video.SetVideoMode(800, 300);
            p = new Publisher();

            mAchtergrond = new Achtergrond(mVideo);
            mEnemy = new Enemy(mVideo);
            mEnemy2 = new Enemy2(mVideo);
            p.AddVijand(mEnemy2);
            p.AddVijand(mEnemy);
            mHero = new Hero(mVideo, p);
            mHero = new ShootHero(mVideo, mHero);
            mHero = new FlyHero(mVideo, mHero);

            //Terug naar origine hero!
            ((FlyHero)mHero).theHero = null;
            mHero = new ShootHero(mVideo, mHero);
            collection = new SpriteCollection();
            collection.Add(mHero);
            //collection.Add(shootHero);
            collection.Add(mEnemy);
            collection.Add(mEnemy2);

            Events.KeyboardDown += Events_KeyboardDown;
            //collection.EnableTickEvent();
            //collection.EnableKeyboardEvent();

            init();

            Events.Tick += new EventHandler<TickEventArgs>(Events_Tick);
            Events.Run();
        }
Beispiel #3
0
        public static void Run()
        {
            if (File.Exists(Path.Combine(dataDirectory, "Background1.png")))
            {
                filePath = "";
            }
            Video.WindowIcon();
            Video.WindowCaption =
                "SDL.NET - Bomb Run";
            screen              = Video.SetVideoMode(640, 480);
            tempSurface         = new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Background1.png")));
            background          = tempSurface.Convert();
            tempSurface         = new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Background2.png")));
            alternateBackground = tempSurface.Convert();

            temporary = screen.CreateCompatibleSurface(32, 32);
            temporary.TransparentColor = Color.FromArgb(0, 255, 0, 255);
            temporary.Transparent      = true;

            player = new Player(new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Head.bmp"))), new Point(screen.Width / 2 - 16,
                                                                                                                        screen.Height - 32));
            players.Add(player);
            players.EnableKeyboardEvent();
            bullets.EnableTickEvent();
            master.EnableTickEvent();

            for (int i = 0; i < 25; i++)
            {
                bombs.Add(new Bomb(new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Bomb.bmp")))));
            }
            foreach (Sprite bomb in bombs)
            {
                master.Add(bomb);
            }
            foreach (Sprite playerSprite in players)
            {
                master.Add(playerSprite);
            }

            Mouse.ShowCursor     = false;
            Events.KeyboardDown +=
                new EventHandler <KeyboardEventArgs>(Keyboard);
            Events.Quit        += new EventHandler <QuitEventArgs>(Quit);
            player.WeaponFired += new EventHandler <FireEventArgs>(PlayerWeaponFired);

            Events.Tick += new EventHandler <TickEventArgs>(OnTick);
            Events.Run();
        }
        protected override void PopulateSprites()
        {
            if (SpriteCollection == null)
            {
                SpriteCollection = new List <pDrawable>();
            }

            backgroundSprite =
                new pSprite(s_menuButtonBackground, Fields.TopLeft,
                            Origins.CentreLeft,
                            Clocks.Game,
                            new Vector2((float)Position.X, (float)Position.Y), StartDepth, true, BackgroundColour,
                            this);
            backgroundSprite.HandleInput = true;
            SpriteCollection.Add(backgroundSprite);

            textTitle        = new pText(nameWithCount, 24, Vector2.Zero, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP, true, colourTextInactive, false);
            textTitle.Origin = Origins.CentreLeft;
            textTitle.Tag    = new Vector2(15, 0);

            blackSprites.Add(textTitle);
            SpriteCollection.Add(textTitle);

            UpdateCount();
        }
 private void BlitElements()
 {
     //Only updates if the layer is visible
     if (this.visible)
     {
         SpriteCollection arrows        = new SpriteCollection();
         SpriteCollection otherElements = new SpriteCollection();
         this.surface.Fill(GraphDiagram.TRASPARENT_COLOR);
         foreach (Sprite element in this.elements)
         {
             if (!(element is GraphElement))
             {
                 otherElements.Add(element);
             }
             else
             if (element is GraphArrow)
             {
                 arrows.Add(element);
             }
             else
             {
                 this.surface.Blit(element);
             }
         }
         this.surface.Blit(arrows);
         this.surface.Blit(otherElements);
     }
 }
Beispiel #6
0
        public override void Load(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            Sprite bg          = new Sprite("Background", Global.Backgrounds[Global.CurrentBackgroundIndex], Vector2.Zero, Color.White);
            Sprite title       = new Sprite("title", content.Load <Texture2D>("Screen Images/Game Type"), new Vector2(103, 237), Color.White);
            Sprite tapButton   = new Sprite("tap", content.Load <Texture2D>("Screen Images/tapSelect"), new Vector2(259, 573), Color.White);
            Sprite or          = new Sprite("or", content.Load <Texture2D>("Screen Images/Or"), new Vector2(456, 1116), Color.White);
            Sprite swipeButton = new Sprite("swipe", content.Load <Texture2D>("Screen Images/swipeSelect"), new Vector2(259, 1298), Color.White);


            SpriteCollection.Add(bg);
            SpriteCollection.Add(title);
            SpriteCollection.Add(tapButton);
            SpriteCollection.Add(or);
            SpriteCollection.Add(swipeButton);

#if WINDOWS
            tapButton.MouseClick   += tapButton_MouseClick;
            swipeButton.MouseClick += swipeButton_MouseClick;
#else
            TouchManager touch = TouchManager.Instance;
            touch.GestureOccured += touch_GestureOccured;
#endif

            clickSound = content.Load <SoundEffect>("Sounds/Effects/RD click Sound");
        }
Beispiel #7
0
        public SpinnerTaiko(HitObjectManager hom, int startTime, int endTime, HitObjectSoundType soundType)
            : base(hom, startTime, endTime, soundType)
        {
            rotationRequirement      = (int)Math.Max(1, (rotationRequirement * 1.65f));
            totalRotationRequirement = rotationRequirement;

            if (ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.DoubleTime))
            {
                rotationRequirement = Math.Max(1, (int)(rotationRequirement * 0.75f));
            }
            if (ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.HalfTime))
            {
                rotationRequirement = Math.Max(1, (int)(rotationRequirement * 1.5f));
            }

            if (hitObjectManager.spriteManager != null)
            {
                SpriteBonusCounter.Transformations = new List <Transformation>(SpriteCircleTop.Transformations);
                SpriteBonusCounter.Text            = (rotationRequirement + 1).ToString();

                WarningIcon =
                    new pSprite(TextureManager.Load("spinner-warning"), Fields.GamefieldWide, Origins.Centre,
                                Clocks.Audio, Position, SpriteManager.drawOrderBwd(StartTime + 1), false, Color.White);
                SpriteCollection.Add(WarningIcon);
                WarningIcon.TagNumeric = -5;
                DimCollection.Add(WarningIcon);

                WarningIcon.Transformations.Add(
                    new Transformation(TransformationType.Fade, 0, 1, startTime - hitObjectManager.PreEmpt,
                                       startTime - (int)(hitObjectManager.PreEmpt * 0.6)));
            }


            Kiai = false;
        }
        internal ScoreboardEntryExtended(int rank, User user, int score) : base(rank, user.Name, score)
        {
            this.user = user;
            bool hasAvatar = user.CheckAvatar();

            if (!hasAvatar)
            {
                user.AvatarLoadComplete += user_AvatarLoadComplete;
            }

            foreach (pSprite p in SpriteCollection)
            {
                p.OriginPosition += new Vector2(-50, 0);
            }

            spriteAvatar = new pSprite(hasAvatar ? user.spriteAvatar.Texture : null, FieldTypes.Window,
                                       OriginTypes.Centre,
                                       ClockTypes.Game,
                                       position + new Vector2(16.8f, 15f), 0.920001f, true,
                                       Color.White);
            spriteAvatar.CurrentColour = Color.TransparentWhite;
            SpriteCollection.Add(spriteAvatar);
            if (hasAvatar)
            {
                spriteAvatar.CurrentScale = 51F / Math.Max(spriteAvatar.Width, spriteAvatar.Height);
            }
        }
Beispiel #9
0
        internal pChannelTab(string name, object tag, Vector2 position, float depth, bool flip, bool skinnable, Transformation hoverEffect, bool canClose)
            : base(name, tag, position, depth, flip, skinnable, hoverEffect)
        {
            this.canClose = canClose;

            if (canClose)
            {
                closeButton = new pSprite(TextureManager.Load(@"selection-tab-close", SkinSource.Osu), Fields.TopLeft, Origins.TopLeft, Clocks.Game, position, depth + 0.0002f, true, new Color(255, 255, 255, 1));
                closeButton.OriginPosition = new Vector2(-49, 8);
                closeButton.Tag            = this;
                SpriteCollection.Add(closeButton);

                closeButtonOver = new pSprite(TextureManager.Load(@"selection-tab-close", SkinSource.Osu), Fields.TopLeft, Origins.TopLeft, Clocks.Game, position, depth + 0.0002f, true, new Color(255, 255, 255, 1));
                closeButtonOver.OriginPosition = new Vector2(-49, 8);
                closeButtonOver.HandleInput    = true;
                closeButtonOver.OnClick       += closeButton_OnClick;
                closeButtonOver.Tag            = this;
                closeButtonOver.HoverPriority  = -10;
                closeButtonOver.OnHover       += delegate { closeButtonOver.Alpha = tabBackground.Alpha * 1; closeButtonOver.InitialColour = Color.White; };
                closeButtonOver.OnHoverLost   += delegate { closeButtonOver.Alpha = tabBackground.Alpha * 0.01f; closeButtonOver.InitialColour = new Color(255, 255, 255, 1); };
                SpriteCollection.Add(closeButtonOver);

                tabBackground.OnHover     += tabBackground_OnHover;
                tabBackground.OnHoverLost += tabBackground_OnHoverLost;
            }
        }
Beispiel #10
0
        internal BeatmapPanel(Beatmap beatmap)
        {
            backingPlate            = pSprite.FullscreenWhitePixel;
            backingPlate.Alpha      = 1;
            backingPlate.AlwaysDraw = true;
            backingPlate.Colour     = Color4.OrangeRed;
            backingPlate.Scale.Y    = 80;
            backingPlate.Scale.X   *= 0.8f;
            backingPlate.DrawDepth  = 0.8f;
            SpriteCollection.Add(backingPlate);

            this.beatmap = beatmap;

            backingPlate.OnClick += delegate {
                backingPlate.MoveTo(backingPlate.Position - new Vector2(50, 0), 600);
                backingPlate.Transform(new Transformation(TransformationType.VectorScale, backingPlate.Scale,
                                                          new Vector2(backingPlate.Scale.X * 1.2f, backingPlate.Scale.Y),
                                                          backingPlate.ClockingNow, backingPlate.ClockingNow + 600));

                backingPlate.UnbindAllEvents();

                Player.SetBeatmap(beatmap);
                Director.ChangeMode(OsuMode.Play);
            };

            backingPlate.HandleClickOnUp = true;

            backingPlate.OnHover     += delegate { backingPlate.Colour = Color4.YellowGreen; };
            backingPlate.OnHoverLost += delegate { backingPlate.Colour = Color4.OrangeRed; };

            text = new pText(Path.GetFileNameWithoutExtension(beatmap.BeatmapFilename), 18, Vector2.Zero, Vector2.Zero, 1, true, Color4.White, false);
            SpriteCollection.Add(text);
        }
        internal ScoreboardEntryExtended(int rank, User user, MatchScoringTypes scoreType, PlayModes playMode, SlotTeams team, Mods mods = Mods.None)
            : base(rank, user.Name, playMode)
        {
            PositionOffset = new Vector2(32.4f, 0);

            Team           = team;
            this.scoreType = scoreType;
            this.mods      = mods;


            //SpriteCollection.AddRange(ModManager.ShowModSprites(mods, new Vector2(34, 6), 0.5f));

            SpriteAvatar = new pSpriteDynamic(null, null, 0, new Vector2(-15.6f, 12.51f), 0.920001f)
            {
                Alpha = 0
            };
            user.LoadAvatarInto(SpriteAvatar, 51f);

            SpriteSkip = new pSprite(TextureManager.Load(@"multi-skipped"), Fields.TopLeft, Origins.BottomRight, Clocks.Game, new Vector2(86, 30), SpriteBackground.Depth + 0.000001f, true, Color.White)
            {
                Alpha  = 0,
                Bypass = true
            };

            SpriteCollection.Add(SpriteSkip);
            SpriteCollection.Add(SpriteAvatar);

            UpdateSpriteLayout();
        }
        public override void Load(ContentManager content)
        {
            Sprite bg = new Sprite("Background", content.Load <Texture2D>("Backgrounds/Game Screen 6"), Vector2.Zero, Color.White);

            SpriteCollection.Add(bg);

            Sprite homeButton = new Sprite("homeButton", content.Load <Texture2D>("Screen Images/Home Icon"), new Vector2(0, 1500), Color.White);

            homeButton.Origin = new Vector2(homeButton.Width / 2, homeButton.Height / 2);
            homeButton.X      = RenderTarget.Width / 2;
            SpriteCollection.Add(homeButton);


            Sprite title = new Sprite("title", content.Load <Texture2D>("Screen Images/ScoreTitle"), new Vector2(RenderTarget.Width / 2, 182), Color.White);

            title.Origin = new Vector2(title.Width / 2, 0);
            SpriteCollection.Add(title);

            SpriteLabel timeTitle = new SpriteLabel("timeTitle", content.Load <SpriteFont>("Fonts/dnk48"), "Time:", new Vector2(58, 286), Color.White);
            SpriteLabel typeTitle = new SpriteLabel("typeTitle", content.Load <SpriteFont>("Fonts/dnk48"), "Type:", new Vector2(449, 286), Color.White);
            SpriteLabel dateTitle = new SpriteLabel("dateTitle", content.Load <SpriteFont>("Fonts/dnk48"), "Date:", new Vector2(836, 286), Color.White);

            SpriteCollection.Add(timeTitle);
            SpriteCollection.Add(typeTitle);
            SpriteCollection.Add(dateTitle);

            SpriteLabel highScoreLabel = new SpriteLabel("highScoreLabel", content.Load <SpriteFont>("Fonts/dnk48"), String.Empty, new Vector2(RenderTarget.Width / 2, 350), Color.Black);

            SpriteCollection.Add(highScoreLabel);

            int y          = 441;
            int difference = 200;

            for (int i = 0; i < Global.HighScores.Length; i++)
            {
                SpriteLabel scoreLabel = new SpriteLabel(String.Format("scoreLabel{0}", i), content.Load <SpriteFont>("Fonts/dnk48"), String.Empty, new Vector2(timeTitle.X + timeTitle.Width / 2.4f, y), Color.White);
                SpriteCollection.Add(scoreLabel);

                HighScoreControl scoreTypeLabel = new HighScoreControl(String.Format("scoreTypeLabel{0}", i), ControlTypes.NoControl, scoreLabel.Position);
                scoreTypeLabel.X = typeTitle.X + typeTitle.Width / 2.4f;
                SpriteCollection.Add(scoreTypeLabel);

                SpriteLabel scoreDateLabel = new SpriteLabel(String.Format("scoreDateLabel{0}", i), content.Load <SpriteFont>("Fonts/dnk48"), String.Empty, scoreLabel.Position, Color.White);
                scoreDateLabel.X = dateTitle.X + dateTitle.Width / 2.4f;
                SpriteCollection.Add(scoreDateLabel);


                y += difference;
            }

#if WINDOWS
            homeButton.MouseClick += homeButton_MouseClick;
#else
            TouchManager touchManger = TouchManager.Instance;
            touchManger.GestureOccured += touchManger_GestureOccured;
#endif

            clickSound = content.Load <SoundEffect>("Sounds/Effects/RD click Sound");
        }
        public HitCircleFruits(HitObjectManager hom, Vector2 startPosition, int startTime, bool newCombo, HitObjectSoundType soundType, string fruit)
            : base(hom)
        {
            Position     = new Vector2(OsuMathHelper.Clamp(startPosition.X, 0, GameField.DEFAULT_WIDTH), 340);
            BasePosition = Position;
            StartTime    = startTime;
            EndTime      = startTime;
            SoundType    = soundType;

            NewCombo = newCombo;

            if (hom.spriteManager != null)
            {
                SpriteHitCircle1 =
                    new pSprite(TextureManager.Load(@"fruit-" + fruit), Fields.Gamefield, Origins.Centre,
                                Clocks.Audio, Position, SpriteManager.drawOrderBwd(StartTime), false, Color.White);
                SpriteCollection.Add(SpriteHitCircle1);
                DimCollection.Add(SpriteHitCircle1);
                SpriteHitCircle1.TagNumeric = 1;

                SpriteHitCircle2 =
                    new pSprite(TextureManager.Load(@"fruit-" + fruit + "-overlay"), Fields.Gamefield,
                                Origins.Centre, Clocks.Audio, Position,
                                SpriteManager.drawOrderBwd(StartTime - 1), false, Color.White);
                SpriteCollection.Add(SpriteHitCircle2);
                DimCollection.Add(SpriteHitCircle2);

                SpriteHyperDash =
                    new pSprite(TextureManager.Load(@"fruit-" + fruit), Fields.Gamefield,
                                Origins.Centre, Clocks.Audio, Position,
                                SpriteManager.drawOrderBwd(StartTime + 1), false, Color.TransparentBlack);
                SpriteHyperDash.Additive = true;
                SpriteCollection.Add(SpriteHyperDash);
                DimCollection.Add(SpriteHyperDash);

                Transformation fall1 = new Transformation(new Vector2(Position.X, -100), new Vector2(Position.X, 340), StartTime - hitObjectManager.PreEmpt, StartTime);

                fall1.EndVector.Y += (fall1.EndVector.Y - fall1.StartVector.Y) * 0.2f;
                fall1.Time2       += (int)(fall1.Duration * 0.2f);

                float rotation = RNG.NextSingle(-0.2f, 0.2f);

                SpriteCollection.ForEach(s =>
                {
                    s.Transformations.Add(fall1);
                    s.Rotation = rotation;
                });

                if (ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.Hidden))
                {
                    Transformation t = new Transformation(TransformationType.Fade, 1, 0, startTime - (int)(hitObjectManager.PreEmpt * 0.6),
                                                          startTime - (int)(hitObjectManager.PreEmpt * 0.44));
                    SpriteCollection.ForEach(s => s.Transformations.Add(t));
                }
            }
        }
Beispiel #14
0
        void Initialize(int numberOfSnowflakes)
        {
            for (int i = 0; i < numberOfSnowflakes; i++)
            {
                snowflakes.Add(new Snowflake());
            }
            SdlDotNet.Graphics.Font font = new SdlDotNet.Graphics.Font(Path.Combine(filePath, Path.Combine(dataDirectory, fontName)), 24);

            textItems.Add(new TextItem(textArray[0], font, 25, 0));
            for (int i = 1; i < textArray.Length; i++)
            {
                textItems.Add(
                    new TextItem(textArray[i],
                                 font, i * 50,
                                 i * 2));
            }
            snowflakes.EnableTickEvent();
            textItems.EnableTickEvent();
        }
Beispiel #15
0
        public Manager()
        {
            mVideo = Video.SetVideoMode(500, 500);
            mHero  = new Hero(mVideo);

            //start with 10 enemies

            // mEnemy = new Enemy(mVideo);
            enemies = new List <Enemy>();
            //enemies.Add(mEnemy);
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));
            enemies.Add(new Enemy(mVideo));

            col = new SpriteCollection();
            col.Add(mHero);

            col.EnableKeyboardEvent();

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 30; j++)
                {
                    if (intTileArray[i, j] == 1)
                    {
                        spriteTileArray[i, j] = new Blok(mVideo, j * 15, (100 + i * 100));
                    }


                    if (intTileArray[i, j] == 2)
                    {
                        spriteTileArray[i, j] = new Ladder(mVideo, j * 15, (100 + i * 100));
                    }
                }
            }


            stateObj.onGround = false;


            System.Timers.Timer myTime = new System.Timers.Timer();
            myTime.Elapsed += myTime_Elapsed;

            myTime.Interval = 3000;
            myTime.Start();
            Events.Tick += Events_Tick;
            Events.Run();
        }
Beispiel #16
0
        internal override void Display()
        {
            pText pt = new pText("Press a key to change the binding..\nHit 'esc' to cancel.", 40, new Vector2(320, 240), 1, true, Color.White);

            pt.TextShadow    = true;
            pt.TextBounds    = new Vector2(1024, 0);
            pt.TextAlignment = Alignment.Centre;
            pt.OriginType    = OriginTypes.Centre;
            SpriteCollection.Add(pt);

            base.Display();
        }
Beispiel #17
0
        protected override void ProcessResource(SpriteCollection aSprites)
        {
            var files = GetXmlFiles(Directories.Sprites);

            if (files.Any())
            {
                var previous = SetCurrentDirectory(Directories.Sprites);
                OnCategoryProcessing(ResourceTypes.Sprites);

                foreach (var file in files)
                {
                    var document = LoadXml(file);

                    if (document != null)
                    {
                        var sprite      = new Sprite();
                        var boundingBox = document.Element("BoundingBox");

                        sprite.ID                          = GetElementValue <int>(document, "ID");
                        sprite.Name                        = GetElement(document, "Name").Value;
                        sprite.OriginX                     = GetElementValue <int>(document, "OriginX");
                        sprite.OriginY                     = GetElementValue <int>(document, "OriginY");
                        sprite.CollisionMaskShape          = GetElementValue <CollisionMaskShapes>(document, "CollisionMaskShape");
                        sprite.CollisionMaskAlphaTolerance = GetElementValue <byte>(document, "CollisionMaskAlphaTolerance");
                        sprite.SeperateCollisionMasks      = GetElementValue <bool>(document, "SeperateCollisionMasks");

                        sprite.BoundingBoxType   = GetElementValue <BoundingBoxTypes>(boundingBox, "Type");
                        sprite.BoundingBoxLeft   = GetElementValue <int>(boundingBox, "Left");
                        sprite.BoundingBoxRight  = GetElementValue <int>(boundingBox, "Right");
                        sprite.BoundingBoxBottom = GetElementValue <int>(boundingBox, "Bottom");
                        sprite.BoundingBoxTop    = GetElementValue <int>(boundingBox, "Top");

                        foreach (var element in document.Element("Subimages").Elements("BitmapPath"))
                        {
                            var subimage = new Sprite.Subimage();
                            LoadImage(element.Value, out subimage.Bitmap, out subimage.Width, out subimage.Height);
                            sprite.Subimages.Add(subimage);
                        } // ?

                        aSprites.Add(sprite);
                    }

                    OnAbortProcessingCallback();
                }

                OnCategoryProcessed(ResourceTypes.Sounds);
                SetCurrentDirectory(previous);
            }
        }
Beispiel #18
0
        public pSearchBox(int size, Vector2 position, int lengthLimit = 20, TextAlignment alignment = TextAlignment.Left)
            : base(size, position, 0, true)
        {
            MaintainFocus   = true;
            Box.TextBold    = false;
            Box.HandleInput = false;
            LengthLimit     = lengthLimit;
            this.size       = size;
            this.position   = position;
            this.alignment  = alignment;

            HandleLeftRightArrows = false;

            DefaultText = LocalisationManager.GetString(OsuString.SongSelection_TypeToBegin);

            //search bar
            icon       = new pTextAwesome(FontAwesome.search, size + 2, new Vector2(position.X, position.Y + size * 0.1f));
            icon.Depth = Box.Depth;
            SpriteCollection.Add(icon);

            if (alignment != TextAlignment.Centre)
            {
                Box.Position.X += size;
            }

            SpriteCollection.ForEach(s =>
            {
                switch (alignment)
                {
                case TextAlignment.Left:
                    s.Field  = Fields.TopLeft;
                    s.Origin = Origins.TopLeft;
                    break;

                case TextAlignment.Centre:
                    s.Field  = Fields.TopCentre;
                    s.Origin = Origins.TopCentre;
                    break;

                case TextAlignment.Right:
                    s.Field  = Fields.TopRight;
                    s.Origin = Origins.TopRight;
                    break;
                }
            });

            OnChange += delegate { layout(); };
        }
Beispiel #19
0
        //Main program loop
        private void Go()
        {
            //Set up screen
            if (File.Exists(Path.Combine(dataDirectory, "background.png")))
            {
                filePath = "";
            }
            background = new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "background.png")));
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Bounce Sprites";
            screen = Video.SetVideoMode(width, height);
            screen.Blit(background);
            screen.Update();

            //This loads the various images (provided by Moonfire)
            // into a SurfaceCollection for animation
            SurfaceCollection marbleSurfaces = new SurfaceCollection();

            marbleSurfaces.Add(new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "marble1.png"))), new Size(50, 50));

            for (int i = 0; i < this.maxBalls; i++)
            {
                //Create a new Sprite at a random location on the screen
                master.Add(new BounceSprite(marbleSurfaces,
                                            new Point(rand.Next(screen.Rectangle.Left, screen.Rectangle.Right),
                                                      rand.Next(screen.Rectangle.Top, screen.Rectangle.Bottom))));
            }

            //The collection will respond to mouse button clicks, mouse movement and the ticker.
            master.EnableMouseButtonEvent();
            master.EnableMouseMotionEvent();
            master.EnableTickEvent();

            //These bind the events to the above methods.
            Events.KeyboardDown +=
                new EventHandler <KeyboardEventArgs>(this.KeyboardDown);
            Events.Tick += new EventHandler <TickEventArgs>(this.Tick);
            Events.Quit += new EventHandler <QuitEventArgs>(this.Quit);

            //Start the event ticker
            Events.Run();
        }
        protected virtual void ApplyContentImage()
        {
            if (CurrentImage != null)
            {
                if (CurrentKey != null && SpriteCollection.ContainsKey(CurrentKey))
                {
                    SpriteCollection[CurrentKey] = CurrentImage;
                }
                else if (CurrentKey != null)
                {
                    SpriteCollection.Add(CurrentKey, CurrentImage);
                }
                else
                {
                    CurrentKey = SpriteCollection.Add(CurrentImage);
                }
            }

            CurrentWaitableSpriteKey.SetResult(CurrentKey);
        }
Beispiel #21
0
        internal override void InitializeSprites()
        {
            if (GameBase.GameField.CorrectionOffsetActive)
            {
                spinnerTopOffset -= 16;
            }

            //this is madness, but works.
            posTopLeftCentre = new Vector2(GameBase.WindowManager.WidthScaled / Math.Max(1, GameBase.WindowManager.WidthWidescreenRatio) / 2f, spinnerTopOffset + 219);

            Color fade = (GameBase.Mode == OsuModes.Play &&
                          (ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.SpunOut) || Player.Relaxing2)
                              ? Color.Gray
                              : Color.White);

            SpriteCircleTop =
                new pSprite(TextureManager.Load(@"spinner-circle", SkinSource.Osu | SkinSource.Skin), Fields.TopLeft,
                            Origins.Centre,
                            Clocks.Audio, posTopLeftCentre, SpriteManager.drawOrderBwd(EndTime), false,
                            fade);
            SpriteCollection.Add(SpriteCircleTop);

            if (!ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.Hidden))
            {
                pTexture highRes = TextureManager.Load(@"spinner-approachcircle", SkinSource.Skin);

                SpriteApproachCircle =
                    new pSprite(TextureManager.Load(@"spinner-approachcircle", SkinSource.Osu | SkinSource.Skin), Fields.TopLeft, Origins.Centre,
                                Clocks.Audio, posTopLeftCentre, SpriteManager.drawOrderBwd(EndTime - 2), false, fade);
                SpriteCollection.Add(SpriteApproachCircle);
            }

            SpriteBonusCounter = new pSpriteText("", SkinManager.Current.FontScore, SkinManager.Current.FontScoreOverlap,
                                                 Fields.TopLeft, Origins.Centre,
                                                 Clocks.Audio, new Vector2(posTopLeftCentre.X, posTopLeftCentre.Y + 80),
                                                 SpriteManager.drawOrderBwd(EndTime - 3), false,
                                                 fade);
            SpriteCollection.Add(SpriteBonusCounter);

            SpriteCircleTop.Scale *= 0.8f;
        }
        protected override void ApplyClicked()
        {
            if (CurrentImage != null)
            {
                if (CurrentKey != null && SpriteCollection.ContainsKey(CurrentKey))
                {
                    SpriteCollection[CurrentKey] = CurrentImage;
                }
                else if (CurrentKey != null)
                {
                    SpriteCollection.Add(CurrentKey, CurrentImage);
                }
                else
                {
                    CurrentKey = SpriteCollection.Add(CurrentImage);
                }
            }

            CurrentWaitableSpriteKey.SetResult(CurrentKey);

            base.ApplyClicked();
        }
Beispiel #23
0
        public HitCircleManiaLong(HitObjectManager hom, int column, int startTime, int endTime, HitObjectSoundType soundType)
            : base(hom, column, startTime, soundType)
        {
            //Physical column index
            column = Column;

            SoundType      = soundType;
            SoundTypeStart = soundType;
            SoundTypeEnd   = soundType;
            ManiaType      = ManiaNoteType.Long;
            EndTime        = endTime;
            Length         = EndTime - StartTime;
            SoundAtEnd     = true;

            if (!hom.ManiaStage.Minimal)
            {
                //head note -- the origin one
                s_note.TextureArray = LoadCustomImages(string.Format("NoteImage{0}H", column), Column.NoteString + @"H");
                s_note.FlipVertical = hom.ManiaStage.Skin.GetNoteFlipVertical(column, "H", s_note.FlipVertical);
                ScaleAdjust(s_note);

                //rear note
                s_rear              = new pAnimation(LoadCustomImages(string.Format("NoteImage{0}T", column), Column.NoteString + @"T") ?? s_note.TextureArray, Fields.TopLeft, s_note.Origin, Clocks.Audio, Position, 0.7975f, false, Color.White);
                s_rear.Alpha        = s_note.Alpha;
                s_rear.FlipVertical = !hom.ManiaStage.Skin.GetNoteFlipVertical(column, "T");
                ScaleAdjust(s_rear);
                SpriteCollection.Add(s_rear);

                //body note
                s_body              = new pAnimation(LoadCustomImages(string.Format("NoteImage{0}L", column), Column.NoteString + @"L"), Fields.TopLeft, s_note.Origin, Clocks.Audio, Position, 0.795F, false, Color.White);
                s_body.Alpha        = s_note.Alpha;
                s_body.FrameDelay   = 30;
                s_body.RunAnimation = false;  //run when press
                s_body.FlipVertical = hom.ManiaStage.Skin.GetNoteFlipVertical(column, "L");
                ScaleAdjust(s_body);
                SpriteCollection.Add(s_body);
            }
        }
        public HitCircleMania(HitObjectManager hom, int column, int startTime, HitObjectSoundType soundType)
            : base(hom)
        {
            LogicalColumn = column;
            column        = ((HitObjectManagerMania)hom).GetPhysicalColumn(column);
            Column        = hom.ManiaStage.Columns[column];

            Position     = new Vector2(Column.Left - Column.Host.Left + Column.Width / 2, -100);
            BasePosition = Position;
            StartTime    = startTime;
            EndTime      = startTime;
            SoundType    = soundType;

            if (!hom.ManiaStage.Minimal)
            {
                s_note =
                    new pAnimation(LoadCustomImages(@"NoteImage" + column.ToString(), Column.NoteString), Fields.TopLeft, hom.ManiaStage.FlipOrigin(Origins.BottomCentre), Clocks.Audio, Position, 0.8f, false, Color.White);
                s_note.Alpha        = 1;
                s_note.FlipVertical = hom.ManiaStage.Skin.GetNoteFlipVertical(column);
                ScaleAdjust(s_note);
                SpriteCollection.Add(s_note);
            }
        }
Beispiel #25
0
        protected virtual void InitializeSpritesNoFadeIn()
        {
            if (GameBase.Mode == OsuModes.Play)
            {
                spriteSpin = new pSprite(TextureManager.Load(@"spinner-spin"), Fields.TopLeft, Origins.Centre, Clocks.Audio, new Vector2(posTopLeftCentre.X, spinnerTopOffset + 335), SpriteManager.drawOrderFwdLowPrio(StartTime + 6), false, Color.White);
                spriteSpin.Transformations.Add(new Transformation(TransformationType.Fade, 0, 1, StartTime - HitObjectManager.FadeIn / 2, StartTime));
                spriteSpin.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, EndTime - Math.Min(400, EndTime - StartTime), EndTime));
                SpriteCollection.Add(spriteSpin);

                spriteClear = new pSprite(TextureManager.Load(@"spinner-clear"), Fields.TopLeft, Origins.Centre, Clocks.Audio, new Vector2(posTopLeftCentre.X, spinnerTopOffset + 115), SpriteManager.drawOrderFwdLowPrio(StartTime + 7), false, Color.White);
                spriteClear.Transformations.Add(new Transformation(TransformationType.Fade, 0, 0, StartTime, EndTime));
                SpriteCollection.Add(spriteClear);
            }

            if (newStyleSpinner)
            {
                spriteGlow          = new pSprite(TextureManager.Load(@"spinner-glow"), Fields.TopLeft, Origins.Centre, Clocks.Audio, new Vector2(posTopLeftCentre.X, spinnerTopOffset + 219), SpriteManager.drawOrderFwdLowPrio(StartTime - 1), false, Color.TransparentWhite);
                spriteGlow.Additive = true;
                spriteGlow.Transformations.Add(new Transformation(TransformationType.Fade, 0, 0, StartTime, EndTime));
                SpriteCollection.Add(spriteGlow);

                spriteMiddleTop.Scale = spriteMiddleBottom.Scale = SpriteCircleTop.Scale = spriteCircleBottom.Scale = spriteGlow.Scale = 0.8f;
            }
        }
        public override void Load(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            _content = content;
            loadingDropingObjects(content);
            loadingBackgrounds(content);
            loadingSongs(content);



            FallingItem.FallingSpeed = startingSpeed;
            startingDifficultyTime   = new TimeSpan(0, 0, 3);
            elapsedArrowTime         = TimeSpan.Zero;
            difficultyTime           = startingDifficultyTime;

            arrowFadeTime = new TimeSpan(0, 0, 0, 5);

            //SpriteLabel tutorialText = new SpriteLabel("tutorialText", content.Load<SpriteFont>("Fonts/FS14"), "Press the arrows to move!", Vector2.Zero, Color.Black);
            //tutorialText.Scale = new Vector2(3);
            //tutorialText.Position = new Vector2(RenderTarget.Width / 2 - tutorialText.Width / 2, RenderTarget.Height - tutorialText.Height * 2);
            //tutorialText.IsVisible = Global.Tutorial;

            _columns = new Column[fallingLocation.Length];
            for (int i = 0; i < _columns.Length; i++)
            {
                _columns[i] = new Column(fallingLocation[i].X.ToInt(true), RenderTarget.Height);
            }

            _columns[0].NextColumns.Add(_columns[1]);

            //_columns[1].NextColumns.Add(_columns[0]);
            _columns[1].NextColumns.Add(_columns[2]);

            //_columns[2].NextColumns.Add(_columns[1]);
            _columns[2].NextColumns.Add(_columns[3]);

            _columns[3].NextColumns.Add(_columns[2]);


            backGround = new Sprite("backGround", Global.Backgrounds[Global.CurrentBackgroundIndex], Vector2.Zero, Color.White);


            leftHelpButton          = new Sprite("leftButton", content.Load <Texture2D>("Screen Images/Left Arrow"), Vector2.Zero, Color.White);
            leftHelpButton.Scale    = new Vector2(.8f);
            leftHelpButton.Position = new Vector2(0, RenderTarget.Height - leftHelpButton.Height * 3f);
            leftHelpButton.Color    = Color.Lerp(Color.White, Color.Transparent, .3f);

            //leftHelpButton.Effect = SpriteEffects.FlipHorizontally;

            rightHelpButton          = new Sprite("rightButton", content.Load <Texture2D>("Screen Images/Right Arrow"), Vector2.Zero, Color.White);
            rightHelpButton.Scale    = leftHelpButton.Scale;
            rightHelpButton.Position = new Vector2(RenderTarget.Width - rightHelpButton.Width, leftHelpButton.Y);
            rightHelpButton.Color    = Color.Lerp(Color.White, Color.Transparent, .3f);



            _fpsLabel           = new SpriteLabel("SpeedLabel", content.Load <SpriteFont>("Fonts/dnk24"), String.Empty, Vector2.Zero, Color.Black);
            _fpsLabel.Text      = String.Format("Speed: {0}", FallingItem.FallingSpeed);
            _fpsLabel.Scale     = new Vector2(3);
            _fpsLabel.Y         = RenderTarget.Height - _fpsLabel.Height;
            _fpsLabel.IsVisible = false;

            //death
            Texture2D   firstDeathFrame = content.Load <Texture2D>("Characters/Effects/Death/explosion1");
            SpriteSheet deathSprite     = new SpriteSheet("RedPanda", Vector2.Zero, Color.White, firstDeathFrame);

            for (int i = 2; i < 6; i++)
            {
                Sprite deathFrame = new Sprite("RedPanda", content.Load <Texture2D>(String.Format("Characters/Effects/Death/explosion{0}", i)), Vector2.Zero, Color.White);
                deathSprite.Add(deathFrame);
            }

            foreach (Sprite frame in deathSprite)
            {
                frame.Origin = new Vector2(frame.Width / 2, frame.Height / 3 * 2);
                frame.Scale  = new Vector2(0.8f);
            }
            deathSprite.AnimateTime      = TimeSpan.FromMilliseconds(100);
            deathSprite.AnimationFinish += deathSprite_AnimationFinish;

            playerIndex = 1;

            //ria load
            Sprite idleRiaFrame = new Sprite("RedPanda", content.Load <Texture2D>("Characters/RedPanda/Ria/0"), Vector2.Zero, Color.White);

            idleRiaFrame.Origin = new Vector2(380, idleRiaFrame.Height);


            Texture2D   test            = content.Load <Texture2D>("Characters/RedPanda/Ria/1");
            SpriteSheet movingRiaFrames = new SpriteSheet("RedPanda", Vector2.Zero, Color.White, test);

            for (int i = 2; i < 7; i++)
            {
                Sprite frame = new Sprite("RedPanda", content.Load <Texture2D>(String.Format("Characters/RedPanda/Ria/{0}", i)), Vector2.Zero, Color.White);
                movingRiaFrames.Add(frame);
            }
            movingRiaFrames.Origin = new Vector2(380, test.Height);


            movingRiaFrames.AnimateTime = TimeSpan.FromMilliseconds(25 / (_level + 1));//speed animation up according to level. Kevin

            movingRiaFrames.AnimationFinish += movingRiaFrames_AnimationFinish;

            player = new Character(new ISprite[] { idleRiaFrame, movingRiaFrames, deathSprite });

            player.Position = new Vector2(fallingLocation[playerIndex].X - 1, RenderTarget.Height - 50);

            direction = Direction.None;
            //SpriteCollection.Add(tutorialText);
            SpriteCollection.Add(backGround);
            SpriteCollection.Add(_fpsLabel);

            SpriteCollection.Add(leftHelpButton);
            SpriteCollection.Add(rightHelpButton);

            string leftSwipeFile  = String.Empty;
            string rightSwipeFile = String.Empty;

            XnaAudio.MediaPlayer.Volume = 1;

            SpriteCollection.NameCheck = false;
            SpriteCollection.Add(player);

            foreach (Column column in _columns)
            {
                foreach (FallingItem item in column.Pool)
                {
                    SpriteCollection.Add(item);
                }
            }
            if (Global.Control == ControlTypes.Swipe)
            {
                leftHelpButton.IsVisible  = false;
                rightHelpButton.IsVisible = false;
            }
            else
            {
                leftHelpButton.IsVisible  = true;
                rightHelpButton.IsVisible = true;
            }
            _lastSpwaned   = _columns[0];
            Column.OffSet  = player.BoundingBox.Height + player.BoundingBox.Height / 4;
            leftSwipeFile  = "Sounds/Effects/Air 1 swipe to left";
            rightSwipeFile = "Sounds/Effects/Air 2 swipe to right";
#if !WINDOWS
            TouchManager touch = TouchManager.Instance;
            touch.GestureOccured += touch_GestureOccured;
#endif

            SpriteLabel helperLabel = new SpriteLabel("helperLabel", content.Load <SpriteFont>("Fonts/dnk48"), String.Empty, new Vector2(RenderTarget.Width / 2, RenderTarget.Height / 2), Color.White);

            helperLabel.Y     += 425;
            helperLabel.Origin = new Vector2(helperLabel.Width / 2, helperLabel.Height / 2);
            //helperLabel.Scale = new Vector2(1);
            SpriteCollection.Add(helperLabel);


            timeLabel          = new SpriteLabel("timeLabel", content.Load <SpriteFont>("Fonts/dnk72"), String.Empty, Vector2.Zero, Color.Black);
            timeLabel.Position = new Vector2(RenderTarget.Width / 2, 30);
            //timeLabel.Scale = new Vector2(2);
            SpriteCollection.Add(timeLabel);

            controlLabel       = new HighScoreControl("controlLabel", ControlTypes.Tap, new Vector2(0, 30));
            controlLabel.Scale = new Vector2(0.5f);
            controlLabel.X     = RenderTarget.Width - controlLabel.Width - 30;

            controlLabel.IsVisible = false;
            SpriteCollection.Add(controlLabel);

            deathSound     = content.Load <SoundEffect>("Sounds/Effects/DeathSound"); //content.Load<XnaAudio.Song>("Sounds/DeathSound");
            leftSwipe      = content.Load <SoundEffect>(leftSwipeFile);               //content.Load<XnaAudio.Song>(leftSwipeFile);
            rightSwipe     = content.Load <SoundEffect>(rightSwipeFile);              // content.Load<XnaAudio.Song>(rightSwipeFile);
            highScoreSound = content.Load <SoundEffect>("Sounds/Effects/RD High Score");
            _level         = 0;



            SpriteCollection.IsReadOnly = true;
        }
Beispiel #27
0
        public void DrawError(string error)
        {
            try
            {
                Color foreColor = Color.FromArgb(117, 161, 236);
                Color backColor = Color.FromArgb(65, 55, 205);

                screen.Draw(
                    new Box(
                        (short)xPos,
                        (short)yPos,
                        (short)(xPos + C64WIDTH * scale - 1),
                        (short)(yPos + C64BORDER * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );
                screen.Draw(
                    new Box(
                        (short)xPos,
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale),
                        (short)(xPos + C64WIDTH * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );
                screen.Draw(
                    new Box(
                        (short)xPos,
                        (short)(yPos + C64BORDER * scale),
                        (short)(xPos + C64BORDER * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );
                screen.Draw(
                    new Box(
                        (short)(xPos + C64WIDTH * scale - (C64BORDER - 1) * scale),
                        (short)(yPos + C64BORDER * scale),
                        (short)(xPos + C64WIDTH * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );

                screen.Draw(
                    new Box(
                        (short)(xPos + C64BORDER * scale),
                        (short)(yPos + C64BORDER * scale),
                        (short)(xPos + C64WIDTH * scale - (C64BORDER - 1) * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale - 1)
                        ),
                    backColor,
                    false,
                    true
                    );

                string[] lines = new string[error.Length / 33 + 2];

                lines[0] = "Error:";
                for (int i = 1; i < lines.Length - 1; i++)
                {
                    lines[i] = error.Substring(0, 33);
                    error    = error.Substring(33);
                }
                lines[lines.Length - 1] = error;

                SpriteCollection errorLines = new SpriteCollection();

                for (int i = 0; i < lines.Length; i++)
                {
                    TextSprite line =
                        new TextSprite(
                            lines[i],
                            menuFont,
                            foreColor,
                            new Point(
                                xPos + C64BORDER * scale + 10 * scale,
                                yPos + C64BORDER * scale + 10 * scale + i * (menuFont.Height + 5 * scale)
                                )
                            );

                    errorLines.Add(line);
                }

                screen.Blit(errorLines);

                screen.Update();
            }
            catch { }
        }
 /// <summary>
 /// Creates a new particle emitter that emits sprite objects.
 /// </summary>
 /// <param name="system">The particle system to add this particle emitter.</param>
 /// <param name="sprite">The sprite to emit.</param>
 public ParticleSpriteEmitter(ParticleSystem system, Sprite sprite)
     : base(system)
 {
     m_Sprites = new SpriteCollection();
     m_Sprites.Add(sprite);
 }
 /// <summary>
 /// Creates a new particle emitter that emits sprite objects.
 /// </summary>
 /// <param name="sprite">The sprite to emit.</param>
 public ParticleSpriteEmitter(Sprite sprite)
 {
     m_Sprites = new SpriteCollection();
     m_Sprites.Add(sprite);
 }
Beispiel #30
0
 /// <summary>
 /// Creates a new particle emitter that emits sprite objects.
 /// </summary>
 /// <param name="system">The particle system to add this particle emitter.</param>
 /// <param name="sprite">The sprite to emit.</param>
 public ParticleSpriteEmitter(ParticleSystem system, Sprite sprite)
     : base(system)
 {
     m_Sprites = new SpriteCollection();
     m_Sprites.Add(sprite);
 }
        internal HitCircleSliderEnd(Vector2 pos, int startTime, int sliderStart, bool reverse, bool addWhistle,
                                    bool addFinish, float angle, Slider parent)
            : base(pos, startTime, false, addWhistle, addFinish)
        {
            SpriteCollection.Remove(SpriteSelectionCircle);
            SpriteCollection.Remove(SpriteApproachCircle);
            SpriteCollection.Remove(SpriteHitCircleText);

            appear =
                new Transformation(TransformationType.Fade, 0, 1, sliderStart,
                                   sliderStart + 150);
            appearfake =
                new Transformation(TransformationType.Fade, 0, 0, sliderStart - HitObjectManager.PreEmptSliderComplete,
                                   sliderStart - HitObjectManager.PreEmptSliderComplete + HitObjectManager.FadeIn);

            disappear1 =
                new Transformation(TransformationType.Fade, 1, 0, startTime, startTime);
            disappear21 =
                new Transformation(TransformationType.Fade, 1, 0, startTime, startTime + HitObjectManager.FadeOut);

            disappear22 =
                new Transformation(TransformationType.Scale, 1F, 1.9F, startTime,
                                   (int)(startTime + (HitObjectManager.FadeOut * 0.7)));
            disappear22.Easing = EasingTypes.In;

            disappear23 =
                new Transformation(TransformationType.Scale, 1.9F, 2F, (int)(startTime + (HitObjectManager.FadeOut * 0.7)),
                                   (startTime + HitObjectManager.FadeOut));

            if (reverse)
            {
                SpriteHitCircleText =
                    new pSprite(SkinManager.Load("reversearrow"), FieldTypes.Gamefield,
                                OriginTypes.Centre, ClockTypes.Audio, Position,
                                SpriteManager.drawOrderBwd(startTime - 2), false, Color.White);
                //SpriteHitCircleText.CurrentRotation = angle;
                SpriteHitCircleText.Transformations.Add(appear);
                SpriteCollection.Add(SpriteHitCircleText);
                DimCollection.Add(SpriteHitCircleText);
            }

            SpriteHitCircle1.Transformations.Clear();
            SpriteHitCircle1.Transformations.Add(appearfake);
            SpriteHitCircle2.Transformations.Clear();
            SpriteHitCircle2.Transformations.Add(appearfake);

            Disarm();

            if (reverse)
            {
                for (int i = sliderStart; i < startTime; i += 300)
                {
                    int length = Math.Min(300, startTime - i);
                    SpriteHitCircleText.Transformations.Add(
                        new Transformation(TransformationType.Scale, 1.3F, 1, i, i + length));
                    SpriteHitCircleText.Transformations.Add(
                        new Transformation(TransformationType.Rotation, angle + MathHelper.Pi / 32,
                                           angle - MathHelper.Pi / 32, i, i + length));
                }
            }
        }
Beispiel #32
0
 /// <summary>
 /// Creates a new particle emitter that emits sprite objects.
 /// </summary>
 /// <param name="sprite">The sprite to emit.</param>
 public ParticleSpriteEmitter(Sprite sprite)
 {
     m_Sprites = new SpriteCollection();
     m_Sprites.Add(sprite);
 }
Beispiel #33
0
 /// <summary>
 /// Create new sprite
 /// </summary>
 /// <param name="vector">Vector of Sprite</param>
 /// <param name="surface">Surface of Sprite</param>
 /// <param name="group">
 /// SpriteCollection group to put Sprite into.
 /// </param>
 public Sprite(Surface surface, Vector vector, SpriteCollection group)
     : this(surface, vector)
 {
     if (group == null)
     {
         throw new ArgumentNullException("group");
     }
     group.Add(this);
 }
Beispiel #34
0
        public void DrawMenu(List <MenuList> menu, int selectedItem, int currentPosition)
        {
            if (isDrawing || isSwitching)
            {
                return;
            }

            isDrawing = true;

            try
            {
                Color foreColor = C64.palette.MapColorValue(14);
                Color backColor = C64.palette.MapColorValue(6);

                screen.Draw(
                    new Box(
                        (short)xPos,
                        (short)yPos,
                        (short)(xPos + C64WIDTH * scale - 1),
                        (short)(yPos + C64BORDER * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );
                screen.Draw(
                    new Box(
                        (short)xPos,
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale),
                        (short)(xPos + C64WIDTH * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );
                screen.Draw(
                    new Box(
                        (short)xPos,
                        (short)(yPos + C64BORDER * scale),
                        (short)(xPos + C64BORDER * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );
                screen.Draw(
                    new Box(
                        (short)(xPos + C64WIDTH * scale - (C64BORDER - 1) * scale),
                        (short)(yPos + C64BORDER * scale),
                        (short)(xPos + C64WIDTH * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale - 1)
                        ),
                    foreColor,
                    false,
                    true
                    );

                screen.Draw(
                    new Box(
                        (short)(xPos + C64BORDER * scale),
                        (short)(yPos + C64BORDER * scale),
                        (short)(xPos + C64WIDTH * scale - (C64BORDER - 1) * scale - 1),
                        (short)(yPos + C64HEIGHT * scale - C64BORDER * scale - 1)
                        ),
                    backColor,
                    false,
                    true
                    );

                SpriteCollection menuItems = new SpriteCollection();

                for (int i = currentPosition; i < currentPosition + Menu.MENUMAXITEMS && i < menu.Count; i++)
                {
                    TextSprite item =
                        new TextSprite(
                            menu[i].Text,
                            menuFont,
                            (selectedItem == i ? backColor : foreColor),
                            new Point(
                                xPos + C64BORDER * scale + 10 * scale + menu[i].Level * 20 * scale,
                                yPos + C64BORDER * scale + 10 * scale + (i - currentPosition) * (menuFont.Height + 10 * scale)
                                )
                            );

                    if (selectedItem == i)
                    {
                        item.BackgroundColor = foreColor;
                    }

                    menuItems.Add(item);
                }

                screen.Blit(menuItems);

                screen.Update();
            }
            catch { }

            isDrawing = false;
        }