예제 #1
0
파일: Form1.cs 프로젝트: Astronat/TREP
        //Form has loaded
        private void Form1_Load(object sender, EventArgs e)
        {
            //temporary hard coded meemee
            string   fn = @"J:\Taiko\wii4 sheets\sheet\newsht\solo\marumo_m.bin";
            FileInfo fi = new FileInfo(fn);

            //read the sheet
            sheet = NewShtReader.ReadSheet(fn);

            //Get the total note count for ~statistics~
            int nc = 0;

            foreach (Bar b in sheet.Bars)
            {
                nc += b.NoteCount;
            }

            //Change the window title to show the file name, bar count and note count
            Text = fi.Name + " " + sheet.BarCount + " bars | " + nc + " notes";

            BarRect = new SKRect(0, 0, Size.Width, 30);

            //set up the Skia graphics control and its paint event
            skC.Size          = Size;
            skC.PaintSurface += Gl_PaintSurface;


            //Add the Skia control to the form
            Controls.Add(skC);
        }
예제 #2
0
파일: Form1.cs 프로젝트: Astronat/TREP
        //Draw the ugly circles that make up the viewer
        private void Gl_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
        {
            skP = new SKPaint();
            //Clear the canvas, of course
            e.Surface.Canvas.Clear(SKColor.Parse("AAAAAA"));
            e.Surface.Canvas.DrawLine(
                0,
                30,
                Size.Width,
                30, new SKPaint());

            skP.Color = SKColor.Parse("333333");

            e.Surface.Canvas.DrawRect(BarRect, skP);

            //TODO::OPTIMIZE AND REMOVE ALL COPY PASTE S***E IN HERE
            //TODO::ADD ZOOM
            //TODO::FIND THE REST OF THE NOTE TYPES
            //TODO::TRY SONGS LIKE THAT ONE WITH THE BEEPS THAT CHANGES PATH
            //TODO::WORK OUT BPM MATH OW MY HEAD TOO TIRED RN
            //TODO::FINISH COMMENTS

            //For each of the bars
            for (int i = 0; i < sheet.BarCount; i++)
            {
                skP.StrokeWidth = 1;

                skP.Color = SKColor.Parse("AAAAAA");
                e.Surface.Canvas.DrawLine(
                    cXPos + ((sheet.Bars[i].Timecode / 1000) * scale),
                    0,
                    cXPos + ((sheet.Bars[i].Timecode / 1000) * scale),
                    30, skP);

                skP.Color = SKColor.Parse("222222");
                e.Surface.Canvas.DrawLine(
                    cXPos + ((sheet.Bars[i].Timecode / 1000) * scale),
                    30,
                    cXPos + ((sheet.Bars[i].Timecode / 1000) * scale),
                    Size.Height, skP);

                e.Surface.Canvas.DrawText(
                    "Bar " + i.ToString(),
                    cXPos + ((sheet.Bars[i].Timecode / 1000) * scale) + 3,
                    87, skP);

                e.Surface.Canvas.DrawText(
                    sheet.Bars[i].Speed.ToString("0.00"),
                    cXPos + ((sheet.Bars[i].Timecode / 1000) * scale) + 3,
                    100, skP);

                foreach (Note n in sheet.Bars[i].Notes)
                {
                    string type = NewShtReader.GetNoteType(n.NoteType);

                    skP.StrokeWidth = (type.StartsWith("Large") ? 16 : 10);

                    if (type == "Don" || type == "LargeDon")
                    {
                        skP.Color = SKColor.Parse("DD4444");
                    }
                    else if (type == "Katsu" || type == "LargeKatsu")
                    {
                        skP.Color = SKColor.Parse("4444DD");
                    }
                    else if (type == "Roll" || type == "LargeRoll")
                    {
                        skP.Color = SKColor.Parse("DDDD44");

                        e.Surface.Canvas.DrawText(
                            NewShtReader.GetNoteType(n.NoteType),
                            cXPos + ((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) * scale,
                            50, skP);

                        e.Surface.Canvas.DrawText(
                            n.NoteLength.ToString() + "ms",
                            cXPos + ((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) * scale,
                            65, skP);

                        e.Surface.Canvas.DrawLine(
                            cXPos + ((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) * scale,
                            16f,
                            cXPos + (((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) + (n.NoteLength / 1000)) * scale,
                            16f, skP);

                        e.Surface.Canvas.DrawCircle(
                            cXPos + (((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) + (n.NoteLength / 1000)) * scale,
                            16,
                            (type.StartsWith("Large") ? 8 : 5), skP);
                    }
                    else
                    {
                        skP.Color = SKColor.Parse("FFCC00");

                        e.Surface.Canvas.DrawText(
                            NewShtReader.GetNoteType(n.NoteType),
                            cXPos + ((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) * scale,
                            50, skP);

                        e.Surface.Canvas.DrawText(
                            n.RequiredHits.ToString() + " hits in " + n.NoteLength.ToString() + "ms",
                            cXPos + ((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) * scale,
                            65, skP);

                        e.Surface.Canvas.DrawLine(
                            cXPos + ((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) * scale,
                            16,
                            cXPos + (((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) + (n.NoteLength / 1000)) * scale, 16, skP);

                        e.Surface.Canvas.DrawCircle(
                            cXPos + (((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) + (n.NoteLength / 1000)) * scale,
                            16,
                            (type.StartsWith("Large") ? 8 : 5), skP);
                    }

                    e.Surface.Canvas.DrawCircle(
                        cXPos + ((sheet.Bars[i].Timecode + n.OffsetMs) / 1000) * scale,
                        16,
                        (type.StartsWith("Large") ? 8 : 5), skP);
                }
            }
        }