예제 #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)
        {
            _timer += delta;

            if (_timer >= 0.08)
            {
                _timer = 0;

                for (int i = 0; i < 3; i++)
                {
                    var s = 15 + (float)_r.NextDouble() * 20;
                    var x = (float)_r.NextDouble() * ClientRectangle.Width;
                    var y = ClientRectangle.Height + s;

                    var mx = -0.5f + (float)_r.NextDouble();
                    var my = -(2 + (float)_r.NextDouble() * 2);

                    _particles.Add(new Particle(x, y, mx, my, s));
                }
            }

            var rect = ClientRectangle;

            GL.Color3(1, 1, 1f);
            Glu.RenderTexturedQuad(rect.X + rect.Width / 2 - 256, 0, 512, 512, 0, 0, 1, 1, _textureId);

            for (var index = _particles.Count - 1; index >= 0; index--)
            {
                var particle = _particles[index];

                particle.Render(delta);

                if (particle.IsDead)
                {
                    _particles.Remove(particle);
                }
            }

            base.Render(delta, mouseX, mouseY);
            _lbl.Render(delta, mouseX, mouseY);
            _lbl2.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);
        }
예제 #5
0
        public override void Render(float delta, float mouseX, float mouseY)
        {
            var size = EditorWindow.Instance.ClientSize;

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

                if (size.Width == 1920 && size.Height > 1000 && size.Height <= 1080)
                {
                    GL.Color4(Color.FromArgb(120, 57, 56, 47));
                    Glu.RenderQuad(ClientRectangle.Left + 35, ClientRectangle.Top + 180, 950, 790);
                    GL.Color4(Color.FromArgb(100, 36, 35, 33));
                    Glu.RenderQuad(ClientRectangle.Left + 55, ClientRectangle.Top + 230, 900, 715);
                }
                //else if (size.Width >= 1280 && size.Width <= 1700  && size.Height > 690 && size.Height <= 768 || size.Width == 1280 && size.Height > 640 && size.Height <= 720)
                else if (size.Width >= 10 && size.Width <= 1700 && size.Height > 600 && size.Height <= 1300)
                {
                    GL.Color4(Color.FromArgb(120, 57, 56, 47));
                    Glu.RenderQuad(ClientRectangle.Left + 35, ClientRectangle.Top + 180, 650, 525);
                    GL.Color4(Color.FromArgb(100, 36, 35, 33));
                    Glu.RenderQuad(ClientRectangle.Left + 55, ClientRectangle.Top + 230, 600, 450);
                }
                else
                {
                    GL.Color4(Color.FromArgb(120, 57, 56, 47));
                    Glu.RenderQuad(ClientRectangle.Left + 35, ClientRectangle.Top + 180, 950, 790);
                    GL.Color4(Color.FromArgb(100, 36, 35, 33));
                    Glu.RenderQuad(ClientRectangle.Left + 55, ClientRectangle.Top + 230, 900, 715);
                }

                CHANGELOGlabel.Render(delta, mouseX, mouseY);
                //CHANGELOGlabelOutline.Render(delta, mouseX, mouseY);
                ssLabel.Render(delta, mouseX, mouseY);
                //ssLabelOutline.Render(delta, mouseX, mouseY);
                qeLabel.Render(delta, mouseX, mouseY);

                Changelog.Render(delta, mouseX, mouseY);

                ScrollBar.Render(delta, mouseX, mouseY);
            }
            else
            {
                // background
                GL.Color4(Color.FromArgb(255, 30, 30, 30));
                Glu.RenderQuad(0, 0, size.Width, size.Height);


                if (size.Width == 1920 && size.Height > 1000 && size.Height <= 1080)
                {
                    GL.Color4(Color.FromArgb(40, 0, 0, 0));
                    Glu.RenderQuad(ClientRectangle.Left + 35, ClientRectangle.Top + 180, 950, 790);
                    GL.Color4(Color.FromArgb(50, 0, 0, 0));
                    Glu.RenderQuad(ClientRectangle.Left + 55, ClientRectangle.Top + 230, 900, 715);
                }
                else if (size.Width >= 10 && size.Width <= 1700 && size.Height >= 100 && size.Height <= 1300)
                {
                    GL.Color4(Color.FromArgb(40, 0, 0, 0));
                    Glu.RenderQuad(ClientRectangle.Left + 35, ClientRectangle.Top + 180, 650, 525);
                    GL.Color4(Color.FromArgb(50, 0, 0, 0));
                    Glu.RenderQuad(ClientRectangle.Left + 55, ClientRectangle.Top + 230, 600, 450);
                }
                else
                {
                    GL.Color4(Color.FromArgb(40, 0, 0, 0));
                    Glu.RenderQuad(ClientRectangle.Left + 35, ClientRectangle.Top + 180, 950, 790);
                    GL.Color4(Color.FromArgb(50, 0, 0, 0));
                    Glu.RenderQuad(ClientRectangle.Left + 55, ClientRectangle.Top + 230, 900, 715);
                }


                CHANGELOGlabel.Render(delta, mouseX, mouseY);
                ssLabel.Render(delta, mouseX, mouseY);
                qeLabel.Render(delta, mouseX, mouseY);

                Changelog.Render(delta, mouseX, mouseY);
            }

            base.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);
        }