Пример #1
0
        public override void OnDraw(Graphics2D graphics2D)
        {
            ImageSequence menuBackground = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "MainMenuBackground");

            graphics2D.Render(menuBackground.GetImageByIndex(0), 0, 0);

            ImageSequence planetOnMenu = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "PlanetOnMenu");

            graphics2D.Render(planetOnMenu.GetImageByRatio(planetRatio.Read()), 620, 360);

            ImageSequence shipOnMenu = (ImageSequence)DataAssetCache.Instance.GetAsset(typeof(ImageSequence), "Player1Ship");

            int    numFrames          = shipOnMenu.NumFrames;
            double animationRatio0to1 = shipRatio.Read();
            double curFrameDouble     = (numFrames - 1) * animationRatio0to1;
            int    curFrameInt        = shipOnMenu.GetFrameIndexByRatio(animationRatio0to1);
            double curFrameRemainder  = curFrameDouble - curFrameInt;
            double anglePerFrame      = MathHelper.Tau / numFrames;
            double angleForThisFrame  = curFrameRemainder * anglePerFrame;

            graphics2D.Render(shipOnMenu.GetImageByIndex(curFrameInt), 177, 156, angleForThisFrame, 1, 1);

            base.OnDraw(graphics2D);
        }