Documentation ¶
Index ¶
- Constants
- Variables
- func ExposureTime(speed float64) float64
- func LoadSkin()
- func NewChartInfo(cpath string) (info gosu.ChartInfo, err error)
- func NewReplayListener(f *osr.Format, keyCount int, timer *gosu.Timer) func() []bool
- func NewScenePlay(cpath string, rf *osr.Format) (scene gosu.Scene, err error)
- func SwitchDirection()
- func Verdict(noteType int, a input.KeyAction, td int64) gosu.Judgment
- type Bar
- type BarDrawer
- type Chart
- type FieldDrawer
- type HintDrawer
- type HitLightingDrawer
- type HoldLightingDrawer
- type JudgmentDrawer
- type KeyDrawer
- type KeyLightingDrawer
- type Note
- type NoteDrawer
- type NoteKind
- type ScenePlay
- func (s ScenePlay) DebugPrint(screen *ebiten.Image)
- func (s ScenePlay) Draw(screen *ebiten.Image)
- func (s *ScenePlay) MarkNote(n *Note, j gosu.Judgment)
- func (s *ScenePlay) SetSpeed()
- func (s ScenePlay) Speed() float64
- func (s *ScenePlay) Update() any
- func (s *ScenePlay) UpdateCursor()
- func (s *ScenePlay) UpdateTransPoint()
- type Skin
Constants ¶
const ( Normal = iota Head Tail Body // Todo: separate Body and other notes at Skin, Drawer? )
const ( BodyStyleStretch = iota BodyStyleAttach )
const ( LeftScratch = 32 RightScratch = 64 ScratchMask = ^(LeftScratch | RightScratch) )
LeftScratch and RightScratch are bits for indicating scratch mode. For example, when key count is 40 = 32 + 8, it is 8-key with left scratch.
const DifficultyDuration int64 = 800
Variables ¶
var ( Kool = gosu.Judgment{Flow: 0.01, Acc: 1, Window: 20} Cool = gosu.Judgment{Flow: 0.01, Acc: 1, Window: 45} Good = gosu.Judgment{Flow: 0.01, Acc: 0.25, Window: 75} Bad = gosu.Judgment{Flow: 0.01, Acc: 0, Window: 110} // Todo: Flow 0.01 -> 0? Miss = gosu.Judgment{Flow: -1, Acc: 0, Window: 150} )
var ( FieldDarkness float64 = 0.8 FieldPosition float64 = screenSizeX * 0.5 HitPosition float64 = screenSizeY * 0.90 // The bottom y-value of Hint, not a middle or top. NoteHeigth float64 = screenSizeY * 0.05 // Applies to all notes TailExtraTime float64 = 0 ComboPosition float64 = screenSizeY * 0.40 JudgmentPosition float64 = screenSizeY * 0.66 )
Todo: add note lighting color settings per kind Todo: Should NoteHeight be separated into NoteHeight, HeadHeight, TailHeight?
var ( BodyStyle int = BodyStyleStretch ReverseBody bool = false ScoreScale float64 = 0.65 ComboScale float64 = 0.75 ComboDigitGap float64 = screenSizeX * -0.0008 JudgmentScale float64 = 0.33 HintHeight float64 = screenSizeY * 0.04 LightingScale float64 = 1.0 KeyLightingOpaque float64 = 0.5 HitLightingOpaque float64 = 1 )
Skin-dependent settings. Todo: make SkinScaleSettings struct?
var FingerMap = map[int][]int{
0: {},
1: {0},
2: {1, 1},
3: {1, 0, 1},
4: {2, 1, 1, 2},
5: {2, 1, 0, 1, 2},
6: {3, 2, 1, 1, 2, 3},
7: {3, 2, 1, 0, 1, 2, 3},
8: {4, 3, 2, 1, 1, 2, 3, 4},
9: {4, 3, 2, 1, 0, 1, 2, 3, 4},
10: {4, 3, 2, 1, 0, 0, 1, 2, 3, 4},
}
var GeneralSkin struct { ComboSprites [10]draws.Sprite JudgmentSprites [5]draws.Animation }
GeneralSkin is a singleton.
var JudgmentColors = []color.NRGBA{ gosu.ColorKool, gosu.ColorCool, gosu.ColorGood, gosu.ColorBad, gosu.ColorMiss}
var KeySettings = map[int][]input.Key{ 4: {input.KeyD, input.KeyF, input.KeyJ, input.KeyK}, 5: {input.KeyD, input.KeyF, input.KeySpace, input.KeyJ, input.KeyK}, 6: {input.KeyS, input.KeyD, input.KeyF, input.KeyJ, input.KeyK, input.KeyL}, 7: {input.KeyS, input.KeyD, input.KeyF, input.KeySpace, input.KeyJ, input.KeyK, input.KeyL}, 8 + LeftScratch: {input.KeyA, input.KeyS, input.KeyD, input.KeyF, input.KeySpace, input.KeyJ, input.KeyK, input.KeyL}, 8: {input.KeyA, input.KeyS, input.KeyD, input.KeyF, input.KeyJ, input.KeyK, input.KeyL, input.KeySemicolon}, 9: {input.KeyA, input.KeyS, input.KeyD, input.KeyF, input.KeySpace, input.KeyJ, input.KeyK, input.KeyL, input.KeySemicolon}, 10: {input.KeyA, input.KeyS, input.KeyD, input.KeyF, input.KeyV, input.KeyN, input.KeyJ, input.KeyK, input.KeyL, input.KeySemicolon}, }
var ModePiano4 = gosu.ModeProp{ Name: "Piano4", Mode: gosu.ModePiano4, ChartInfos: make([]gosu.ChartInfo, 0), Results: make(map[[16]byte]gosu.Result), LastUpdateTime: time.Time{}, LoadSkin: LoadSkin, SpeedScale: &SpeedScale, Settings: map[string]*float64{ "TailExtraTime": &TailExtraTime, }, NewChartInfo: NewChartInfo, NewScenePlay: NewScenePlay, ExposureTime: ExposureTime, KeySettings: KeySettings, }
var ModePiano7 = gosu.ModeProp{ Name: "Piano7", Mode: gosu.ModePiano7, ChartInfos: make([]gosu.ChartInfo, 0), Results: make(map[[16]byte]gosu.Result), LastUpdateTime: time.Time{}, LoadSkin: LoadSkin, SpeedScale: &SpeedScale, Settings: map[string]*float64{ "TailExtraTime": &TailExtraTime, }, NewChartInfo: NewChartInfo, NewScenePlay: NewScenePlay, ExposureTime: ExposureTime, KeySettings: KeySettings, }
var NoteKindsMap = map[int][]NoteKind{ 0: {}, 1: {Mid}, 2: {One, One}, 3: {One, Mid, One}, 4: {One, Two, Two, One}, 5: {One, Two, Mid, Two, One}, 6: {One, Two, One, One, Two, One}, 7: {One, Two, One, Mid, One, Two, One}, 8: {Tip, One, Two, One, One, Two, One, Tip}, 9: {Tip, One, Two, One, Mid, One, Two, One, Tip}, 10: {Tip, One, Two, One, Mid, Mid, One, Two, One, Tip}, }
var NoteWidthsMap = map[int][3]float64{
4: {0.065, 0.065, 0.065},
5: {0.065, 0.065, 0.065},
6: {0.065, 0.065, 0.065},
7: {0.06, 0.06, 0.06},
8: {0.06, 0.06, 0.06},
9: {0.06, 0.06, 0.06},
10: {0.06, 0.06, 0.06},
}
var Skins = make(map[int]Skin)
var SpeedScale float64 = 1.0
Functions ¶
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: add Mods
func SwitchDirection ¶
func SwitchDirection()
Types ¶
type Chart ¶
type Chart struct { gosu.ChartHeader MD5 [16]byte KeyCount int TransPoints []*gosu.TransPoint Notes []*Note Bars []*Bar Level float64 ScoreFactors [3]float64 }
Level, ScoreFactors, MD5 will not exported to file.
func NewChart ¶
Position is for calculating note and bar's sprite positions efficiently. Positions of notes and bars at time = 0 are calculated in advance. In every Update(), only current cursor's Position is calculated. Notes and bars are drawn based on the difference between their positions and cursor's.
func (Chart) Difficulties ¶
Mods may change the duration of chart. Todo: implement actual calculating chart difficulties
func (Chart) NoteCountString ¶
func (Chart) NoteCounts ¶
type FieldDrawer ¶ added in v0.2.4
func (FieldDrawer) Draw ¶ added in v0.2.4
func (d FieldDrawer) Draw(screen *ebiten.Image)
type HintDrawer ¶ added in v0.2.4
func (HintDrawer) Draw ¶ added in v0.2.4
func (d HintDrawer) Draw(screen *ebiten.Image)
type HitLightingDrawer ¶ added in v0.2.4
func (HitLightingDrawer) Draw ¶ added in v0.2.4
func (d HitLightingDrawer) Draw(screen *ebiten.Image)
func (*HitLightingDrawer) Update ¶ added in v0.2.4
func (d *HitLightingDrawer) Update(hit bool)
HitLightingDrawer draws when Normal is Hit or Tail is Release.
type HoldLightingDrawer ¶ added in v0.2.4
type HoldLightingDrawer struct { draws.Timer Sprites draws.Animation // contains filtered or unexported fields }
func (HoldLightingDrawer) Draw ¶ added in v0.2.4
func (d HoldLightingDrawer) Draw(screen *ebiten.Image)
func (*HoldLightingDrawer) Update ¶ added in v0.2.4
func (d *HoldLightingDrawer) Update(pressed bool)
type JudgmentDrawer ¶
func NewJudgmentDrawer ¶
func NewJudgmentDrawer() (d JudgmentDrawer)
func (JudgmentDrawer) Draw ¶
func (d JudgmentDrawer) Draw(screen *ebiten.Image)
func (*JudgmentDrawer) Update ¶
func (d *JudgmentDrawer) Update(worst gosu.Judgment)
type KeyDrawer ¶
type KeyDrawer struct { draws.Timer Sprites [2]draws.Sprite // contains filtered or unexported fields }
type KeyLightingDrawer ¶ added in v0.2.4
type KeyLightingDrawer struct { draws.Timer Sprite draws.Sprite // contains filtered or unexported fields }
func (KeyLightingDrawer) Draw ¶ added in v0.2.4
func (d KeyLightingDrawer) Draw(screen *ebiten.Image)
KeyLightingDrawer draws for a while even when pressed off very shortly.
func (*KeyLightingDrawer) Update ¶ added in v0.2.4
func (d *KeyLightingDrawer) Update(pressed bool)
type Note ¶
type Note struct { Time int64 Duration int64 Type int Key int Position float64 // Scaled x or y value. gosu.Sample Marked bool Next *Note Prev *Note // For accessing to Head from Tail. }
type NoteDrawer ¶
type NoteDrawer struct { draws.Timer Cursor float64 Farthest *Note Nearest *Note Sprites [4]draws.Animation // contains filtered or unexported fields }
Notes are fixed. Lane itself moves, all notes move same amount.
func (NoteDrawer) Draw ¶
func (d NoteDrawer) Draw(screen *ebiten.Image)
Draw from farthest to nearest to make nearer notes priorly exposed.
func (NoteDrawer) DrawBody ¶ added in v0.2.3
func (d NoteDrawer) DrawBody(screen *ebiten.Image, tail *Note)
DrawBody draws scaled, corresponding sub-image of Body sprite.
func (*NoteDrawer) Update ¶
func (d *NoteDrawer) Update(cursor float64, holding bool)
Farthest and Nearest are borders of displaying notes. All in-screen notes are confirmed to be drawn when drawing from Farthest to Nearest.
type ScenePlay ¶
type ScenePlay struct { Chart *Chart gosu.Timer gosu.MusicPlayer // gosu.EffectPlayer gosu.KeyLogger *gosu.TransPoint SpeedScale float64 Cursor float64 Staged []*Note gosu.Scorer Skin // The skin may be applied some custom settings: on/off some sprites BackgroundDrawer gosu.BackgroundDrawer FieldDrawer FieldDrawer BarDrawer BarDrawer NoteDrawers []NoteDrawer KeyDrawers []KeyDrawer KeyLightingDrawers []KeyLightingDrawer HintDrawer HintDrawer HitLightingDrawers []HitLightingDrawer HoldLightingDrawers []HoldLightingDrawer JudgmentDrawer JudgmentDrawer ScoreDrawer gosu.ScoreDrawer ComboDrawer gosu.NumberDrawer MeterDrawer gosu.MeterDrawer }
ScenePlay: struct, PlayScene: function
func (ScenePlay) DebugPrint ¶
func (s ScenePlay) DebugPrint(screen *ebiten.Image)
func (*ScenePlay) MarkNote ¶
Extra primitive in Piano mode is a count of Kools. Todo: no getting Flow when hands off the long note
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) Update ¶
Todo: apply other values of TransPoint (Volume has finished so far) Todo: keep playing music when making SceneResult
func (*ScenePlay) UpdateCursor ¶
func (s *ScenePlay) UpdateCursor()
Supposes one current TransPoint can increment cursor precisely.
func (*ScenePlay) UpdateTransPoint ¶
func (s *ScenePlay) UpdateTransPoint()
type Skin ¶
type Skin struct { // Sprites which are independent of key count. ScoreSprites [10]draws.Sprite SignSprites [3]draws.Sprite ComboSprites [10]draws.Sprite JudgmentSprites [5]draws.Animation // Sprites which are dependent of key count. KeySprites [][2]draws.Sprite KeyLightingSprites []draws.Sprite HitLightingSprites []draws.Animation HoldLightingSprites []draws.Animation NoteSprites [][4]draws.Animation FieldSprite draws.Sprite HintSprite draws.Sprite BarSprite draws.Sprite }
Todo: should each skin has own skin settings?