Browse Source

Rendering changes

main
meutraa 6 months ago
parent
commit
b2d5d61863
Signed by: meutraa GPG Key ID: 82664A5F8DAC3400
  1. 1
      internal/config/main.go
  2. 6
      internal/parser/default.go
  3. 5
      internal/theme/default.go
  4. 5
      main.go
  5. 18
      program.go

1
internal/config/main.go

@ -24,6 +24,7 @@ var (
keys4 = kingpin.Flag("keys-single", "Keys for 4k").Default("73,69,83,67").Short('k').String()
keys6 = kingpin.Flag("keys-solo", "Keys for 6k").Default("23,18,24,20,31,46").String()
keys8 = kingpin.Flag("keys-double", "Keys for 8k").Default("23,18,24,49,35,20,31,46").String()
FontSize = kingpin.Flag("font-size", "Font size").Default("24").Int32()
BarOffsetFromBottom = kingpin.Flag("bar-row", "Pixels from bottom to render hit bar").Default("220").Int32()
BarSym = kingpin.Flag("bar-decoration", "Decoration at the hitfield").Default("\033[2m\033[1D[ ]").String()

6
internal/parser/default.go

@ -150,6 +150,12 @@ func (p *DefaultParser) Parse(file string) ([]*game.Chart, error) {
Time: time.Duration(seconds * 1000 * 1000 * 1000),
})
}
if denom == 2 || denom == 4 {
measureTimes = append(measureTimes, &game.Measure{
Denom: 8,
Time: time.Duration(seconds * 1000 * 1000 * 1000),
})
}
_, secondsPerNote := p.getSecondsPerNote(bpms, currentBeat, beatsPerNote)
createNote := func(index uint8, c byte) *game.Note {

5
internal/theme/default.go

@ -11,8 +11,9 @@ type DefaultTheme struct {
var (
MeasureColors = map[int]rl.Color{
1: rl.White, // 1
4: rl.DarkGray, // 1/4
1: rl.NewColor(128, 128, 128, 255), // 1
4: rl.NewColor(48, 48, 48, 255), // 1/4
8: rl.NewColor(24, 24, 24, 255), // 1/8
}
noteColors = map[int]color.RGBA{
1: {R: 236, G: 30, B: 0}, // 1/4 red

5
main.go

@ -54,6 +54,11 @@ func run() error {
return err
}
im := rl.GenImageColor(20, 20, rl.White)
tex := rl.LoadTextureFromImage(im)
rl.SetTextureFilter(tex, rl.FilterAnisotropic16x)
rl.SetShapesTexture(tex, rl.Rectangle{Width: 20, Height: 20})
music := rl.LoadMusicStream(program.audioFile)
music.Looping = false
defer rl.UnloadMusicStream(music)

18
program.go

@ -81,7 +81,7 @@ func (g *Program) Init() error {
g.Parser = &parser.DefaultParser{}
g.Scorer = &score.DefaultScorer{}
g.Theme = &theme.DefaultTheme{}
g.Font = rl.LoadFont("assets/fonts/Inconsolata-Regular.ttf")
g.Font = rl.LoadFontEx("assets/fonts/Inconsolata-Regular.ttf", *config.FontSize, nil, 0)
if err := filepath.Walk(*config.Directory, func(p string, info os.FileInfo, err error) error {
switch path.Ext(info.Name()) {
@ -149,7 +149,7 @@ func (p *Program) Update(duration time.Duration) {
render: func(remaining int) {
g := rl.Gray
g.A = uint8(float32(255) * (float32(remaining) / 24))
rl.DrawCircle(col, p.hitRow, *config.NoteRadius-4, g)
rl.DrawCircleGradient(col, p.hitRow, *config.NoteRadius, g, rl.Black)
},
})
continue
@ -176,11 +176,11 @@ func (p *Program) Update(duration time.Duration) {
},
render: func(remaining int) {
g := judgement.Color
gr := rl.Gray
gr := g
gr.A = uint8(float32(255) * (float32(remaining) / 24))
rl.DrawCircle(col, p.hitRow, *config.NoteRadius, g)
rl.DrawCircle(col, p.hitRow, *config.NoteRadius-2, rl.Black)
rl.DrawCircle(col, p.hitRow, *config.NoteRadius-4, gr)
rl.DrawCircle(col, p.hitRow, *config.NoteRadius+4, g)
rl.DrawCircle(col, p.hitRow, *config.NoteRadius, rl.Black)
rl.DrawCircleGradient(col, p.hitRow, *config.NoteRadius, g, rl.Black)
},
})
@ -436,7 +436,7 @@ func (p *Program) RenderStatic() {
rl.DrawCircleLines(
getColumn(p.chart.Difficulty.NKeys, p.middle.X, i),
p.hitRow,
*config.NoteRadius+4,
*config.NoteRadius+4.05,
g,
)
}
@ -446,8 +446,8 @@ func (p *Program) RenderStatic() {
text := func(row float32, color rl.Color, template string, args ...interface{}) {
rl.DrawTextEx(p.Font,
fmt.Sprintf(template, args...),
rl.Vector2{X: float32(p.sideCol), Y: row * 24},
24, 1, color,
rl.Vector2{X: float32(p.sideCol), Y: row * float32(*config.FontSize)},
float32(*config.FontSize), 1, color,
)
}

Loading…
Cancel
Save