Documentation ¶
Index ¶
- Constants
- Variables
- func ExposureTime(speedScale 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 LoadSkin()
- func NewChartInfo(cpath string) (info gosu.ChartInfo, err error)
- func NewReplayListener(f *osr.Format, timer *gosu.Timer) func() []bool
- func NewScenePlay(cpath string, rf *osr.Format) (scene gosu.Scene, err error)
- func ScaledBPM(bpm float64) float64
- func SwitchDirection()
- func VerdictDot(dot *Dot, actions [2]int, td int64) (marked int)
- func VerdictNote(n *Note, actions [2]int, td int64) (j gosu.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 NoteDarwer
- type RollDrawer
- type ScenePlay
- func (s ScenePlay) CurrentSpeed() float64
- func (s ScenePlay) DebugPrint(screen *ebiten.Image)
- func (s ScenePlay) Draw(screen *ebiten.Image)
- func (s *ScenePlay) MarkDot(dot *Dot, marked int)
- func (s *ScenePlay) MarkNote(n *Note, j gosu.Judgment, big bool)
- func (s *ScenePlay) MarkShake(shake *Note, flush bool)
- func (s *ScenePlay) SetMaxScores()
- func (s *ScenePlay) SetSpeed()
- func (s ScenePlay) Speed()
- func (s *ScenePlay) Update() any
- func (s *ScenePlay) UpdateKeyActions()
- func (s *ScenePlay) UpdateTransPoint()
- 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 ( LeftBlue = iota LeftRed RightRed RightBlue )
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 PositionMargin = 100
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 = gosu.Judgment{Flow: 0.01, Acc: 1, Window: 25} Good = gosu.Judgment{Flow: 0.01, Acc: 0.25, Window: 60} Miss = gosu.Judgment{Flow: -1, Acc: 0, Window: 100} DotHitWindow int64 = 25 )
Todo: let users use custom windows Todo: need to find best value for DotHitWindow
var ( FieldDarkness float64 = 0.7 FieldPosition float64 = screenSizeY * 0.4115 FieldHeight float64 = screenSizeY * 0.26 HitPosition float64 = screenSizeX * 0.1875 DancerPositionX float64 = screenSizeX * 0.1 DancerPositionY float64 = screenSizeY * 0.175 )
Default values are derived from osu!taiko. Todo: generalize Dancer for all modes?
var ( FieldInnerHeight float64 = FieldHeight * 0.95 JudgmentScale float64 = 0.75 // 1.25 DotScale float64 = 0.5 ShakeScale float64 = 1 DancerScale float64 = 0.75 // 0.6 ComboScale float64 = 0.75 // 1.25 ComboDigitGap float64 = screenSizeX * -0.001 )
Skin-dependent settings.
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 DefaultSampleNames = [2][2]string{
{"red-regular", "red-big"},
{"blue-regular", "blue-big"},
}
var JudgmentCountKinds = []string{
"Cools", "Goods", "Misses",
"CoolPartials", "GoodPartials",
"TickHits", "TickDrops",
}
var KeySettings = map[int][]input.Key{ 4: {input.KeyD, input.KeyF, input.KeyJ, input.KeyK}, }
var KeySettings = [4]input.Key{input.KeyD, input.KeyF, input.KeyJ, input.KeyK}
var ModeDrum = gosu.ModeProp{ Name: "Drum", Mode: gosu.ModeDrum, ChartInfos: make([]gosu.ChartInfo, 0), Results: make(map[[16]byte]gosu.Result), LastUpdateTime: time.Time{}, LoadSkin: LoadSkin, SpeedScale: &SpeedScale, NewChartInfo: NewChartInfo, NewScenePlay: NewScenePlay, ExposureTime: ExposureTime, KeySettings: KeySettings, }
var SpeedKeyHandler = gosu.NewSpeedKeyHandler(&SpeedScale)
var SpeedScale float64 = 1.0
Functions ¶
func ExposureTime ¶
1 pixel is 1 millisecond. Todo: Separate NoteHeight / 2 at piano mode
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 LoadSkin ¶
func LoadSkin()
Todo: embed default skins to code for preventing panic when files are missing
func NewReplayListener ¶
ReplayListener supposes closure function is called every 1 ms. ReplayListener supposes the first the time of replay data is 0ms and no any inputs. Todo: Make sure to ReplayListener time is independent of Game's update tick
func NewScenePlay ¶
Todo: actual auto replay generator for gimmick charts Todo: support mods: show Piano's ScenePlay during Drum's ScenePlay
func ScaledBPM ¶
It is proved that all BPMs are set into [min, max) by v*2 or v/2 if 2 * min >= max.
func SwitchDirection ¶
func SwitchDirection()
Types ¶
type Chart ¶
type Chart struct { gosu.ChartHeader MD5 [16]byte TransPoints []*gosu.TransPoint Notes []*Note Rolls []*Note Shakes []*Note Dots []*Dot // Ticks in a Roll note. Bars []*Bar Level float64 ScoreFactors [3]float64 }
func NewChart ¶
NewChart 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 { AnimationDrawers [4]draws.AnimationDrawer AnimationEndTime int64 // For Yes and No. Mode int }
func (DancerDrawer) AnimationFinish ¶
func (d DancerDrawer) AnimationFinish() bool
AnimationFinish infers if Dancer is ready to change its mode.
func (DancerDrawer) Draw ¶
func (d DancerDrawer) Draw(screen *ebiten.Image)
type Dot ¶
type Dot struct { Floater // Showtime int64 // Dot will appear at Showtime. Marked int Next *Dot Prev *Dot }
No consider situations that multiple rolls are overlapped.
type JudgmentDrawer ¶
type JudgmentDrawer struct { draws.BaseDrawer Sprites [2][3]draws.Sprite // contains filtered or unexported fields }
func (JudgmentDrawer) Draw ¶
func (d JudgmentDrawer) Draw(screen *ebiten.Image)
type KeyDrawer ¶
type Note ¶
type NoteDarwer ¶
type NoteDarwer struct { Time int64 Notes []*Note Rolls []*Note Shakes []*Note NoteSprites [2][4]draws.Sprite OverlayDrawers [2]draws.AnimationDrawer }
func (NoteDarwer) Draw ¶
func (d NoteDarwer) Draw(screen *ebiten.Image)
func (*NoteDarwer) Update ¶
func (d *NoteDarwer) Update(time int64, bpm float64)
type RollDrawer ¶
type RollDrawer struct { Time int64 Rolls []*Note Dots []*Dot HeadSprites [2]draws.Sprite BodySprites [2]draws.Sprite TailSprites [2]draws.Sprite DotSprite draws.Sprite }
func (RollDrawer) Draw ¶
func (d RollDrawer) Draw(screen *ebiten.Image)
func (*RollDrawer) Update ¶
func (d *RollDrawer) Update(time int64)
type ScenePlay ¶
type ScenePlay struct { Chart *Chart gosu.Timer // time int64 // Just a cache. gosu.MusicPlayer SoundEffectBytes [2][2][]byte // No custom hitsound at Drum mode. gosu.KeyLogger KeyActions [2]int *gosu.TransPoint SpeedScale float64 StagedNote *Note StagedDot *Dot StagedShake *Note LastHitTimes [4]int64 // For judging big note. StagedJudgment gosu.Judgment // For judging big note. StagedJudgmentTime int64 ShakeWaitingColor int gosu.Scorer // Skin may be applied some custom settings: on/off some sprites Skin BackgroundDrawer gosu.BackgroundDrawer StageDrawer StageDrawer BarDrawer BarDrawer JudgmentDrawer JudgmentDrawer ShakeDrawer ShakeDrawer RollDrawer RollDrawer NoteDrawer NoteDarwer KeyDrawer KeyDrawer DancerDrawer DancerDrawer ScoreDrawer gosu.ScoreDrawer ComboDrawer gosu.NumberDrawer MeterDrawer gosu.MeterDrawer }
func (ScenePlay) CurrentSpeed ¶
func (ScenePlay) DebugPrint ¶
func (s ScenePlay) DebugPrint(screen *ebiten.Image)
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) UpdateKeyActions ¶
func (s *ScenePlay) UpdateKeyActions()
func (*ScenePlay) UpdateTransPoint ¶
func (s *ScenePlay) UpdateTransPoint()
type ShakeDrawer ¶
type ShakeDrawer struct { Time int64 Staged *Note BorderSprite draws.Sprite ShakeSprite draws.Sprite }
func (ShakeDrawer) Draw ¶
func (d ShakeDrawer) Draw(screen *ebiten.Image)
func (*ShakeDrawer) Update ¶
func (d *ShakeDrawer) Update(time int64, staged *Note)
type Skin ¶
type Skin struct { FieldSprite draws.Sprite HintSprites [2]draws.Sprite BarSprite draws.Sprite JudgmentSprites [2][3]draws.Sprite NoteSprites [2][4]draws.Sprite HeadSprites [2]draws.Sprite TailSprites [2]draws.Sprite OverlaySprites [2][]draws.Sprite BodySprites [2]draws.Sprite DotSprite draws.Sprite ShakeBorderSprite draws.Sprite ShakeSprite draws.Sprite KeySprites [4]draws.Sprite KeyFieldSprite draws.Sprite DancerSprites [4][]draws.Sprite ScoreSprites [10]draws.Sprite ComboSprites [10]draws.Sprite }
Order of fields of Skin is roughly consistent with drawing order. https://osu.ppy.sh/wiki/en/Skinning/osu%21taiko
var DefaultSkin Skin
type StageDrawer ¶
func (StageDrawer) Draw ¶
func (d StageDrawer) Draw(screen *ebiten.Image)
func (*StageDrawer) Update ¶
func (d *StageDrawer) Update(highlight bool)