Beispiel #1
0
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            Debug.Assert((int)ButtonImageIndices.Count == ButtonImageNames.Length);
            Debug.Assert(Note.EffectCount == EffectImageIndices.Length);
            Debug.Assert(EnvelopeType.Count == EnvelopeImageIndices.Length);

            bmpButtonAtlas = g.CreateBitmapAtlasFromResources(ButtonImageNames);
            scrollBarBrush = g.CreateSolidBrush(Color.FromArgb(64, Color.Black));

            buttons[(int)ButtonType.Sequencer] = new Button {
                GetRenderInfo = GetSequencerRenderInfo, Click = OnSequencer, IsNavButton = true
            };
            buttons[(int)ButtonType.PianoRoll] = new Button {
                GetRenderInfo = GetPianoRollRenderInfo, Click = OnPianoRoll, IsNavButton = true
            };
            buttons[(int)ButtonType.Project] = new Button {
                GetRenderInfo = GetProjectExplorerInfo, Click = OnProjectExplorer, IsNavButton = true
            };
            buttons[(int)ButtonType.Channel] = new Button {
                GetRenderInfo = GetChannelRenderInfo, Click = OnChannel, ListItemClick = OnChannelItemClick, ListItemLongPress = OnChannelItemLongPress
            };
            buttons[(int)ButtonType.Instrument] = new Button {
                GetRenderInfo = GetInstrumentRenderingInfo, Click = OnInstrument, LongPress = OnInstrumentLongPress, ListItemClick = OnInstrumentItemClick, ListItemLongPress = OnInstrumentItemLongPress
            };
            buttons[(int)ButtonType.Envelope] = new Button {
                GetRenderInfo = GetEnvelopeRenderingInfo, Click = OnEnvelope, ListItemClick = OnEnvelopeItemClick
            };
            buttons[(int)ButtonType.Arpeggio] = new Button {
                GetRenderInfo = GetArpeggioRenderInfo, Click = OnArpeggio, LongPress = OnArpeggioLongPress, ListItemClick = OnArpeggioItemClick, ListItemLongPress = OnArpeggioItemLongPress
            };
            buttons[(int)ButtonType.Snap] = new Button {
                GetRenderInfo = GetSnapRenderInfo, Click = OnSnap, ListItemClick = OnSnapItemClick
            };
            buttons[(int)ButtonType.Effect] = new Button {
                GetRenderInfo = GetEffectRenderInfo, Click = OnEffect, ListItemClick = OnEffectItemClick
            };
            buttons[(int)ButtonType.DPCMEffect] = new Button {
                GetRenderInfo = GetDPCMEffectRenderInfo, Click = OnDPCMEffect, ListItemClick = OnDPCMEffectItemClick
            };
            buttons[(int)ButtonType.DPCMPlay] = new Button {
                GetRenderInfo = GetDPCMPlayRenderInfo, Click = OnDPCMPlay, LongPress = OnDPCMPlayLongPress
            };

            var screenSize = PlatformUtils.GetScreenResolution();
            var scale      = Math.Min(screenSize.Width, screenSize.Height) / 1080.0f;

            buttonFont     = scale > 1.2f ? ThemeResources.FontSmall : ThemeResources.FontVerySmall;
            buttonSize     = ScaleCustom(DefaultButtonSize, scale);
            buttonSizeNav  = ScaleCustom(DefaultNavButtonSize, scale);
            buttonIconPos1 = ScaleCustom(DefaultIconPos1, scale);
            buttonIconPos2 = ScaleCustom(DefaultIconPos2, scale);
            textPosTop     = ScaleCustom(DefaultTextPosTop, scale);
            listItemSize   = ScaleCustom(DefaultListItemSize, scale);
            listIconPos    = ScaleCustom(DefaultListIconPos, scale);
            scrollBarSizeX = ScaleCustom(DefaultScrollBarSizeX, scale);
            iconScaleFloat = ScaleCustomFloat(DefaultIconSize / (float)bmpButtonAtlas.GetElementSize(0).Width, scale);
        }
Beispiel #2
0
        protected override void OnRenderInitialized(RenderGraphics g)
        {
            Debug.Assert((int)ButtonImageIndices.Count == ButtonImageNames.Length);

            var screenSize = PlatformUtils.GetScreenResolution();

            layoutSize = Math.Min(screenSize.Width, screenSize.Height) / 4;

            bmpButtonAtlas       = g.CreateBitmapAtlasFromResources(ButtonImageNames);
            whiteKeyBrush        = g.CreateVerticalGradientBrush(0, layoutSize, Theme.LightGreyFillColor1, Theme.LightGreyFillColor2);
            blackKeyBrush        = g.CreateVerticalGradientBrush(0, layoutSize, Theme.DarkGreyFillColor1, Theme.DarkGreyFillColor2);
            whiteKeyPressedBrush = g.CreateVerticalGradientBrush(0, layoutSize, Theme.Darken(Theme.LightGreyFillColor1), Theme.Darken(Theme.LightGreyFillColor2));
            blackKeyPressedBrush = g.CreateVerticalGradientBrush(0, layoutSize, Theme.Lighten(Theme.DarkGreyFillColor1), Theme.Lighten(Theme.DarkGreyFillColor2));
        }
Beispiel #3
0
        private void UpdateRenderCoords()
        {
            var screenSize = PlatformUtils.GetScreenResolution();
            var scale      = Math.Min(screenSize.Width, screenSize.Height) / 1080.0f;

            whiteKeySizeX = ScaleCustom(DefaultWhiteKeySizeX, scale * zoom);
            blackKeySizeX = ScaleCustom(DefaultBlackKeySizeX, scale * zoom);
            octaveSizeX   = 7 * whiteKeySizeX;
            virtualSizeX  = octaveSizeX * NumOctaves;

            // Center the piano initially.
            if (scrollX < 0)
            {
                scrollX = (virtualSizeX - Width) / 2;
            }
        }