mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Fix comments not to use the term 'this function'
This commit is contained in:
parent
09c93ac86d
commit
d752408da3
@ -278,7 +278,7 @@ func (c *Context) loop() {
|
||||
// Update is deprecated as of 1.6.0-alpha.
|
||||
//
|
||||
// As of 1.6.0-alpha, Update always returns nil and does nothing related to updating the state.
|
||||
// You don't have to call this function any longer.
|
||||
// You don't have to call Update any longer.
|
||||
// The internal audio error is returned at ebiten.Run instead.
|
||||
func (c *Context) Update() error {
|
||||
return nil
|
||||
@ -691,7 +691,7 @@ func (p *Player) Volume() float64 {
|
||||
}
|
||||
|
||||
// SetVolume sets the volume of this player.
|
||||
// volume must be in between 0 and 1. This function panics otherwise.
|
||||
// volume must be in between 0 and 1. SetVolume panics otherwise.
|
||||
func (p *Player) SetVolume(volume float64) {
|
||||
// The condition must be true when volume is NaN.
|
||||
if !(0 <= volume && volume <= 1) {
|
||||
|
@ -26,13 +26,13 @@ import (
|
||||
|
||||
// NewImageFromFile loads the file with path and returns ebiten.Image and image.Image.
|
||||
//
|
||||
// Image decoders must be imported when using this function. For example,
|
||||
// Image decoders must be imported when using NewImageFromFile. For example,
|
||||
// if you want to load a PNG image, you'd need to add `_ "image/png"` to the import section.
|
||||
//
|
||||
// How to solve path depends on your environment. This varies on your desktop or web browser.
|
||||
// Note that this doesn't work on mobiles.
|
||||
//
|
||||
// For productions, instead of using this function, it is safer to embed your resources, e.g., with github.com/jteeuwen/go-bindata .
|
||||
// For productions, instead of using NewImageFromFile, it is safer to embed your resources, e.g., with github.com/jteeuwen/go-bindata .
|
||||
func NewImageFromFile(path string, filter ebiten.Filter) (*ebiten.Image, image.Image, error) {
|
||||
file, err := OpenFile(path)
|
||||
if err != nil {
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
|
||||
// NewImageFromURL creates a new ebiten.Image from the given URL.
|
||||
//
|
||||
// Image decoders must be imported when using this function. For example,
|
||||
// Image decoders must be imported when using NewImageFromURL. For example,
|
||||
// if you want to load a PNG image, you'd need to add `_ "image/png"` to the import section.
|
||||
//
|
||||
// FilterDefault is used at NewImgeFromImage internally.
|
||||
|
30
input.go
30
input.go
@ -27,7 +27,7 @@ import (
|
||||
// IsKeyPressed is based on a mapping of device (US keyboard) codes to input device keys.
|
||||
// "Control" and modifier keys should be handled with IsKeyPressed.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// InputChars is concurrent-safe.
|
||||
func InputChars() []rune {
|
||||
rb := input.Get().RuneBuffer()
|
||||
return append(make([]rune, 0, len(rb)), rb...)
|
||||
@ -40,14 +40,14 @@ func InputChars() []rune {
|
||||
// - KeyKPEnter and KeyKPEqual are recognized as KeyEnter and KeyEqual.
|
||||
// - KeyPrintScreen is only treated at keyup event.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsKeyPressed is concurrent-safe.
|
||||
func IsKeyPressed(key Key) bool {
|
||||
return input.Get().IsKeyPressed(input.Key(key))
|
||||
}
|
||||
|
||||
// CursorPosition returns a position of a mouse cursor.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// CursorPosition is concurrent-safe.
|
||||
func CursorPosition() (x, y int) {
|
||||
return ui.AdjustedCursorPosition()
|
||||
}
|
||||
@ -60,9 +60,9 @@ func MouseWheel() (xoff, yoff float64) {
|
||||
|
||||
// IsMouseButtonPressed returns a boolean indicating whether mouseButton is pressed.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsMouseButtonPressed is concurrent-safe.
|
||||
//
|
||||
// Note that touch events not longer affect this function's result as of 1.4.0-alpha.
|
||||
// Note that touch events not longer affect IsMouseButtonPressed's result as of 1.4.0-alpha.
|
||||
// Use Touches instead.
|
||||
func IsMouseButtonPressed(mouseButton MouseButton) bool {
|
||||
return input.Get().IsMouseButtonPressed(input.MouseButton(mouseButton))
|
||||
@ -70,48 +70,48 @@ func IsMouseButtonPressed(mouseButton MouseButton) bool {
|
||||
|
||||
// GamepadIDs returns a slice indicating available gamepad IDs.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// GamepadIDs is concurrent-safe.
|
||||
//
|
||||
// This function always returns an empty slice on mobiles.
|
||||
// GamepadIDs always returns an empty slice on mobiles.
|
||||
func GamepadIDs() []int {
|
||||
return input.Get().GamepadIDs()
|
||||
}
|
||||
|
||||
// GamepadAxisNum returns the number of axes of the gamepad (id).
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// GamepadAxisNum is concurrent-safe.
|
||||
//
|
||||
// This function always returns 0 on mobiles.
|
||||
// GamepadAxisNum always returns 0 on mobiles.
|
||||
func GamepadAxisNum(id int) int {
|
||||
return input.Get().GamepadAxisNum(id)
|
||||
}
|
||||
|
||||
// GamepadAxis returns the float value [-1.0 - 1.0] of the given gamepad (id)'s axis (axis).
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// GamepadAxis is concurrent-safe.
|
||||
//
|
||||
// This function always returns 0 on mobiles.
|
||||
// GamepadAxis always returns 0 on mobiles.
|
||||
func GamepadAxis(id int, axis int) float64 {
|
||||
return input.Get().GamepadAxis(id, axis)
|
||||
}
|
||||
|
||||
// GamepadButtonNum returns the number of the buttons of the given gamepad (id).
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// GamepadButtonNum is concurrent-safe.
|
||||
//
|
||||
// This function always returns 0 on mobiles.
|
||||
// GamepadButtonNum always returns 0 on mobiles.
|
||||
func GamepadButtonNum(id int) int {
|
||||
return input.Get().GamepadButtonNum(id)
|
||||
}
|
||||
|
||||
// IsGamepadButtonPressed returns the boolean indicating the given button of the gamepad (id) is pressed or not.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsGamepadButtonPressed is concurrent-safe.
|
||||
//
|
||||
// The relationships between physical buttons and buttion IDs depend on environments.
|
||||
// There can be differences even between Chrome and Firefox.
|
||||
//
|
||||
// This function always returns false on mobiles.
|
||||
// IsGamepadButtonPressed always returns false on mobiles.
|
||||
func IsGamepadButtonPressed(id int, button GamepadButton) bool {
|
||||
return input.Get().IsGamepadButtonPressed(id, input.GamepadButton(button))
|
||||
}
|
||||
|
32
run.go
32
run.go
@ -38,7 +38,7 @@ const FPS = clock.FPS
|
||||
// NOT how many times logical game updating (a passed function to Run) happens.
|
||||
// Note that logical game updating is assured to happen 60 times in a second.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// CurrentFPS is concurrent-safe.
|
||||
func CurrentFPS() float64 {
|
||||
return clock.CurrentFPS()
|
||||
}
|
||||
@ -76,7 +76,7 @@ func setDrawingSkipped(skipped bool) {
|
||||
// return nil
|
||||
// }
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsDrawingSkipped is concurrent-safe.
|
||||
func IsDrawingSkipped() bool {
|
||||
return atomic.LoadInt32(&isDrawingSkipped) != 0
|
||||
}
|
||||
@ -285,9 +285,9 @@ func Run(f func(*Image) error, width, height int, scale float64, title string) e
|
||||
}
|
||||
|
||||
// RunWithoutMainLoop runs the game, but don't call the loop on the main (UI) thread.
|
||||
// Different from Run, this function returns immediately.
|
||||
// Different from Run, RunWithoutMainLoop returns immediately.
|
||||
//
|
||||
// Ebiten users should NOT call this function.
|
||||
// Ebiten users should NOT call RunWithoutMainLoop.
|
||||
// Instead, functions in github.com/hajimehoshi/ebiten/mobile package calls this.
|
||||
func RunWithoutMainLoop(f func(*Image) error, width, height int, scale float64, title string) <-chan error {
|
||||
f = (&imageDumper{f: f}).update
|
||||
@ -344,7 +344,7 @@ func MonitorSize() (int, int) {
|
||||
//
|
||||
// Unit is device-independent pixel.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// SetScreenSize is concurrent-safe.
|
||||
func SetScreenSize(width, height int) {
|
||||
if width <= 0 || height <= 0 {
|
||||
panic("ebiten: width and height must be positive")
|
||||
@ -360,7 +360,7 @@ func SetScreenSize(width, height int) {
|
||||
// you can disable this automatical device scaling as a result.
|
||||
// You can get the device scale by DeviceScaleFactor function.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// SetScreenScale is concurrent-safe.
|
||||
func SetScreenScale(scale float64) {
|
||||
if scale <= 0 {
|
||||
panic("ebiten: scale must be positive")
|
||||
@ -372,7 +372,7 @@ func SetScreenScale(scale float64) {
|
||||
//
|
||||
// If Run is not called, this returns 0.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// ScreenScale is concurrent-safe.
|
||||
func ScreenScale() float64 {
|
||||
return ui.ScreenScale()
|
||||
}
|
||||
@ -382,7 +382,7 @@ func ScreenScale() float64 {
|
||||
//
|
||||
// IsCursorVisible always returns false on mobiles.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsCursorVisible is concurrent-safe.
|
||||
func IsCursorVisible() bool {
|
||||
return ui.IsCursorVisible()
|
||||
}
|
||||
@ -391,7 +391,7 @@ func IsCursorVisible() bool {
|
||||
//
|
||||
// SetCursorVisible does nothing on mobiles.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// SetCursorVisible is concurrent-safe.
|
||||
func SetCursorVisible(visible bool) {
|
||||
ui.SetCursorVisible(visible)
|
||||
}
|
||||
@ -406,7 +406,7 @@ func SetCursorVisibility(visible bool) {
|
||||
//
|
||||
// IsFullscreen always returns false on mobiles.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsFullscreen is concurrent-safe.
|
||||
func IsFullscreen() bool {
|
||||
return ui.IsFullscreen()
|
||||
}
|
||||
@ -427,7 +427,7 @@ func IsFullscreen() bool {
|
||||
//
|
||||
// SetFullscreen does nothing on mobiles.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// SetFullscreen is concurrent-safe.
|
||||
func SetFullscreen(fullscreen bool) {
|
||||
ui.SetFullscreen(fullscreen)
|
||||
}
|
||||
@ -435,7 +435,7 @@ func SetFullscreen(fullscreen bool) {
|
||||
// IsRunnableInBackground returns a boolean value indicating whether
|
||||
// the game runs even in background.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsRunnableInBackground is concurrent-safe.
|
||||
func IsRunnableInBackground() bool {
|
||||
return ui.IsRunnableInBackground()
|
||||
}
|
||||
@ -447,7 +447,7 @@ func IsRunnableInBackground() bool {
|
||||
//
|
||||
// SetWindowDecorated panics if SetWindowDecorated is called after Run.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// SetWindowDecorated is concurrent-safe.
|
||||
func SetWindowDecorated(decorated bool) {
|
||||
ui.SetWindowDecorated(decorated)
|
||||
}
|
||||
@ -455,7 +455,7 @@ func SetWindowDecorated(decorated bool) {
|
||||
// IsWindowDecorated returns a boolean value indicating whether
|
||||
// the window is decorated.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// IsWindowDecorated is concurrent-safe.
|
||||
func IsWindowDecorated() bool {
|
||||
return ui.IsWindowDecorated()
|
||||
}
|
||||
@ -470,7 +470,7 @@ func IsWindowDecorated() bool {
|
||||
//
|
||||
// SetRunnableInBackground does nothing on mobiles so far.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// SetRunnableInBackground is concurrent-safe.
|
||||
func SetRunnableInBackground(runnableInBackground bool) {
|
||||
ui.SetRunnableInBackground(runnableInBackground)
|
||||
}
|
||||
@ -503,7 +503,7 @@ func SetWindowTitle(title string) {
|
||||
//
|
||||
// SetWindowIcon doesn't work on browsers or mobiles.
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// SetWindowIcon is concurrent-safe.
|
||||
func SetWindowIcon(iconImages []image.Image) {
|
||||
ui.SetWindowIcon(iconImages)
|
||||
}
|
||||
|
@ -266,12 +266,12 @@ func colorToColorM(clr color.Color) ebiten.ColorM {
|
||||
// clr is the color for text rendering.
|
||||
//
|
||||
// Glyphs used for rendering are cached in least-recently-used way.
|
||||
// It is OK to call this function with a same text and a same face at every frame in terms of performance.
|
||||
// It is OK to call Draw with a same text and a same face at every frame in terms of performance.
|
||||
//
|
||||
// Be careful that the passed font face is held by this package and is never released.
|
||||
// This is a known issue (#498).
|
||||
//
|
||||
// This function is concurrent-safe.
|
||||
// Draw is concurrent-safe.
|
||||
func Draw(dst *ebiten.Image, text string, face font.Face, x, y int, clr color.Color) {
|
||||
textM.Lock()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user