Example #1
0
        public override void Render(float delta, float mouseX, float mouseY)
        {
            _tb.Render(delta, mouseX, mouseY);

            foreach (var button in Buttons)
            {
                button.Render(delta, mouseX, mouseY);
            }

            _lbl.Render(delta, mouseX, mouseY);
        }
        public override void Render(float delta, float mouseX, float mouseY)
        {
            BPMBox.Render(delta, mouseX, mouseY);
            OffsetBox.Render(delta, mouseX, mouseY);

            foreach (var button in Buttons)
            {
                button.Render(delta, mouseX, mouseY);
            }

            BPMLabel.Render(delta, mouseX, mouseY);
            OffsetLabel.Render(delta, mouseX, mouseY);

            var fr = TimingPoints.Instance.FontRenderer;

            var width  = OffsetBox.ClientRectangle.Right - BPMBox.ClientRectangle.Left;
            var height = ClientRectangle.Height / 2;
            var x      = BPMBox.ClientRectangle.X;
            var y      = BPMLabel.ClientRectangle.Y - height - 10;

            GL.LineWidth(5);
            GL.Color3(1f, 1f, 1f);
            Glu.RenderOutline(x, y, width, height);

            for (var i = 0; i < GuiTrack.BPMs.Count; i++)
            {
                if (i >= ScrollIndex && i < ScrollIndex + 8)
                {
                    var bpm     = GuiTrack.BPMs[i];
                    var by      = y + height / 8 * (i - ScrollIndex);
                    var bpmRect = new RectangleF(x, by, width, height / 8);

                    if (bpmRect.Contains(mouseX, mouseY))
                    {
                        GL.Color3(0, 0.5f, 1f);
                    }
                    if (i == SelectedIndex)
                    {
                        GL.Color3(0, 1f, 0);
                    }

                    Glu.RenderOutline(x, by, width, height / 8);
                    GL.Color3(1f, 1f, 1f);
                    fr.Render($"BPM: {bpm.bpm}", (int)x + 5, (int)by + 10, (int)(height / 8) - 10);
                    fr.Render($"Offset: {bpm.Ms - GuiTrack.NoteOffset}", (int)(x + 5 + width / 2), (int)by + 10, (int)(height / 8) - 10);
                }
            }

            GL.LineWidth(1);
        }
        public override void Render(float delta, float mouseX, float mouseY)
        {
            var size = EditorWindow.Instance.ClientSize;

            if (bgImg)
            {
                GL.Color4(Color.FromArgb(255, 255, 255, 255));
                Glu.RenderTexturedQuad(0, 0, size.Width, size.Height, 0, 0, 1, 1, _textureId);
            }
            else
            {
                GL.Color4(Color.FromArgb(255, 30, 30, 30));
                Glu.RenderQuad(0, 0, size.Width, size.Height);
            }
            var fr = EditorWindow.Instance.FontRenderer;

            GL.Color4(Color.FromArgb(255, 255, 255, 255));
            fr.Render("Color 1:", (int)color1TextBox.ClientRectangle.X, (int)color1TextBox.ClientRectangle.Y - 26, 24);
            fr.Render("Color 2:", (int)color2TextBox.ClientRectangle.X, (int)color2TextBox.ClientRectangle.Y - 26, 24);

            fr.Render("Note Color 1:", (int)NoteColor1TextBox.ClientRectangle.X, (int)NoteColor1TextBox.ClientRectangle.Y - 26, 24);
            fr.Render("Note Color 2:", (int)NoteColor2TextBox.ClientRectangle.X, (int)NoteColor2TextBox.ClientRectangle.Y - 26, 24);

            fr.Render("Editor BG Opacity:", (int)EditorBGOpacityTextBox.ClientRectangle.X, (int)EditorBGOpacityTextBox.ClientRectangle.Y - 26, 24);
            fr.Render("Grid Opacity:", (int)GridOpacityTextBox.ClientRectangle.X, (int)GridOpacityTextBox.ClientRectangle.Y - 26, 24);
            fr.Render("Track Opacity:", (int)TrackOpacityTextBox.ClientRectangle.X, (int)TrackOpacityTextBox.ClientRectangle.Y - 26, 24);

            color1TextBox.Render(delta, mouseX, mouseY);
            color2TextBox.Render(delta, mouseX, mouseY);

            NoteColor1TextBox.Render(delta, mouseX, mouseY);
            NoteColor2TextBox.Render(delta, mouseX, mouseY);

            EditorBGOpacityTextBox.Render(delta, mouseX, mouseY);
            TrackOpacityTextBox.Render(delta, mouseX, mouseY);
            GridOpacityTextBox.Render(delta, mouseX, mouseY);

            ShowColor();
            ShowNoteColor();
            ShowOpacities();

            base.Render(delta, mouseX, mouseY);
        }
        public override void Render(float delta, float mouseX, float mouseY)
        {
            var size = EditorWindow.Instance.ClientSize;

            if (bgImg)
            {
                GL.Color4(Color.FromArgb(255, 255, 255, 255));
                Glu.RenderTexturedQuad(0, 0, size.Width, size.Height, 0, 0, 1, 1, _textureId);
            }
            else
            {
                GL.Color4(Color.FromArgb(255, 30, 30, 30));
                Glu.RenderQuad(0, 0, size.Width, size.Height);
            }
            _tb.Render(delta, mouseX, mouseY);

            foreach (var button in Buttons)
            {
                button.Render(delta, mouseX, mouseY);
            }

            _lbl.Render(delta, mouseX, mouseY);
        }
        public override void Render(float delta, float mouseX, float mouseY)
        {
            _toastTime = Math.Min(2, _toastTime + delta);

            var toastOffY = 1f;

            if (_toastTime <= 0.5)
            {
                toastOffY = (float)Math.Sin(Math.Min(0.5, _toastTime) / 0.5 * MathHelper.PiOver2);
            }
            else if (_toastTime >= 1.75)
            {
                toastOffY = (float)Math.Cos(Math.Min(0.25, _toastTime - 1.75) / 0.25 * MathHelper.PiOver2);
            }

            var size = EditorWindow.Instance.ClientSize;
            var fr   = EditorWindow.Instance.FontRenderer;
            var h    = fr.GetHeight(_toast.FontSize);

            _toast.ClientRectangle.Y = size.Height - toastOffY * h * 3.25f + h / 2;
            _toast.Color             = Color.FromArgb((int)(Math.Pow(toastOffY, 3) * 255), _toast.Color);

            GL.Color3(Color.FromArgb(0, 255, 200));
            var zoomW = fr.GetWidth("Zoom: ", 24);

            fr.Render("Zoom: ", (int)Bpm.ClientRectangle.X, (int)Bpm.ClientRectangle.Y - 60, 24);
            GL.Color3(Color.FromArgb(255, 0, 255));
            fr.Render($"{(int)(EditorWindow.Instance.Zoom * 100)}%", (int)Bpm.ClientRectangle.X + zoomW, (int)Bpm.ClientRectangle.Y - 60, 24);
            GL.Color3(Color.FromArgb(0, 255, 200));
            fr.Render("BPM:", (int)Bpm.ClientRectangle.X, (int)Bpm.ClientRectangle.Y - 24, 24);
            fr.Render("BPM Offset[ms]:", (int)Offset.ClientRectangle.X, (int)Offset.ClientRectangle.Y - 24, 24);
            fr.Render("Options:", (int)Autoplay.ClientRectangle.X, (int)Autoplay.ClientRectangle.Y - 26, 24);

            var divisor  = $"Beat Divisor: {BeatSnapDivisor.Value + 1}";
            var divisorW = fr.GetWidth(divisor, 24);

            fr.Render(divisor, (int)(BeatSnapDivisor.ClientRectangle.X + BeatSnapDivisor.ClientRectangle.Width / 2 - divisorW / 2f), (int)BeatSnapDivisor.ClientRectangle.Y - 20, 24);

            var tempo  = $"TEMPO - {Tempo.Value * 10 + 20}%";
            var tempoW = fr.GetWidth(tempo, 24);

            fr.Render(tempo, (int)(Tempo.ClientRectangle.X + Tempo.ClientRectangle.Width / 2 - tempoW / 2f), (int)Tempo.ClientRectangle.Bottom - 24, 24);

            var masterW = fr.GetWidth("Master", 18);
            var sfxW    = fr.GetWidth("SFX", 18);

            var masterP = $"{(int)(MasterVolume.Value * 100f) / MasterVolume.MaxValue}";
            var sfxP    = $"{(int)(SfxVolume.Value * 100f) / SfxVolume.MaxValue}";

            var masterPw = fr.GetWidth(masterP, 18);
            var sfxPw    = fr.GetWidth(sfxP, 18);

            fr.Render("Music", (int)(MasterVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - masterW / 2f), (int)MasterVolume.ClientRectangle.Y - 2, 18);
            fr.Render("SFX", (int)(SfxVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - sfxW / 2f), (int)SfxVolume.ClientRectangle.Y - 2, 18);

            fr.Render(masterP, (int)(MasterVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - masterPw / 2f), (int)MasterVolume.ClientRectangle.Bottom - 16, 18);
            fr.Render(sfxP, (int)(SfxVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - sfxPw / 2f), (int)SfxVolume.ClientRectangle.Bottom - 16, 18);

            var rect = Timeline.ClientRectangle;

            var timelinePos = new Vector2(rect.Height / 2f, rect.Height / 2f - 5);
            var time        = EditorWindow.Instance.MusicPlayer.TotalTime;
            var currentTime = EditorWindow.Instance.MusicPlayer.CurrentTime;

            var timeString        = $"{time.Minutes}:{time.Seconds:0#}";
            var currentTimeString = $"{currentTime.Minutes}:{currentTime.Seconds:0#}";
            var currentMsString   = $"{(long) currentTime.TotalMilliseconds:##,###}ms";

            if ((long)currentTime.TotalMilliseconds == 0)
            {
                currentMsString = "0ms";
            }

            var notesString = $"{EditorWindow.Instance.Notes.Count} Notes";
            var notesW      = fr.GetWidth(notesString, 24);

            var timeW        = fr.GetWidth(timeString, 20);
            var currentTimeW = fr.GetWidth(currentTimeString, 20);
            var currentMsW   = fr.GetWidth(currentMsString, 20);

            fr.Render(notesString, (int)(rect.X + rect.Width / 2 - notesW / 2f), (int)(rect.Y + timelinePos.Y + 12), 24);

            GL.Color3(0, 1, 0.5f);
            fr.Render(timeString, (int)(rect.X + timelinePos.X - timeW / 2f + rect.Width - rect.Height), (int)(rect.Y + timelinePos.Y + 12), 20);
            fr.Render(currentTimeString, (int)(rect.X + timelinePos.X - currentTimeW / 2f), (int)(rect.Y + timelinePos.Y + 12), 20);
            fr.Render(currentMsString, (int)(rect.X + rect.Height / 2 + (rect.Width - rect.Height) * Timeline.Progress - currentMsW / 2f), (int)rect.Y, 20);

            base.Render(delta, mouseX, mouseY);

            _toast.Render(delta, mouseX, mouseY);

            Grid.Render(delta, mouseX, mouseY);
            Track.Render(delta, mouseX, mouseY);
            Bpm.Render(delta, mouseX, mouseY);
            Offset.Render(delta, mouseX, mouseY);
        }
        public override void Render(float delta, float mouseX, float mouseY)
        {
            _toastTime = Math.Min(2, _toastTime + delta);

            var toastOffY = 1f;

            if (_toastTime <= 0.5)
            {
                toastOffY = (float)Math.Sin(Math.Min(0.5, _toastTime) / 0.5 * MathHelper.PiOver2);
            }
            else if (_toastTime >= 1.75)
            {
                toastOffY = (float)Math.Cos(Math.Min(0.25, _toastTime - 1.75) / 0.25 * MathHelper.PiOver2);
            }

            var size = EditorWindow.Instance.ClientSize;
            var fr   = EditorWindow.Instance.FontRenderer;
            var h    = fr.GetHeight(_toast.FontSize);

            int bgdim = EditorSettings.EditorBGOpacity;

            if (bgImg)
            {
                GL.Color4(Color.FromArgb(bgdim, 255, 255, 255));
                Glu.RenderTexturedQuad(0, 0, size.Width, size.Height, 0, 0, 1, 1, _textureId);
            }

            _toast.ClientRectangle.Y = size.Height - toastOffY * h * 3.25f + h / 2;
            _toast.Color             = Color.FromArgb((int)(Math.Pow(toastOffY, 3) * 255), _toast.Color);

            int[] Color1 = EditorWindow.Instance.Color1;
            int[] Color2 = EditorWindow.Instance.Color2;

            GL.Color3(Color.FromArgb(Color1[0], Color1[1], Color1[2]));
            var zoomW = fr.GetWidth("Zoom: ", 24);

            fr.Render("Zoom: ", 10, (int)Grid.ClientRectangle.Y + 28 - 60, 24);
            GL.Color3(Color.FromArgb(Color2[0], Color2[1], Color2[2]));
            fr.Render($"{Math.Round(EditorWindow.Instance.Zoom, 1) * 100}%", 10 + zoomW, (int)Grid.ClientRectangle.Y + 28 - 60, 24);
            GL.Color3(Color.FromArgb(Color1[0], Color1[1], Color1[2]));
            fr.Render("Offset[ms]:", (int)Offset.ClientRectangle.X, (int)Offset.ClientRectangle.Y - 24, 24);
            fr.Render("SFX Offset[ms]:", (int)SfxOffset.ClientRectangle.X - 10, (int)SfxOffset.ClientRectangle.Y - 34, 24);
            fr.Render("Jump to MS:", (int)JumpMSBox.ClientRectangle.X, (int)JumpMSBox.ClientRectangle.Y - 34, 24);
            fr.Render("Rotate by Degrees:", (int)RotateBox.ClientRectangle.X, (int)RotateBox.ClientRectangle.Y - 34, 24);
            fr.Render("Options:", (int)Autoplay.ClientRectangle.X, (int)Autoplay.ClientRectangle.Y - 26, 24);
            var divisor  = $"Beat Divisor: {BeatSnapDivisor.Value + 1}";
            var divisorW = fr.GetWidth(divisor, 24);
            var align    = $"Snapping: 3/{(float)(NoteAlign.Value + 1)}";
            var alignW   = fr.GetWidth(align, 24);

            fr.Render(divisor, (int)(BeatSnapDivisor.ClientRectangle.X + BeatSnapDivisor.ClientRectangle.Width / 2 - divisorW / 2f), (int)BeatSnapDivisor.ClientRectangle.Y - 20, 24);
            fr.Render(align, (int)(NoteAlign.ClientRectangle.X + NoteAlign.ClientRectangle.Width / 2 - alignW / 2f), (int)NoteAlign.ClientRectangle.Y - 20, 24);

            var tempoval = Tempo.Value;

            if (tempoval > 15)
            {
                tempoval = (tempoval - 16) * 2 + 16;
            }
            var tempo  = $"TEMPO - {tempoval * 5 + 20}%";
            var tempoW = fr.GetWidth(tempo, 24);

            fr.Render(tempo, (int)(Tempo.ClientRectangle.X + Tempo.ClientRectangle.Width / 2 - tempoW / 2f), (int)Tempo.ClientRectangle.Bottom - 24, 24);

            var masterW = fr.GetWidth("Master", 18);
            var sfxW    = fr.GetWidth("SFX", 18);

            var masterP = $"{(int)(MasterVolume.Value * 100f) / MasterVolume.MaxValue}";
            var sfxP    = $"{(int)(SfxVolume.Value * 100f) / SfxVolume.MaxValue}";

            var masterPw = fr.GetWidth(masterP, 18);
            var sfxPw    = fr.GetWidth(sfxP, 18);

            fr.Render("Music", (int)(MasterVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - masterW / 2f), (int)MasterVolume.ClientRectangle.Y - 2, 18);
            fr.Render("SFX", (int)(SfxVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - sfxW / 2f), (int)SfxVolume.ClientRectangle.Y - 2, 18);

            fr.Render(masterP, (int)(MasterVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - masterPw / 2f), (int)MasterVolume.ClientRectangle.Bottom - 16, 18);
            fr.Render(sfxP, (int)(SfxVolume.ClientRectangle.X + SfxVolume.ClientRectangle.Width / 2 - sfxPw / 2f), (int)SfxVolume.ClientRectangle.Bottom - 16, 18);

            var rect = Timeline.ClientRectangle;

            var timelinePos = new Vector2(rect.Height / 2f, rect.Height / 2f - 5);
            var time        = EditorWindow.Instance.MusicPlayer.TotalTime;
            var currentTime = EditorWindow.Instance.MusicPlayer.CurrentTime;

            var timeString        = $"{time.Minutes}:{time.Seconds:0#}";
            var currentTimeString = $"{currentTime.Minutes}:{currentTime.Seconds:0#}";
            var currentMsString   = $"{(long) currentTime.TotalMilliseconds:##,###}ms";

            if ((long)currentTime.TotalMilliseconds == 0)
            {
                currentMsString = "0ms";
            }

            var notesString = $"{EditorWindow.Instance.Notes.Count} Notes";
            var notesW      = fr.GetWidth(notesString, 24);

            var timeW        = fr.GetWidth(timeString, 20);
            var currentTimeW = fr.GetWidth(currentTimeString, 20);
            var currentMsW   = fr.GetWidth(currentMsString, 20);

            fr.Render(notesString, (int)(rect.X + rect.Width / 2 - notesW / 2f), (int)(rect.Y + timelinePos.Y + 12), 24);

            GL.Color3(Color.FromArgb(Color1[0], Color1[1], Color1[2]));
            fr.Render(timeString, (int)(rect.X + timelinePos.X - timeW / 2f + rect.Width - rect.Height), (int)(rect.Y + timelinePos.Y + 12), 20);
            fr.Render(currentTimeString, (int)(rect.X + timelinePos.X - currentTimeW / 2f), (int)(rect.Y + timelinePos.Y + 12), 20);
            fr.Render(currentMsString, (int)(rect.X + rect.Height / 2 + (rect.Width - rect.Height) * Timeline.Progress - currentMsW / 2f), (int)rect.Y, 20);

            base.Render(delta, mouseX, mouseY);

            _toast.Render(delta, mouseX, mouseY);
            Grid.Render(delta, mouseX, mouseY);
            Track.Render(delta, mouseX, mouseY);
            NoteAlign.Render(delta, mouseX, mouseY);
            Offset.Render(delta, mouseX, mouseY);
            SfxOffset.Render(delta, mouseX, mouseY);
            JumpMSBox.Render(delta, mouseX, mouseY);
            RotateBox.Render(delta, mouseX, mouseY);
        }