Documentation
¶
Index ¶
- Constants
- Variables
- func ExposureTime(speed float64) float64
- func ExtraScoreRate(nws, ews float64) float64
- func IsColorHit(actions [2]int, color int) bool
- func IsOtherColorHit(actions [2]int, color int) bool
- func NewShakeSprites(note draws.Image) (sprites [2]draws.Sprite)
- func ScaledBPM(bpm float64) float64
- func VerdictDot(dot *Dot, actions [2]int, td int64) (marked int)
- func VerdictNote(n *Note, actions [2]int, td int64) (j mode.Judgment, big bool)
- func VerdictShake(shake *Note, actions [2]int, waitingColor int) (nextColor int)
- type Bar
- type BarDrawer
- type Chart
- type DancerDrawer
- type Dot
- type Floater
- type JudgmentDrawer
- type KeyDrawer
- type Note
- type NoteDrawer
- type RollDrawer
- type ScenePlay
- func (s ScenePlay) DebugPrint(screen draws.Image)
- func (s ScenePlay) Draw(screen draws.Image)
- func (s ScenePlay) Finish() any
- func (s *ScenePlay) MarkDot(dot *Dot, marked int)
- func (s *ScenePlay) MarkNote(n *Note, j mode.Judgment, big bool)
- func (s *ScenePlay) MarkShake(shake *Note, flush bool)
- func (s *ScenePlay) PlayPause()
- func (s *ScenePlay) SetMaxScores()
- func (s *ScenePlay) SetSpeed()
- func (s ScenePlay) Speed() float64
- func (s *ScenePlay) Update() any
- func (s *ScenePlay) UpdateDynamic()
- func (s *ScenePlay) UpdateKeyActions()
- type Settings
- type ShakeDrawer
- type Skin
- type StageDrawer
Constants ¶
const ( MaxScaledBPM = 280 // 256 MinScaledBPM = 60 // 128 )
const ( DotReady = iota DotHit DotMiss )
const ( Normal = iota Roll Shake )
Drum note has 3 components: Color, Size, Type(Note, Roll, Shake). Piano note has 2 components: Key, Type(Note, Head, Tail).
const ( ColorNone = iota - 1 Red // aka Don. Blue // aka Kat. Yellow // For Roll. Purple // For Shake. )
const ( SizeNone = iota - 1 Regular Big )
const ( Cools = iota // Stands for Cool counts. Goods Misses CoolPartials GoodPartials TickHits TickDrops )
const ( TPS = mode.TPS ScreenSizeX = mode.ScreenSizeX ScreenSizeY = mode.ScreenSizeY )
const ( Idle = iota High )
const ( DancerIdle = iota DancerYes DancerNo DancerHigh )
const MaxBigHitDuration = 25
When hit big notes only with one press, the note gives half the score only. For example, when hit a Big note by one press with Good, it will gives 0.25 * 0.5 = 0.125. No Flow decrease for hitting Big note by one press. When one side of judgment is Cool, Good on the other hand, overall judgment of Big note goes Good. In other word, to get Cool at Big note, you have to hit it Cool with both sides. Todo: judge for Big note when judgment goes different depending on selecting 2 key actions
const Mode = 1 // ModeDrum
Variables ¶
var ( // TickDensity float64 = 4 DotDensity float64 = 4 // Infers how many dots per beat in Roll note. ShakeDensity float64 = 3 // Infers how many shakes per beat in Shake note. )
var ( DotColorReady = color.NRGBA{255, 255, 255, 255} // White. DotColorHit = color.NRGBA{255, 255, 0, 0} // Transparent. DotColorMiss = color.NRGBA{255, 0, 0, 255} // Red. )
var ( Cool = mode.Judgment{Flow: 0.01, Acc: 1, Window: 25} Good = mode.Judgment{Flow: 0.01, Acc: 0.25, Window: 60} Miss = mode.Judgment{Flow: -1, Acc: 0, Window: 100} DotHitWindow int64 = 35 // 25 )
Todo: let users use custom windows Todo: need to find best value for DotHitWindow
var ( UserSettings = NewSettings() S = &UserSettings )
var ( ColorRed = color.NRGBA{235, 69, 44, 255} ColorBlue = color.NRGBA{68, 141, 171, 255} ColorYellow = color.NRGBA{230, 170, 0, 255} // 252, 83, 6 ColorPurple = color.NRGBA{150, 100, 200, 255} )
var ( DefaultSkin = &Skin{} UserSkin = &Skin{} )
var DefaultSampleNames = [2][2]string{{"red", "red-big"}, {"blue", "blue-big"}}
var JudgmentCountKinds = []string{
"Cools", "Goods", "Misses",
"CoolPartials", "GoodPartials",
"TickHits", "TickDrops",
}
Functions ¶
func ExposureTime ¶
func ExtraScoreRate ¶
If a chart has not enough Shake and Roll, max score of Extra will shrink. Margin will be distributed to Flow and Acc score by 7:3.
func IsColorHit ¶
func IsOtherColorHit ¶
func NewShakeSprites ¶ added in v0.3.1
Types ¶
type Chart ¶
type Chart struct { mode.ChartHeader MD5 [16]byte Dynamics []*mode.Dynamic Notes []*Note Rolls []*Note Shakes []*Note Dots []*Dot // Ticks in a Roll note. Bars []*Bar Level float64 ScoreFactors [3]float64 }
func LoadChart ¶ added in v0.6.0
LoadChart takes file path as input for starting with parsing. Chart data should not rely on the ChartInfo; users may have modified it.
func (Chart) Difficulties ¶
Mods may change the duration of chart. Todo: implement actual calculating chart difficulties
func (Chart) NoteCounts ¶
type DancerDrawer ¶
type DancerDrawer struct { draws.Timer Time int64 Dancer [4]draws.Animation Mode int ModeEndTime int64 // It extends when notes are continuously missed. }
func (DancerDrawer) Draw ¶
func (d DancerDrawer) Draw(dst draws.Image)
type JudgmentDrawer ¶
type JudgmentDrawer struct { draws.Timer Animations [3][2]draws.Animation // contains filtered or unexported fields }
func (JudgmentDrawer) Draw ¶
func (d JudgmentDrawer) Draw(dst draws.Image)
type KeyDrawer ¶
type Note ¶
type NoteDrawer ¶ added in v0.2.3
type NoteDrawer struct { draws.Timer Time int64 Notes []*Note Rolls []*Note Shakes []*Note Note [4][2]draws.Sprite Overlay [2]draws.Animation }
func (NoteDrawer) Draw ¶ added in v0.2.3
func (d NoteDrawer) Draw(dst draws.Image)
func (*NoteDrawer) Update ¶ added in v0.2.3
func (d *NoteDrawer) Update(time int64, bpm float64)
type RollDrawer ¶
type RollDrawer struct { Time int64 Rolls []*Note Dots []*Dot Head [2]draws.Sprite Tail [2]draws.Sprite Body [2]draws.Sprite DotSprite draws.Sprite }
func (RollDrawer) Draw ¶
func (d RollDrawer) Draw(dst draws.Image)
func (*RollDrawer) Update ¶
func (d *RollDrawer) Update(time int64)
type ScenePlay ¶
type ScenePlay struct { Chart *Chart mode.Timer audios.MusicPlayer input.KeyLogger KeyActions [2]int *mode.Dynamic StagedNote *Note StagedDot *Dot StagedShake *Note LastHitTimes [4]int64 // For judging big note. StagedJudgment mode.Judgment // For judging big note. StagedJudgmentTime int64 ShakeWaitingColor int mode.Scorer DrumSound [2][2][]byte Background mode.BackgroundDrawer Stage StageDrawer Bar BarDrawer Judgment JudgmentDrawer Shake ShakeDrawer Roll RollDrawer Note NoteDrawer Key KeyDrawer Dancer DancerDrawer Score mode.ScoreDrawer Combo mode.ComboDrawer Meter mode.MeterDrawer // contains filtered or unexported fields }
Todo: support custom hitsound?
func NewScenePlay ¶
func NewScenePlay(fsys fs.FS, cname string, mods interface{}, rf *osr.Format) (s *ScenePlay, err error)
Todo: actual auto replay generator for gimmick charts Todo: support mods: show Piano's ScenePlay during Drum's ScenePlay
func (ScenePlay) DebugPrint ¶
func (*ScenePlay) SetMaxScores ¶
func (s *ScenePlay) SetMaxScores()
func (*ScenePlay) SetSpeed ¶
func (s *ScenePlay) SetSpeed()
Farther note has larger position. Tail's Position is always larger than Head's. Need to re-calculate positions when Speed has changed.
func (*ScenePlay) UpdateDynamic ¶ added in v0.6.0
func (s *ScenePlay) UpdateDynamic()
func (*ScenePlay) UpdateKeyActions ¶
func (s *ScenePlay) UpdateKeyActions()
type Settings ¶ added in v0.3.1
type Settings struct { MusicVolume float64 // Logic settings KeySettings map[int][]string SpeedScale float64 HitPosition float64 Reverse bool // Skin-independent settings FieldOpacity float64 FieldPosition float64 FieldHeight float64 DancerPositionX float64 DancerPositionY float64 // Skin-dependent settings FieldInnerHeight float64 JudgmentScale float64 DotScale float64 ShakeScale float64 DancerScale float64 ComboScale float64 ComboDigitGap float64 // contains filtered or unexported fields }
func NewSettings ¶ added in v0.3.1
func NewSettings() Settings
type ShakeDrawer ¶
func (ShakeDrawer) Draw ¶
func (d ShakeDrawer) Draw(dst draws.Image)
func (*ShakeDrawer) Update ¶
func (d *ShakeDrawer) Update(time int64, staged *Note)
type Skin ¶
type Skin struct { Field [2]draws.Sprite Hint [2]draws.Sprite Bar draws.Sprite // [2] at last element stands for a size. DrumSound [2][2][]byte // color, size Judgment [3][2]draws.Animation Note [4][2]draws.Sprite Head [2]draws.Sprite Tail [2]draws.Sprite Body [2]draws.Sprite Dot draws.Sprite Shake [2]draws.Sprite Overlay [2]draws.Animation Key [4]draws.Sprite KeyField draws.Sprite Dancer [4]draws.Animation Combo [10]draws.Sprite // contains filtered or unexported fields }
Todo: resolve ambiguity between image and derived sprites Order of fields of Skin is roughly consistent with drawing order.