Documentation
¶
Index ¶
- Constants
- Variables
- func BPMs(ds []*Dynamic, duration int32) (main, min, max float64)
- func BeatTimes(ds []*Dynamic, duration int32, meter int) (times []int32)
- func DifficultyPieceTimes(dys []*Dynamic, chartDuration int32) (times []int32, durations []int32)
- func Hash(r io.Reader) ([16]byte, error)
- func Level(c Chart) float64
- func NewComboDrawer(sprites [10]draws.Sprite, src *int, timer *draws.Timer, digitGap float64, ...) func(draws.Image)
- func NewScoreDrawer(sprites [13]draws.Sprite, score *float64, digitGap float64) func(draws.Image)
- func NewScoreSprites(fsys fs.FS, ScreenSize draws.Vector2, scale float64) [13]draws.Sprite
- func SetTPS(new float64)
- func ToSecond(ms int32) float64
- func ToTick(ms int32) int
- func ToTime(tick int) int32
- type Chart
- type ChartHeader
- type Delayed
- type Dynamic
- type Judgment
- type Sample
- type ScenePlay
- type Timer
Constants ¶
const ( ScoreDot = iota + 10 ScoreComma ScorePercent )
const ( ModePiano = iota ModeDrum ModeSing )
const ( DelayedModeExp = iota // aka DelayedModeConverge DelayedModeLinear )
const ( Kool = iota Cool Good Miss // Its window is used for judging too early hit. )
the ideal number of Judgments is: 3 + 1
const ModeAll = -1
Variables ¶
var DefaultSample = Sample{Filename: "", Volume: 0.5}
Functions ¶
func BPMs ¶
BPM with longest duration will be main BPM. When there are multiple BPMs with same duration, larger one will be main BPM.
func DifficultyPieceTimes ¶ added in v0.6.0
func NewComboDrawer ¶ added in v0.6.0
func NewComboDrawer(sprites [10]draws.Sprite, src *int, timer *draws.Timer, digitGap float64, bounce float64) func(draws.Image)
Each number has different width. Number 0's width is used as standard. ComboDrawer's Draw draws each number at constant x regardless of their widths.
func NewScoreDrawer ¶
Name of a function which returns closure ends with "-er".
func NewScoreSprites ¶ added in v0.6.0
Types ¶
type ChartHeader ¶
type ChartHeader struct { SetID int32 // Compatibility for osu. ID int32 // Compatibility for osu. MusicName string MusicUnicode string Artist string ArtistUnicode string MusicSource string ChartName string Charter string CharterID int32 HolderID int32 // When the chart is uploaded by non-charter. Tags []string PreviewTime int32 MusicFilename string // Filename is fine to use. (cf. FileName; Filepath) BackgroundFilename string VideoFilename string VideoTimeOffset int32 Mode int SubMode int // Hash works as id in database. // Hash is not exported to file. ChartHash [16]byte // MD5 // MusicHash is used to check for music updates. // A player may replace the music file with another, // such as a higher-quality version. MusicHash [16]byte // MD5 }
ChartHeader contains non-play information. Changing ChartHeader's data will not affect integrity of the chart. Mode-specific fields are located to each Chart struct.
func NewChartHeader ¶
func NewChartHeader(f any) (c ChartHeader)
func (ChartHeader) WindowTitle ¶
func (c ChartHeader) WindowTitle() string
type Delayed ¶ added in v0.6.0
type Delayed struct { Mode int Feedback float64 Target float64 Delayed float64 // contains filtered or unexported fields }
For displaying score with scrolling effect.
func NewDelayed ¶ added in v0.6.0
type Dynamic ¶ added in v0.6.0
type Dynamic struct { Time int32 BPM float64 Speed float64 Meter int NewBeat bool // NewBeat draws a bar. Volume float64 // Used when sample volume is 0. Highlight bool Position float64 // Next and Prev are used in each mode too, hence exported. Next *Dynamic Prev *Dynamic }
Except Volume, all fields in Dynamic are related in beat, or 'Pace'. Tempo: Allergo, Adagio Rhythm: confusing with pattern Measure: aka BPM Meter: confusing with field 'Meter'
func NewDynamics ¶ added in v0.6.0
func NextDynamics ¶ added in v0.6.0
func (Dynamic) BeatDuration ¶ added in v0.6.0
0: Use default meter.
type Judgment ¶
func Judge ¶
func Judge(js []Judgment, e int32, a input.KeyActionType) Judgment
Judge judges in normal style: Whether a player hits a key in time. Late hit makes negative time error.
type ScenePlay ¶ added in v0.6.0
type ScenePlay interface { ChartHeader() ChartHeader WindowTitle() string // int32 is enough for dealing with scene time in millisecond. // Maximum duration with int32 is around 24 days. Now() int32 Speed() float64 IsPaused() bool DebugString() string SetMusicVolume(float64) SetSpeedScale() SetMusicOffset(int32) Update() any Pause() Resume() Finish() any Draw(screen draws.Image) }
Interface is also used when it uses the unknown struct.
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
func (*Timer) SetMusicOffset ¶ added in v0.6.0
TL;DR: If you tend to hit early, set positive offset. It leads to delayed music / early start time.
func (*Timer) SetMusicPlayed ¶ added in v0.6.0
No update t.startTime here. Notes would look like they suddenly teleport at the beginning.