pcircle

package module
v0.0.0-...-1bac056 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NO_COUNTDOWN = iota
	NORMAL_COUNTDOWN
	HALF_COUNTDOWN
	DOUBLE_COUNTDOWN
)

Countdown speed and length.

View Source
const (
	OSU_GAMEMODE = iota
	TAIKO_GAMEMODE
	CTB_GAMEMODE
	MANIA_GAMEMODE
)

All possible gamemodes

View Source
const (
	CIRCLE = 1 << iota
	SLIDER
	NEW_COMBO
	SPINNER
	COMBO_SKIP_1
	COMBO_SKIP_2
	COMBO_SKIP_3
	MANIA_HOLD_NOTE
)

Bitmap for BaseHitObject.Type.

Variables

This section is empty.

Functions

This section is empty.

Types

type Background

type Background struct {
	FileName         string
	XOffset, YOffset int
}

Background specifies parameters of beatmap background. Example of an Background:

0,0,"bg.jpg",0,0

func (*Background) FromString

func (b *Background) FromString(str string) (err error)

FromString fills Background fields with data parsed from string.

func (Background) String

func (b Background) String() string

String returns string of Background as it would be in .osu file

type BaseHitObject

type BaseHitObject struct {
	X, Y     int
	Time     int
	Type     int
	HitSound HitSound
	Extras   *Extras
}

BaseHitObject provides common information that is used in all hit objects.

type Beatmap

type Beatmap struct {
	FileFormatVersion int    // Specifies version of beatmap file
	FilePath          string // The location of beatmap .osu file

	// General
	//
	// Various properties about the beatmap's gameplay.
	AudioFilename        string    // The location of the audio file relative to the current folder
	AudioLeadIn          int       // The amount of time added before the audio file begins playing
	PreviewTime          int       // Defines when the audio file should begin playing when selected in the song selection menu
	Countdown            int       // The speed of the countdown which occurs before the first hit object appears
	SampleSet            SampleSet // Specifies which set of hit sounds will be used throughout the beatmap
	StackLeniency        float64   // How often closely placed hit objects will be stacked together
	GameMode             int       // Defines the game mode of the beatmap (0=osu!, 1=Taiko, 2=Catch the Beat, 3=osu!mania)
	LetterboxInBreaks    bool      // Whether the letterbox appears during breaks
	StoryFireInFront     bool      // Whether or not display the storyboard in front of combo fire
	SkinPreference       string    // The preferred skin to use during gameplay
	EpilepsyWarning      bool      // Whether or not show a 'This beatmap contains scenes with rapidly flashing colours...' warning at the beginning of the beatmap
	CountdownOffset      int       // How many beats earlier the countdown starts
	WidescreenStoryboard bool      // Whether or not the storyboard should be widescreen
	SpecialStyle         bool      // Whether or not use the special N+1 style for osu!mania
	UseSkinSprites       bool      // Whether or not the storyboard can use user's skin resources

	// Editor
	//
	// Saved settings for mappers while editing beatmaps.
	Bookmarks       []int   // A list of times of editor bookmarks
	DistanceSpacing float64 // A multiplier for the "Distance Snap" feature
	BeatDivisor     int     // The beat division for placing objects
	GridSize        int     // The size of the grid for the "Grid Snap" feature
	TimelineZoom    float64 // The zoom in the editor timeline

	// Metadata
	//
	// Descriptive information about the song and beatmap.
	Title         string   // The title of the song limited to ASCII characters
	TitleUnicode  string   // The title of the song with unicode support
	Artist        string   // The name of the song's artist limited to ASCII characters
	ArtistUnicode string   // The name of the song's artist with unicode support
	Creator       string   // The username of the mapper
	Version       string   // The name of the beatmap's difficulty
	Source        string   // Describes the origin of the song
	Tags          []string // A collection of words describing the song
	BeatmapID     int      // The web ID of the single beatmap
	BeatmapSetID  int      // The web ID of the beatmap set (Mapset)

	// Difficulty
	//
	// Values defining the difficulty of the beatmap.
	HPDrainRate       float64 // How fast the health decreases
	CircleSize        float64 // The size of the hit objects in the osu!standard mode. In osu!mania mode, CircleSize is the number of columns
	OverallDifficulty float64 // The harshness of the hit window and the difficulty of spinners
	ApproachRate      float64 // Defines when hit objects start to fade in relatively to when they should be hit
	SliderMultiplier  float64 // Specifies the multiplier of the slider velocity
	SliderTickRate    float64 // The number of ticks per beat

	// Events
	//
	// A list of storyboard events.
	Background *Background // The location of the background image relative to the beatmap directory
	Breaks     []*Break    // Break times through the beatmap

	// Timing Points
	//
	// A list of the beatmap's timing points and hitsounds.
	// Describes a number of properties regarding beats per minute and
	// hit sounds. Sorted by offset in the timing points section.
	TimingPoints []*TimingPoint

	// Colours
	//
	// RGB values of the combo colours used.
	ComboColours []*RGB // Defines the colours of combos

	SliderBody          *RGB
	SliderTrackOverride *RGB
	SliderBorder        *RGB

	// Hit Objects
	//
	// A list of the beatmap's hit objects.
	HitObjects []interface{}
}

Beatmap stores information about single beatmap.

func NewBeatmap

func NewBeatmap() *Beatmap

NewBeatmap returns a new empty Beatmap.

func (*Beatmap) FromFile

func (b *Beatmap) FromFile(path string) error

FromFile parses specified file and fills Beatmap with data.

func (*Beatmap) SortHitObjects

func (b *Beatmap) SortHitObjects()

func (*Beatmap) SortTimingPoints

func (b *Beatmap) SortTimingPoints()

func (*Beatmap) ToFile

func (b *Beatmap) ToFile(path string) error

type Break

type Break struct {

	// Both are an number of milliseconds from the beginning of the song defining the start and end point of the break period
	StartTime int
	EndTime   int
}

Break defines a single break period. Example of an break period:

2,4627,5743

func (*Break) FromString

func (b *Break) FromString(str string) (err error)

FromString fills Break fields with data parsed from string.

func (Break) String

func (b Break) String() string

String returns string of Break as it would be in .osu file

type Circle

type Circle struct {
	BaseHitObject
}

Circle is a single hit in all osu! game modes. Example:

164,260,2434,1,0,0:0:0:0:

func (*Circle) FromString

func (c *Circle) FromString(str string) (err error)

FromString fills Circle fields with data parsed from string.

func (Circle) String

func (c Circle) String() string

String returns string of Circle as it would be in .osu file.

type Extras

type Extras struct {
	SampleSet     SampleSet // The sample set of the normal hit sound. When sampleSet is 0, its value should be inherited from the timing point.
	AdditionalSet SampleSet // The sample set for the other hit sounds
	CustomIndex   int       // Custom sample set index
	SampleVolume  int       // Volume of the sample, and ranges from 0 to 100 (percent)
	Filename      string    // Names an audio file in the folder to play instead of sounds from sample sets
}

Extras define additional parameters related to the hit sound samples. The most common example:

0:0:0:0:

func (*Extras) FromString

func (e *Extras) FromString(str string) (err error)

FromString fills Extras fields with data parsed from string.

func (Extras) String

func (e Extras) String() string

String returns string of Extras as it would be in .osu file

type HitSound

type HitSound int

HitSound specifies a hit sounds to play when the hit object is successfully hit.

const (
	NO_HITSOUND     HitSound = 0
	NORMAL_HITSOUND HitSound = 1 << iota
	WHISTLE_HITSOUND
	FINISH_HITSOUND
	CLAP_HITSOUND
)

All possible hit sounds

type ManiaHoldNote

type ManiaHoldNote struct {
	BaseHitObject
	EndTime int
}

ManiaHoldNote is a hold note unique to osu!mania. Example:

329,192,16504,128,0,16620:0:0:0:0:

func (*ManiaHoldNote) FromString

func (hn *ManiaHoldNote) FromString(str string) (err error)

FromString fills ManiaHoldNote fields with data parsed from string.

func (ManiaHoldNote) String

func (hn ManiaHoldNote) String() string

String returns string of ManiaHoldNote as it would be in .osu file.

type Mapset

type Mapset struct {
	DirectoryPath string // The location of mapset directory, where located beatmaps.

	Beatmaps     []*Beatmap // Unordered list of beatmaps
	BeatmapSetID int        // The web ID of the beatmap set
}

Mapset stores information about beatmaps, its location and other.

func NewMapset

func NewMapset() *Mapset

func (*Mapset) FromDirectory

func (m *Mapset) FromDirectory(path string) (err error)

FromDirectory scans provided (from structure) directory and loads .osu files into Mapset.

func (Mapset) ToOSZ

func (m Mapset) ToOSZ() (buf *bytes.Buffer, err error)

Compresses Mapset into .osz and returns its buffer.

type RGB

type RGB struct {
	R, G, B int
}

RGB provides color manipulation. Example:

128,128,0

func (*RGB) FromString

func (c *RGB) FromString(str string) (err error)

FromString fills RGB triplet with data parsed from string.

func (RGB) String

func (c RGB) String() string

String returns string of RGB as it would be in .osu file

type SampleSet

type SampleSet int

SampleSet specifies which set of hit sounds will be used.

const (
	AUTO_SAMPLESET SampleSet = iota
	NORMAL_SAMPLESET
	SOFT_SAMPLESET
	DRUM_SAMPLESET
)

All possible sample sets.

func (*SampleSet) FromString

func (ss *SampleSet) FromString(sample string) error

FromString allows you to set sample sets with strings.

func (SampleSet) String

func (ss SampleSet) String() string

String returns string of SampleSet in readable format.

type Slider

type Slider struct {
	BaseHitObject

	// Specifies path of the slider.
	SliderPath *SliderPath

	// The number of times a player will go over the slider.
	// A value of 1 will not repeat, 2 will repeat once, 3 twice, and so on.
	Repeat int

	// The length of the slider along the path of the described curve.
	// It is specified in osu!pixels, i.e. relative to the 512×384 virtual screen.
	PixelLength float64

	// Applies only to the body of the slider. Only normal (0) and
	// whistle (2) are supported. The samples played are named
	// like soft-sliderslide4.wav for normal, and normal-sliderwhistle.wav for whistle.
	// These samples are meant to be looped, and may also be empty WAV files to mute
	// the slider.
	HitSound HitSound

	// List of HitSounds to apply to the circles of the slider.
	// The values are the same as those for regular hit objects.
	// The list must contain exactly repeat + 1 values, where the first value
	// is the hit sound to play when the slider is first clicked, and the last one
	// when the slider is released.
	EdgeHitSounds []HitSound

	// List of samples sets to apply to the circles of the slider.
	// The list contains exactly repeat + 1 elements. SampleSet and AdditionSet
	// are the same as for hit circles' extras fields.
	EdgeAdditions []*SliderEdgeAddition
}

Slider also creates droplets in Catch the Beat, yellow drumrolls in Taiko, and does not appear in osu!mania. Example:

424,96,66,2,0,B|380:120|332:96|332:96|304:124,1,130,2|0,0:0|0:0,0:0:0:0:

func (*Slider) FromString

func (s *Slider) FromString(str string) (err error)

FromString fills Slider fields with data parsed from string.

func (Slider) String

func (s Slider) String() string

String returns string of Slider as it would be in .osu file.

type SliderCurvePoint

type SliderCurvePoint struct {
	X, Y int
}

SliderCurvePoint describe a single point of the slider.

func (*SliderCurvePoint) FromString

func (cp *SliderCurvePoint) FromString(str string) (err error)

FromString fills SliderCurvePoint fields with data parsed from string.

func (SliderCurvePoint) String

func (cp SliderCurvePoint) String() string

String returns string of SliderCurvePoint as it would be in .osu file.

type SliderEdgeAddition

type SliderEdgeAddition struct {
	SampleSet   SampleSet
	AdditionSet SampleSet
}

SliderEdgeAddition is a sample sets to apply to the circles of the slider. SampleSet and AdditionSet are the same as for hit circles' extras fields.

func (*SliderEdgeAddition) FromString

func (sea *SliderEdgeAddition) FromString(str string) (err error)

FromString fills SliderEdgeAddition fields with data parsed from string.

func (SliderEdgeAddition) String

func (sea SliderEdgeAddition) String() string

String returns string of SliderEdgeAddition as it would be in .osu file.

type SliderPath

type SliderPath struct {
	SliderType  string
	CurvePoints []*SliderCurvePoint
}

SliderPath specifies path of the slider.

func (*SliderPath) FromString

func (sp *SliderPath) FromString(str string) (err error)

FromString fills SliderPath fields SliderPath with data parsed from string.

func (SliderPath) String

func (sp SliderPath) String() string

String returns string of SliderPath as it would be in .osu file.

type Spinner

type Spinner struct {
	BaseHitObject
	EndTime int // When the spinner will end, in milliseconds from the beginning of the song
}

Spinner also creates bananas in Catch the Beat, a spinner in osu!taiko, and does not appear in osu!mania. Hit sounds play at the end of the spinner. Example:

256,192,730,12,8,3983

func (*Spinner) FromString

func (s *Spinner) FromString(str string) (err error)

FromString fills Spinner fields with data parsed from string.

func (Spinner) String

func (s Spinner) String() string

String returns string of Spinner as it would be in .osu file.

type TimingPoint

type TimingPoint struct {
	Offset int // Define when the timing point starts

	// Defines the duration of one beat. It affect the scrolling speed in osu!taiko or
	// osu!mania, and the slider speed in osu!standard.
	MillisecondsPerBeat float64

	Meter       int       // The number of beats in a measure
	SampleSet   SampleSet // The default sample set for hit objects
	SampleIndex int       // The default custom index
	Volume      int       // The default hitsound volume, ranges from 0 to 100 (percent)

	// Tells if the timing point can be inherited from.
	// A positive milliseconds per beat implies inherited is true (1), and a negative
	// one implies it is false (0). Note that false (0) means green line, true (1) means
	// red line.
	Inherited bool

	Kiai bool // Defines whether or not Kiai Time effects are active
}

TimingPoint describe a number of properties regarding beats per minute and hit sounds.

Example of a TimingPoint:

66,315.789473684211,4,2,0,45,1,0

Example of an inherited TimingPoint:

10171,-100,4,2,0,60,0,1

func (*TimingPoint) FromString

func (tp *TimingPoint) FromString(str string) (err error)

FromString fills TimingPoint fields with data parsed from string.

func (TimingPoint) String

func (tp TimingPoint) String() string

String returns string of TimingPoint as it would be in .osu file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL