Documentation ¶
Overview ¶
Package gosfml2 provides access to the SFML2 library ( http://www.sfml-dev.org )
Index ¶
- Constants
- Variables
- func BindShader(shader *Shader)
- func BindTexture(texture *Texture)
- func GetMaximumTextureSize() uint
- func IsMouseButtonPressed(button MouseButton) bool
- func JoystickGetAxisPosition(joystick uint, axis JoystickAxis) float32
- func JoystickGetButtonCount(joystick uint) uint
- func JoystickHasAxis(joystick uint, axis JoystickAxis) bool
- func JoystickIsButtonPressed(joystick uint, button uint) bool
- func JoystickIsConnected(joystick uint) bool
- func JoystickUpdate()
- func KeyboardIsKeyPressed(key KeyCode) bool
- func ListenerGetGlobalVolume() float32
- func ListenerSetDirection(direction Vector3f)
- func ListenerSetGlobalVolume(volume float32)
- func ListenerSetPosition(pos Vector3f)
- func ListenerSetUpVector(upVec Vector3f)
- func MouseSetPosition(position Vector2i, relativeTo SystemWindow)
- func ShadersAvailable() bool
- func SoundRecorderIsAvailable() bool
- type BlendEquation
- type BlendFactor
- type BlendMode
- type CircleShape
- func (this *CircleShape) Copy() *CircleShape
- func (this *CircleShape) Draw(target RenderTarget, renderStates RenderStates)
- func (this *CircleShape) GetFillColor() (color Color)
- func (this *CircleShape) GetGlobalBounds() (rect FloatRect)
- func (this *CircleShape) GetInverseTransform() (transform Transform)
- func (this *CircleShape) GetLocalBounds() (rect FloatRect)
- func (this *CircleShape) GetOrigin() (origin Vector2f)
- func (this *CircleShape) GetOutlineColor() (color Color)
- func (this *CircleShape) GetOutlineThickness() float32
- func (this *CircleShape) GetPoint(index uint) (point Vector2f)
- func (this *CircleShape) GetPointCount() uint
- func (this *CircleShape) GetPosition() (position Vector2f)
- func (this *CircleShape) GetRadius() float32
- func (this *CircleShape) GetRotation() float32
- func (this *CircleShape) GetScale() (scale Vector2f)
- func (this *CircleShape) GetTexture() *Texture
- func (this *CircleShape) GetTextureRect() (rect IntRect)
- func (this *CircleShape) GetTransform() (transform Transform)
- func (this *CircleShape) Move(offset Vector2f)
- func (this *CircleShape) Rotate(angle float32)
- func (this *CircleShape) Scale(factor Vector2f)
- func (this *CircleShape) SetFillColor(color Color)
- func (this *CircleShape) SetOrigin(orig Vector2f)
- func (this *CircleShape) SetOutlineColor(color Color)
- func (this *CircleShape) SetOutlineThickness(thickness float32)
- func (this *CircleShape) SetPointCount(count uint)
- func (this *CircleShape) SetPosition(pos Vector2f)
- func (this *CircleShape) SetRadius(radius float32)
- func (this *CircleShape) SetRotation(rot float32)
- func (this *CircleShape) SetScale(scale Vector2f)
- func (this *CircleShape) SetTexture(texture *Texture, resetRect bool)
- func (this *CircleShape) SetTextureRect(rect IntRect)
- type Color
- type Context
- type ContextSettings
- type ConvexShape
- func (this *ConvexShape) Copy() *ConvexShape
- func (this *ConvexShape) Draw(target RenderTarget, renderStates RenderStates)
- func (this *ConvexShape) GetFillColor() (color Color)
- func (this *ConvexShape) GetGlobalBounds() (rect FloatRect)
- func (this *ConvexShape) GetInverseTransform() (transform Transform)
- func (this *ConvexShape) GetLocalBounds() (rect FloatRect)
- func (this *ConvexShape) GetOrigin() (origin Vector2f)
- func (this *ConvexShape) GetOutlineColor() (color Color)
- func (this *ConvexShape) GetOutlineThickness() float32
- func (this *ConvexShape) GetPoint(index uint) (point Vector2f)
- func (this *ConvexShape) GetPointCount() uint
- func (this *ConvexShape) GetPosition() (position Vector2f)
- func (this *ConvexShape) GetRotation() float32
- func (this *ConvexShape) GetScale() (scale Vector2f)
- func (this *ConvexShape) GetTexture() *Texture
- func (this *ConvexShape) GetTextureRect() (rect IntRect)
- func (this *ConvexShape) GetTransform() (transform Transform)
- func (this *ConvexShape) Move(offset Vector2f)
- func (this *ConvexShape) Rotate(angle float32)
- func (this *ConvexShape) Scale(factor Vector2f)
- func (this *ConvexShape) SetFillColor(color Color)
- func (this *ConvexShape) SetOrigin(orig Vector2f)
- func (this *ConvexShape) SetOutlineColor(color Color)
- func (this *ConvexShape) SetOutlineThickness(thickness float32)
- func (this *ConvexShape) SetPoint(index uint, point Vector2f)
- func (this *ConvexShape) SetPointCount(count uint)
- func (this *ConvexShape) SetPosition(pos Vector2f)
- func (this *ConvexShape) SetRotation(rot float32)
- func (this *ConvexShape) SetScale(scale Vector2f)
- func (this *ConvexShape) SetTexture(texture *Texture, resetRect bool)
- func (this *ConvexShape) SetTextureRect(rect IntRect)
- type Drawer
- type Event
- type EventClosed
- type EventGainedFocus
- type EventJoystickButtonPressed
- type EventJoystickButtonReleased
- type EventJoystickConnected
- type EventJoystickDisconnected
- type EventJoystickMoved
- type EventKeyPressed
- type EventKeyReleased
- type EventLostFocus
- type EventMouseButtonPressed
- type EventMouseButtonReleased
- type EventMouseEntered
- type EventMouseLeft
- type EventMouseMoved
- type EventMouseWheelMoved
- type EventResized
- type EventTextEntered
- type EventType
- type FloatRect
- type Font
- func (this *Font) Copy() *Font
- func (this *Font) GetGlyph(codePoint uint, characterSize uint32, bold bool) (glyph Glyph)
- func (this *Font) GetKerning(first uint32, second uint32, characterSize uint) float32
- func (this *Font) GetLineSpacing(characterSize uint) float32
- func (this *Font) GetTexture(characterSize uint) Texture
- type Glyph
- type Image
- func (this *Image) Copy() *Image
- func (this *Image) CopyImage(source *Image, destX, destY uint, sourceRect IntRect, applyAlpha bool)
- func (this *Image) CreateMaskFromColor(color Color, alpha byte)
- func (this *Image) FlipHorizontally()
- func (this *Image) FlipVertically()
- func (this *Image) GetPixel(x, y uint) (color Color)
- func (this *Image) GetPixelData() []byte
- func (this *Image) GetSize() (size Vector2u)
- func (this *Image) SaveToFile(file string) error
- func (this *Image) SetPixel(x, y uint, color Color)
- type IntRect
- type JoystickAxis
- type KeyCode
- type Matrix
- type MouseButton
- type Music
- func (this *Music) GetAttenuation() float32
- func (this *Music) GetChannelCount() uint
- func (this *Music) GetDuration() time.Duration
- func (this *Music) GetMinDistance() float32
- func (this *Music) GetPitch() float32
- func (this *Music) GetPlayingOffset() time.Duration
- func (this *Music) GetPosition() (pos Vector3f)
- func (this *Music) GetSampleRate() uint
- func (this *Music) GetStatus() SoundStatus
- func (this *Music) GetVolume() float32
- func (this *Music) IsRelativeToListner() bool
- func (this *Music) Pause()
- func (this *Music) Play()
- func (this *Music) SetAttenuation(attenuation float32)
- func (this *Music) SetLoop(loop bool)
- func (this *Music) SetMinDistance(distance float32)
- func (this *Music) SetPitch(pitch float32)
- func (this *Music) SetPlayingOffset(offset time.Duration)
- func (this *Music) SetPosition(pos Vector3f)
- func (this *Music) SetRelativeToListener(relative bool)
- func (this *Music) SetVolume(volume float32)
- func (this *Music) Stop()
- type PrimitiveType
- type RectangleShape
- func (this *RectangleShape) Copy() *RectangleShape
- func (this *RectangleShape) Draw(target RenderTarget, renderStates RenderStates)
- func (this *RectangleShape) GetFillColor() (color Color)
- func (this *RectangleShape) GetGlobalBounds() (rect FloatRect)
- func (this *RectangleShape) GetInverseTransform() (transform Transform)
- func (this *RectangleShape) GetLocalBounds() (rect FloatRect)
- func (this *RectangleShape) GetOrigin() (origin Vector2f)
- func (this *RectangleShape) GetOutlineColor() (color Color)
- func (this *RectangleShape) GetOutlineThickness() float32
- func (this *RectangleShape) GetPoint(index uint) (point Vector2f)
- func (this *RectangleShape) GetPointCount() uint
- func (this *RectangleShape) GetPosition() (position Vector2f)
- func (this *RectangleShape) GetRotation() float32
- func (this *RectangleShape) GetScale() (scale Vector2f)
- func (this *RectangleShape) GetSize() (size Vector2f)
- func (this *RectangleShape) GetTexture() *Texture
- func (this *RectangleShape) GetTextureRect() (rect IntRect)
- func (this *RectangleShape) GetTransform() (transform Transform)
- func (this *RectangleShape) Move(offset Vector2f)
- func (this *RectangleShape) Rotate(angle float32)
- func (this *RectangleShape) Scale(factor Vector2f)
- func (this *RectangleShape) SetFillColor(color Color)
- func (this *RectangleShape) SetOrigin(orig Vector2f)
- func (this *RectangleShape) SetOutlineColor(color Color)
- func (this *RectangleShape) SetOutlineThickness(thickness float32)
- func (this *RectangleShape) SetPosition(pos Vector2f)
- func (this *RectangleShape) SetRotation(rot float32)
- func (this *RectangleShape) SetScale(scale Vector2f)
- func (this *RectangleShape) SetSize(size Vector2f)
- func (this *RectangleShape) SetTexture(texture *Texture, resetRect bool)
- func (this *RectangleShape) SetTextureRect(rect IntRect)
- type RenderStates
- type RenderTarget
- type RenderTexture
- func (this *RenderTexture) Clear(color Color)
- func (this *RenderTexture) Display()
- func (this *RenderTexture) Draw(drawer Drawer, renderStates RenderStates)
- func (this *RenderTexture) DrawPrimitives(vertices []Vertex, primType PrimitiveType, renderStates RenderStates)
- func (this *RenderTexture) GetDefaultView() *View
- func (this *RenderTexture) GetSize() (size Vector2u)
- func (this *RenderTexture) GetTexture() *Texture
- func (this *RenderTexture) GetView() *View
- func (this *RenderTexture) GetViewport(view *View) (viewport IntRect)
- func (this *RenderTexture) IsRepeated() bool
- func (this *RenderTexture) IsSmooth() bool
- func (this *RenderTexture) MapCoordsToPixel(pos Vector2f, view *View) (coords Vector2i)
- func (this *RenderTexture) MapPixelToCoords(pos Vector2i, view *View) (coords Vector2f)
- func (this *RenderTexture) PopGLStates()
- func (this *RenderTexture) PushGLStates()
- func (this *RenderTexture) ResetGLStates()
- func (this *RenderTexture) SetActive(active bool)
- func (this *RenderTexture) SetRepeated(repeated bool)
- func (this *RenderTexture) SetSmooth(smooth bool)
- func (this *RenderTexture) SetView(view *View)
- type RenderWindow
- func (this *RenderWindow) Capture() *Image
- func (this *RenderWindow) Clear(color Color)
- func (this *RenderWindow) Close()
- func (this *RenderWindow) Display()
- func (this *RenderWindow) Draw(drawer Drawer, renderStates RenderStates)
- func (this *RenderWindow) DrawPrimitives(vertices []Vertex, primType PrimitiveType, renderStates RenderStates)
- func (this *RenderWindow) GetDefaultView() *View
- func (this *RenderWindow) GetPosition() (pos Vector2i)
- func (this *RenderWindow) GetSettings() (settings ContextSettings)
- func (this *RenderWindow) GetSize() (size Vector2u)
- func (this *RenderWindow) GetView() *View
- func (this *RenderWindow) GetViewport(view *View) (viewport IntRect)
- func (this *RenderWindow) HasFocus() bool
- func (this *RenderWindow) IsOpen() bool
- func (this *RenderWindow) MapCoordsToPixel(pos Vector2f, view *View) (coords Vector2i)
- func (this *RenderWindow) MapPixelToCoords(pos Vector2i, view *View) (coords Vector2f)
- func (this *RenderWindow) PollEvent() Event
- func (this *RenderWindow) PopGLStates()
- func (this *RenderWindow) PushGLStates()
- func (this *RenderWindow) RequestFocus()
- func (this *RenderWindow) ResetGLStates()
- func (this *RenderWindow) SetActive(active bool) bool
- func (this *RenderWindow) SetFramerateLimit(limit uint)
- func (this *RenderWindow) SetIcon(width, height uint, data []byte) error
- func (this *RenderWindow) SetJoystickThreshold(threshold float32)
- func (this *RenderWindow) SetKeyRepeatEnabled(enabled bool)
- func (this *RenderWindow) SetMouseCursorVisible(visible bool)
- func (this *RenderWindow) SetPosition(pos Vector2i)
- func (this *RenderWindow) SetSize(size Vector2u)
- func (this *RenderWindow) SetTitle(title string)
- func (this *RenderWindow) SetVSyncEnabled(enabled bool)
- func (this *RenderWindow) SetView(view *View)
- func (this *RenderWindow) SetVisible(visible bool)
- func (this *RenderWindow) WaitEvent() Event
- type Shader
- func (this *Shader) SetColorParameter(name string, color Color)
- func (this *Shader) SetCurrentTextureParameter(name string)
- func (this *Shader) SetFloatParameter(name string, data ...float32)
- func (this *Shader) SetTextureParameter(name string, texture *Texture)
- func (this *Shader) SetTransformParameter(name string, trans Transform)
- type Sound
- func (this *Sound) Copy() *Sound
- func (this *Sound) GetAttenuation() float32
- func (this *Sound) GetBuffer() *SoundBuffer
- func (this *Sound) GetLoop() bool
- func (this *Sound) GetMinDistance() float32
- func (this *Sound) GetPitch() float32
- func (this *Sound) GetPlayingOffset() time.Duration
- func (this *Sound) GetPosition() (pos Vector3f)
- func (this *Sound) GetStatus() SoundStatus
- func (this *Sound) GetVolume() float32
- func (this *Sound) IsRelativeToListner() bool
- func (this *Sound) Pause()
- func (this *Sound) Play()
- func (this *Sound) SetAttenuation(attenuation float32)
- func (this *Sound) SetBuffer(buffer *SoundBuffer)
- func (this *Sound) SetLoop(loop bool)
- func (this *Sound) SetMinDistance(distance float32)
- func (this *Sound) SetPitch(pitch float32)
- func (this *Sound) SetPlayingOffset(offset time.Duration)
- func (this *Sound) SetPosition(pos Vector3f)
- func (this *Sound) SetRelativeToListener(relative bool)
- func (this *Sound) SetVolume(volume float32)
- func (this *Sound) Stop()
- type SoundBuffer
- func (this *SoundBuffer) Copy() *SoundBuffer
- func (this *SoundBuffer) GetChannelCount() uint
- func (this *SoundBuffer) GetDuration() time.Duration
- func (this *SoundBuffer) GetSampleCount() uint
- func (this *SoundBuffer) GetSampleRate() uint
- func (this *SoundBuffer) GetSamples() []int16
- func (this *SoundBuffer) SaveToFile(file string) error
- type SoundBufferRecorder
- type SoundRecorder
- type SoundRecorderCallbackProgress
- type SoundRecorderCallbackStart
- type SoundRecorderCallbackStop
- type SoundStatus
- type SoundStream
- func (this *SoundStream) GetAttenuation() float32
- func (this *SoundStream) GetChannelCount() uint
- func (this *SoundStream) GetLoop() bool
- func (this *SoundStream) GetMinDistance() float32
- func (this *SoundStream) GetPitch() float32
- func (this *SoundStream) GetPlayingOffset() time.Duration
- func (this *SoundStream) GetPosition() (pos Vector3f)
- func (this *SoundStream) GetSampleRate() uint
- func (this *SoundStream) GetStatus() SoundStatus
- func (this *SoundStream) GetVolume() float32
- func (this *SoundStream) IsRelativeToListener() bool
- func (this *SoundStream) Pause()
- func (this *SoundStream) Play()
- func (this *SoundStream) SetAttenuation(attenuation float32)
- func (this *SoundStream) SetLoop(loop bool)
- func (this *SoundStream) SetMinDistance(distance float32)
- func (this *SoundStream) SetPitch(pitch float32)
- func (this *SoundStream) SetPlayingOffset(offset time.Duration)
- func (this *SoundStream) SetPosition(position Vector3f)
- func (this *SoundStream) SetRelativeToListener(relative bool)
- func (this *SoundStream) SetVolume(volume float32)
- func (this *SoundStream) Stop()
- type SoundStreamDataCallback
- type SoundStreamSeekCallback
- type Sprite
- func (this *Sprite) Copy() *Sprite
- func (this *Sprite) Draw(target RenderTarget, renderStates RenderStates)
- func (this *Sprite) GetColor() (color Color)
- func (this *Sprite) GetGlobalBounds() (rect FloatRect)
- func (this *Sprite) GetInverseTransform() (transform Transform)
- func (this *Sprite) GetLocalBounds() (rect FloatRect)
- func (this *Sprite) GetOrigin() (origin Vector2f)
- func (this *Sprite) GetPosition() (pos Vector2f)
- func (this *Sprite) GetRotation() float32
- func (this *Sprite) GetScale() (scale Vector2f)
- func (this *Sprite) GetTexture() *Texture
- func (this *Sprite) GetTextureRect() (rect IntRect)
- func (this *Sprite) GetTransform() (trans Transform)
- func (this *Sprite) Move(offset Vector2f)
- func (this *Sprite) Rotate(angle float32)
- func (this *Sprite) Scale(factor Vector2f)
- func (this *Sprite) SetColor(color Color)
- func (this *Sprite) SetOrigin(orig Vector2f)
- func (this *Sprite) SetPosition(pos Vector2f)
- func (this *Sprite) SetRotation(rot float32)
- func (this *Sprite) SetScale(scale Vector2f)
- func (this *Sprite) SetTexture(texture *Texture, resetRect bool)
- func (this *Sprite) SetTextureRect(rect IntRect)
- type SystemWindow
- type Text
- func (this *Text) Copy() *Text
- func (this *Text) Draw(target RenderTarget, renderStates RenderStates)
- func (this *Text) FindCharacterPos(index uint) (pos Vector2f)
- func (this *Text) GetCharacterSize() uint
- func (this *Text) GetColor() (color Color)
- func (this *Text) GetFont() *Font
- func (this *Text) GetGlobalBounds() (rect FloatRect)
- func (this *Text) GetInverseTransform() (transform Transform)
- func (this *Text) GetLocalBounds() (rect FloatRect)
- func (this *Text) GetOrigin() (origin Vector2f)
- func (this *Text) GetPosition() (pos Vector2f)
- func (this *Text) GetRotation() float32
- func (this *Text) GetScale() (scale Vector2f)
- func (this *Text) GetString() string
- func (this *Text) GetStyle() TextStyle
- func (this *Text) GetTransform() (trans Transform)
- func (this *Text) Move(offset Vector2f)
- func (this *Text) Rotate(angle float32)
- func (this *Text) Scale(factor Vector2f)
- func (this *Text) SetCharacterSize(size uint)
- func (this *Text) SetColor(color Color)
- func (this *Text) SetFont(font *Font)
- func (this *Text) SetOrigin(orig Vector2f)
- func (this *Text) SetPosition(pos Vector2f)
- func (this *Text) SetRotation(rot float32)
- func (this *Text) SetScale(scale Vector2f)
- func (this *Text) SetString(text string)
- func (this *Text) SetStyle(style TextStyle)
- type TextStyle
- type Texture
- func (this *Texture) Copy() *Texture
- func (this *Texture) CopyToImage() *Image
- func (this *Texture) GetSize() (size Vector2u)
- func (this *Texture) IsRepeated() bool
- func (this *Texture) IsSmooth() bool
- func (this *Texture) SetRepeated(repeated bool)
- func (this *Texture) SetSmooth(smooth bool)
- func (this *Texture) UpdateFromImage(image *Image, x, y uint)
- func (this *Texture) UpdateFromPixels(pixels []byte, width, height, x, y uint)
- func (this *Texture) UpdateFromRenderWindow(window *RenderWindow, x, y uint)
- func (this *Texture) UpdateFromWindow(window *Window, x, y uint)
- type Transform
- func (this *Transform) Combine(other *Transform) *Transform
- func (this *Transform) GetInverse() (inverse Transform)
- func (this *Transform) GetMatrix() (matrix Matrix)
- func (this *Transform) Rotate(angle float32) *Transform
- func (this *Transform) RotateWithCenter(angle, centerX, centerY float32) *Transform
- func (this *Transform) Scale(scaleX, scaleY float32) *Transform
- func (this *Transform) ScaleWithCenter(scaleX, scaleY, centerX, centerY float32) *Transform
- func (this *Transform) TransformPoint(point Vector2f) (tansPoint Vector2f)
- func (this *Transform) TransformRect(rect FloatRect) (tansRect FloatRect)
- func (this *Transform) Translate(x, y float32) *Transform
- type Transformable
- func (this *Transformable) Copy() *Transformable
- func (this *Transformable) GetInverseTransform() (transform Transform)
- func (this *Transformable) GetOrigin() (origin Vector2f)
- func (this *Transformable) GetPosition() (pos Vector2f)
- func (this *Transformable) GetRotation() float32
- func (this *Transformable) GetScale() (scale Vector2f)
- func (this *Transformable) GetTransform() (trans Transform)
- func (this *Transformable) Move(offset Vector2f)
- func (this *Transformable) Rotate(angle float32)
- func (this *Transformable) Scale(factor Vector2f)
- func (this *Transformable) SetOrigin(orig Vector2f)
- func (this *Transformable) SetPosition(pos Vector2f)
- func (this *Transformable) SetRotation(rot float32)
- func (this *Transformable) SetScale(scale Vector2f)
- type Transformer
- type Vector2f
- type Vector2i
- type Vector2u
- type Vector3f
- type Vertex
- type VertexArray
- func (this *VertexArray) Append(vertex Vertex)
- func (this *VertexArray) Clear()
- func (this *VertexArray) Copy() *VertexArray
- func (this *VertexArray) Draw(target RenderTarget, renderStates RenderStates)
- func (this *VertexArray) GetBounds() FloatRect
- func (this *VertexArray) GetVertexCount() int
- func (this *VertexArray) Resize(vertexCount int)
- type VideoMode
- type View
- func (this *View) Copy() *View
- func (this *View) GetCenter() (center Vector2f)
- func (this *View) GetRotation() float32
- func (this *View) GetSize() (size Vector2f)
- func (this *View) GetViewport() (rect FloatRect)
- func (this *View) Move(offset Vector2f)
- func (this *View) Reset(rect FloatRect)
- func (this *View) Rotate(angle float32)
- func (this *View) SetCenter(center Vector2f)
- func (this *View) SetRotation(rotation float32)
- func (this *View) SetSize(size Vector2f)
- func (this *View) SetViewport(viewport FloatRect)
- func (this *View) Zoom(factor float32)
- type Window
- func (this *Window) Close()
- func (this *Window) Display()
- func (this *Window) GetPosition() (pos Vector2i)
- func (this *Window) GetSettings() (settings ContextSettings)
- func (this *Window) GetSize() Vector2u
- func (this *Window) HasFocus() bool
- func (this *Window) IsOpen() bool
- func (this *Window) PollEvent() Event
- func (this *Window) RequestFocus()
- func (this *Window) SetActive(active bool) bool
- func (this *Window) SetFramerateLimit(limit uint)
- func (this *Window) SetIcon(width, height uint, data []byte) error
- func (this *Window) SetJoystickThreshold(threshold float32)
- func (this *Window) SetKeyRepeatEnabled(enabled bool)
- func (this *Window) SetMouseCursorVisible(visible bool)
- func (this *Window) SetPosition(pos Vector2i)
- func (this *Window) SetSize(size Vector2u)
- func (this *Window) SetTitle(title string)
- func (this *Window) SetVSyncEnabled(enabled bool)
- func (this *Window) WaitEvent() Event
- type WindowStyle
Constants ¶
const ( JoystickX = iota ///< The X axis JoystickY ///< The Y axis JoystickZ ///< The Z axis JoystickR ///< The R axis JoystickU ///< The U axis JoystickV ///< The V axis JoystickPovX ///< The X axis of the point-of-view hat JoystickPovY ///< The Y axis of the point-of-view hat )
const ( JoystickCount = C.sfJoystickCount ///< Maximum number of supported joysticks JoystickButtonCount = C.sfJoystickButtonCount ///< Maximum number of supported buttons JoystickAxisCount = C.sfJoystickAxisCount ///< Maximum number of supported axes )
const ( KeyA = iota ///< The A key KeyB ///< The B key KeyC ///< The C key KeyD ///< The D key KeyE ///< The E key KeyF ///< The F key KeyG ///< The G key KeyH ///< The H key KeyI ///< The I key KeyJ ///< The J key KeyK ///< The K key KeyL ///< The L key KeyM ///< The M key KeyN ///< The N key KeyO ///< The O key KeyP ///< The P key KeyQ ///< The Q key KeyR ///< The R key KeyS ///< The S key KeyT ///< The T key KeyU ///< The U key KeyV ///< The V key KeyW ///< The W key KeyX ///< The X key KeyY ///< The Y key KeyZ ///< The Z key KeyNum0 ///< The 0 key KeyNum1 ///< The 1 key KeyNum2 ///< The 2 key KeyNum3 ///< The 3 key KeyNum4 ///< The 4 key KeyNum5 ///< The 5 key KeyNum6 ///< The 6 key KeyNum7 ///< The 7 key KeyNum8 ///< The 8 key KeyNum9 ///< The 9 key KeyEscape ///< The Escape key KeyLControl ///< The left Control key KeyLShift ///< The left Shift key KeyLAlt ///< The left Alt key KeyLSystem ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ... KeyRControl ///< The right Control key KeyRShift ///< The right Shift key KeyRAlt ///< The right Alt key KeyRSystem ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ... KeyMenu ///< The Menu key KeyLBracket ///< The [ key KeyRBracket ///< The ] key KeySemiColon ///< The ; key KeyComma ///< The , key KeyPeriod ///< The . key KeyQuote ///< The ' key KeySlash ///< The / key KeyBackSlash ///< The \ key KeyTilde ///< The ~ key KeyEqual ///< The = key KeyDash ///< The - key KeySpace ///< The Space key KeyReturn ///< The Return key KeyBack ///< The Backspace key KeyTab ///< The Tabulation key KeyPageUp ///< The Page up key KeyPageDown ///< The Page down key KeyEnd ///< The End key KeyHome ///< The Home key KeyInsert ///< The Insert key KeyDelete ///< The Delete key KeyAdd ///< + KeySubtract ///< - KeyMultiply ///< * KeyDivide ///< / KeyLeft ///< Left arrow KeyRight ///< Right arrow KeyUp ///< Up arrow KeyDown ///< Down arrow KeyNumpad0 ///< The numpad 0 key KeyNumpad1 ///< The numpad 1 key KeyNumpad2 ///< The numpad 2 key KeyNumpad3 ///< The numpad 3 key KeyNumpad4 ///< The numpad 4 key KeyNumpad5 ///< The numpad 5 key KeyNumpad6 ///< The numpad 6 key KeyNumpad7 ///< The numpad 7 key KeyNumpad8 ///< The numpad 8 key KeyNumpad9 ///< The numpad 9 key KeyF1 ///< The F1 key KeyF2 ///< The F2 key KeyF3 ///< The F3 key KeyF4 ///< The F4 key KeyF5 ///< The F5 key KeyF6 ///< The F6 key KeyF7 ///< The F7 key KeyF8 ///< The F8 key KeyF9 ///< The F9 key KeyF10 ///< The F10 key KeyF11 ///< The F11 key KeyF12 ///< The F12 key KeyF13 ///< The F13 key KeyF14 ///< The F14 key KeyF15 ///< The F15 key KeyPause ///< The Pause key KeyCount ///< Keep last -- the total number of keyboard keys )
const ( MouseLeft = iota ///< The left mouse button MouseRight ///< The right mouse button MouseMiddle ///< The middle (wheel) mouse button MouseXButton1 ///< The first extra mouse button MouseXButton2 ///< The second extra mouse button MouseButtonCount ///< Keep last -- the total number of mouse buttons )
const ( SoundStatusStopped = iota ///< Sound / music is not playing SoundStatusPaused ///< Sound / music is paused SoundStatusPlaying ///< Sound / music is playing )
Variables ¶
var ( // Pixel = Src * a + Dest * (1 - a) BlendAlpha = BlendMode{ ColorSrcFactor: FactorSrcAlpha, ColorDstFactor: FactorOneMinusSrcAlpha, ColorEquation: EquationAdd, AlphaSrcFactor: FactorOne, AlphaDstFactor: FactorOneMinusSrcAlpha, AlphaEquation: EquationAdd, } // Pixel = Src + Dest BlendAdd = BlendMode{ ColorSrcFactor: FactorSrcAlpha, ColorDstFactor: FactorOne, ColorEquation: EquationAdd, AlphaSrcFactor: FactorOne, AlphaDstFactor: FactorOne, AlphaEquation: EquationAdd, } // Pixel = Src * Dest BlendMultiply = BlendMode{ ColorSrcFactor: FactorDstColor, ColorDstFactor: FactorZero, ColorEquation: EquationAdd, AlphaSrcFactor: FactorDstColor, AlphaDstFactor: FactorZero, AlphaEquation: EquationAdd, } // No blending BlendNone = BlendMode{ ColorSrcFactor: FactorOne, ColorDstFactor: FactorZero, ColorEquation: EquationAdd, AlphaSrcFactor: FactorOne, AlphaDstFactor: FactorZero, AlphaEquation: EquationAdd, } )
Functions ¶
func BindShader ¶
func BindShader(shader *Shader)
Bind a shader for rendering (activate it)
This function is not part of the graphics API, it mustn't be used when drawing SFML entities. It must be used only if you mix sfShader with OpenGL code.
shader: Shader to bind, can be nil to use no shader
func BindTexture ¶
func BindTexture(texture *Texture)
Bind a texture for rendering
This function is not part of the graphics API, it mustn't be used when drawing SFML entities. It must be used only if you mix sfTexture with OpenGL code.
texture: Pointer to the texture to bind, can be nil to use no texture
func IsMouseButtonPressed ¶
func IsMouseButtonPressed(button MouseButton) bool
Check if a mouse button is pressed
button: Button to check
func JoystickGetAxisPosition ¶
func JoystickGetAxisPosition(joystick uint, axis JoystickAxis) float32
Get the current position of a joystick axis
If the joystick is not connected, this function returns 0.
joystick: Index of the joystick axis: Axis to check
return Current position of the axis, in range [-100 .. 100]
func JoystickGetButtonCount ¶
Return the number of buttons supported by a joystick
If the joystick is not connected, this function returns 0.
joystick: Index of the joystick
func JoystickHasAxis ¶
func JoystickHasAxis(joystick uint, axis JoystickAxis) bool
Check if a joystick supports a given axis
If the joystick is not connected, this function returns false.
joystick: Index of the joystick axis: Axis to check
func JoystickIsButtonPressed ¶
Check if a joystick button is pressed
If the joystick is not connected, this function returns false.
joystick: Index of the joystick button: Button to check
func JoystickIsConnected ¶
Check if a joystick is connected
joystick: Index of the joystick to check
func JoystickUpdate ¶
func JoystickUpdate()
Update the states of all joysticks
This function is used internally by SFML, so you normally don't have to call it explicitely. However, you may need to call it if you have no window yet (or no window at all): in this case the joysticks states are not updated automatically.
func ListenerGetGlobalVolume ¶
func ListenerGetGlobalVolume() float32
Get the current value of the global volume
return Current global volume, in the range [0, 100]
func ListenerSetDirection ¶
func ListenerSetDirection(direction Vector3f)
Set the orientation of the forward vector in the scene
The direction (also called "at vector") is the vector pointing forward from the listener's perspective. Together with the up vector, it defines the 3D orientation of the listener in the scene. The direction vector doesn't have to be normalized. The default listener's direction is (0, 0, -1).
direction New listener's direction
func ListenerSetGlobalVolume ¶
func ListenerSetGlobalVolume(volume float32)
Change the global volume of all the sounds and musics
The volume is a number between 0 and 100; it is combined with the individual volume of each sound / music. The default value for the volume is 100 (maximum).
volume: New global volume, in the range [0, 100]
func ListenerSetPosition ¶
func ListenerSetPosition(pos Vector3f)
Set the position of the listener in the scene
The default listener's position is (0, 0, 0).
position: New position of the listener
func ListenerSetUpVector ¶
func ListenerSetUpVector(upVec Vector3f)
Set the upward vector of the listener in the scene
The up vector is the vector that points upward from the listener's perspective. Together with the direction, it defines the 3D orientation of the listener in the scene. The up vector doesn't have to be normalized. The default listener's up vector is (0, 1, 0). It is usually not necessary to change it, especially in 2D scenarios.
upVec New listener's up vector
func MouseSetPosition ¶
func MouseSetPosition(position Vector2i, relativeTo SystemWindow)
Set the current position of the mouse
This function sets the current position of the mouse cursor relative to the given window, or desktop if nil is passed.
position: New position of the mouse relativeTo: Reference window
func ShadersAvailable ¶
func ShadersAvailable() bool
Tell whether or not the system supports shaders
This function should always be called before using the shader features. If it returns false, then any attempt to use shaders will fail.
func SoundRecorderIsAvailable ¶
func SoundRecorderIsAvailable() bool
Check if the system supports audio capture
This function should always be called before using the audio capture features. If it returns false, then any attempt to use SoundRecorder will fail.
Types ¶
type BlendEquation ¶
type BlendEquation C.sfBlendEquation
const ( EquationAdd BlendEquation = C.sfBlendEquationAdd EquationSubtract BlendEquation = C.sfBlendEquationSubtract )
Blend equations
type BlendFactor ¶
type BlendFactor C.sfBlendFactor
const ( FactorZero BlendFactor = C.sfBlendFactorZero ///< (0, 0, 0, 0) FactorOne BlendFactor = C.sfBlendFactorOne ///< (1, 1, 1, 1) FactorSrcColor BlendFactor = C.sfBlendFactorSrcColor ///< (src.r, src.g, src.b, src.a) FactorOneMinusSrcColor BlendFactor = C.sfBlendFactorOneMinusSrcColor ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a) FactorDstColor BlendFactor = C.sfBlendFactorDstColor ///< (dst.r, dst.g, dst.b, dst.a) FactorOneMinusDstColor BlendFactor = C.sfBlendFactorOneMinusDstColor ///< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a) FactorSrcAlpha BlendFactor = C.sfBlendFactorSrcAlpha ///< (src.a, src.a, src.a, src.a) FactorOneMinusSrcAlpha BlendFactor = C.sfBlendFactorOneMinusSrcAlpha ///< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a) FactorDstAlpha BlendFactor = C.sfBlendFactorDstAlpha ///< (dst.a, dst.a, dst.a, dst.a) FactorOneMinusDstAlpha BlendFactor = C.sfBlendFactorOneMinusDstAlpha ///< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a) )
Blend factors
type BlendMode ¶
type BlendMode struct { ColorSrcFactor BlendFactor ///< Source blending factor for the color channels ColorDstFactor BlendFactor ///< Destination blending factor for the color channels ColorEquation BlendEquation ///< Blending equation for the color channels AlphaSrcFactor BlendFactor ///< Source blending factor for the alpha channel AlphaDstFactor BlendFactor ///< Destination blending factor for the alpha channel AlphaEquation BlendEquation ///< Blending equation for the alpha channel }
type CircleShape ¶
type CircleShape struct {
// contains filtered or unexported fields
}
func NewCircleShape ¶
func NewCircleShape() (*CircleShape, error)
Create a new circle shape with a given radius
func (*CircleShape) Copy ¶
func (this *CircleShape) Copy() *CircleShape
Copy an existing circle shape
func (*CircleShape) Draw ¶
func (this *CircleShape) Draw(target RenderTarget, renderStates RenderStates)
Draws a CircleShape on a render target
func (*CircleShape) GetFillColor ¶
func (this *CircleShape) GetFillColor() (color Color)
Get the fill color of a circle shape
func (*CircleShape) GetGlobalBounds ¶
func (this *CircleShape) GetGlobalBounds() (rect FloatRect)
Get the global bounding rectangle of a circle shape
The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.
func (*CircleShape) GetInverseTransform ¶
func (this *CircleShape) GetInverseTransform() (transform Transform)
Get the inverse of the combined transform of a circle shape
func (*CircleShape) GetLocalBounds ¶
func (this *CircleShape) GetLocalBounds() (rect FloatRect)
Get the local bounding rectangle of a circle shape
The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
func (*CircleShape) GetOrigin ¶
func (this *CircleShape) GetOrigin() (origin Vector2f)
Get the local origin of a circle shape
func (*CircleShape) GetOutlineColor ¶
func (this *CircleShape) GetOutlineColor() (color Color)
Get the outline color of a circle shape
func (*CircleShape) GetOutlineThickness ¶
func (this *CircleShape) GetOutlineThickness() float32
Get the outline thickness of a circle shape
func (*CircleShape) GetPoint ¶
func (this *CircleShape) GetPoint(index uint) (point Vector2f)
Get the total number of points of a circle shape
func (*CircleShape) GetPointCount ¶
func (this *CircleShape) GetPointCount() uint
func (*CircleShape) GetPosition ¶
func (this *CircleShape) GetPosition() (position Vector2f)
Get the position of a circle shape
func (*CircleShape) GetRadius ¶
func (this *CircleShape) GetRadius() float32
Get the radius of a circle
func (*CircleShape) GetRotation ¶
func (this *CircleShape) GetRotation() float32
Get the orientation of a circle shape
The rotation is always in the range [0, 360].
func (*CircleShape) GetScale ¶
func (this *CircleShape) GetScale() (scale Vector2f)
Get the current scale of a circle shape
func (*CircleShape) GetTexture ¶
func (this *CircleShape) GetTexture() *Texture
Get the source texture of a circle shape
If the shape has no source texture, nil is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.
func (*CircleShape) GetTextureRect ¶
func (this *CircleShape) GetTextureRect() (rect IntRect)
Get the sub-rectangle of the texture displayed by a circle shape
func (*CircleShape) GetTransform ¶
func (this *CircleShape) GetTransform() (transform Transform)
Get the combined transform of a circle shape
func (*CircleShape) Move ¶
func (this *CircleShape) Move(offset Vector2f)
Move a circle shape by a given offset
This function adds to the current position of the object, unlike CircleShape.SetPosition which overwrites it.
func (*CircleShape) Rotate ¶
func (this *CircleShape) Rotate(angle float32)
Rotate a circle shape
This function adds to the current rotation of the object, unlike CircleShape.SetRotation which overwrites it.
func (*CircleShape) Scale ¶
func (this *CircleShape) Scale(factor Vector2f)
Scale a circle shape
This function multiplies the current scale of the object, unlike CircleShape.SetScale which overwrites it.
func (*CircleShape) SetFillColor ¶
func (this *CircleShape) SetFillColor(color Color)
Set the fill color of a circle shape
This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sfTransparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.
func (*CircleShape) SetOrigin ¶
func (this *CircleShape) SetOrigin(orig Vector2f)
Set the local origin of a circle shape
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a circle Shape object is (0, 0).
func (*CircleShape) SetOutlineColor ¶
func (this *CircleShape) SetOutlineColor(color Color)
Set the outline color of a circle shape
You can use sfTransparent to disable the outline. By default, the shape's outline color is opaque white.
func (*CircleShape) SetOutlineThickness ¶
func (this *CircleShape) SetOutlineThickness(thickness float32)
Set the thickness of a circle shape's outline
This number cannot be negative. Using zero disables the outline. By default, the outline thickness is 0.
func (*CircleShape) SetPointCount ¶
func (this *CircleShape) SetPointCount(count uint)
Set the number of points of a circle
func (*CircleShape) SetPosition ¶
func (this *CircleShape) SetPosition(pos Vector2f)
Set the position of a circle shape
This function completely overwrites the previous position. See sfCircleShape_move to apply an offset based on the previous position instead. The default position of a circle Shape object is (0, 0).
func (*CircleShape) SetRadius ¶
func (this *CircleShape) SetRadius(radius float32)
Set the radius of a circle
func (*CircleShape) SetRotation ¶
func (this *CircleShape) SetRotation(rot float32)
Set the orientation of a circle shape
This function completely overwrites the previous rotation. See sfCircleShape_rotate to add an angle based on the previous rotation instead. The default rotation of a circle Shape object is 0.
func (*CircleShape) SetScale ¶
func (this *CircleShape) SetScale(scale Vector2f)
Set the scale factors of a circle shape
This function completely overwrites the previous scale. See sfCircleShape_scale to add a factor based on the previous scale instead. The default scale of a circle Shape object is (1, 1).
func (*CircleShape) SetTexture ¶
func (this *CircleShape) SetTexture(texture *Texture, resetRect bool)
Change the source texture of a circle shape
texture can be nil to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.
texture: New texture resetRect: Should the texture rect be reset to the size of the new texture?
func (*CircleShape) SetTextureRect ¶
func (this *CircleShape) SetTextureRect(rect IntRect)
Set the sub-rectangle of the texture that a circle shape will display
The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.
type Color ¶
type Color struct { //Created by cgo -godefs - DO NOT EDIT R uint8 //<< Red component G uint8 //<< Green component B uint8 //<< Blue component A uint8 //<< Alpha component (0 = transparent) }
RGBA Color
Color{} represents Color{0,0,0,0} i.e. transparent
func ColorBlack ¶
func ColorBlack() Color
func ColorGreen ¶
func ColorGreen() Color
func ColorMagenta ¶
func ColorMagenta() Color
func ColorTransparent ¶
func ColorTransparent() Color
func ColorWhite ¶
func ColorWhite() Color
func ColorYellow ¶
func ColorYellow() Color
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
Create a new context
This function activates the new context.
type ContextSettings ¶
type ContextSettings struct { DepthBits uint ///< Bits of the depth buffer StencilBits uint ///< Bits of the stencil buffer AntialiasingLevel uint ///< Level of antialiasing MajorVersion uint ///< Major number of the context version to create MinorVersion uint ///< Minor number of the context version to create }
func DefaultContextSettings ¶
func DefaultContextSettings() ContextSettings
type ConvexShape ¶
type ConvexShape struct {
// contains filtered or unexported fields
}
func NewConvexShape ¶
func NewConvexShape() (*ConvexShape, error)
func (*ConvexShape) Copy ¶
func (this *ConvexShape) Copy() *ConvexShape
Copy an existing convex shape
func (*ConvexShape) Draw ¶
func (this *ConvexShape) Draw(target RenderTarget, renderStates RenderStates)
Draws a convex Shape on a render target
func (*ConvexShape) GetFillColor ¶
func (this *ConvexShape) GetFillColor() (color Color)
Get the fill color of a convex shape
func (*ConvexShape) GetGlobalBounds ¶
func (this *ConvexShape) GetGlobalBounds() (rect FloatRect)
Get the global bounding rectangle of a convex shape
The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.
func (*ConvexShape) GetInverseTransform ¶
func (this *ConvexShape) GetInverseTransform() (transform Transform)
Get the inverse of the combined transform of a convex shape
func (*ConvexShape) GetLocalBounds ¶
func (this *ConvexShape) GetLocalBounds() (rect FloatRect)
Get the local bounding rectangle of a convex shape
The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
func (*ConvexShape) GetOrigin ¶
func (this *ConvexShape) GetOrigin() (origin Vector2f)
Get the local origin of a convex shape
func (*ConvexShape) GetOutlineColor ¶
func (this *ConvexShape) GetOutlineColor() (color Color)
Get the outline color of a convex shape
func (*ConvexShape) GetOutlineThickness ¶
func (this *ConvexShape) GetOutlineThickness() float32
Get the outline thickness of a convex shape
func (*ConvexShape) GetPoint ¶
func (this *ConvexShape) GetPoint(index uint) (point Vector2f)
Get a point of a convex shape
The result is undefined if index is out of the valid range.
func (*ConvexShape) GetPointCount ¶
func (this *ConvexShape) GetPointCount() uint
Get the total number of points of a convex shape
func (*ConvexShape) GetPosition ¶
func (this *ConvexShape) GetPosition() (position Vector2f)
Get the position of a convex shape
func (*ConvexShape) GetRotation ¶
func (this *ConvexShape) GetRotation() float32
Get the orientation of a convex shape
func (*ConvexShape) GetScale ¶
func (this *ConvexShape) GetScale() (scale Vector2f)
Get the current scale of a convex shape
func (*ConvexShape) GetTexture ¶
func (this *ConvexShape) GetTexture() *Texture
Get the source texture of a convex shape
If the shape has no source texture, a nil pointer is returned.
func (*ConvexShape) GetTextureRect ¶
func (this *ConvexShape) GetTextureRect() (rect IntRect)
Get the sub-rectangle of the texture displayed by a convex shape
func (*ConvexShape) GetTransform ¶
func (this *ConvexShape) GetTransform() (transform Transform)
Get the combined transform of a convex shape
func (*ConvexShape) Move ¶
func (this *ConvexShape) Move(offset Vector2f)
Move a convex shape by a given offset
This function adds to the current position of the object, unlike ConvexShape.SetPosition which overwrites it.
func (*ConvexShape) Rotate ¶
func (this *ConvexShape) Rotate(angle float32)
Rotate a convex shape
This function adds to the current rotation of the object, unlike ConvexShape.SetRotation which overwrites it.
func (*ConvexShape) Scale ¶
func (this *ConvexShape) Scale(factor Vector2f)
Scale a convex shape
This function multiplies the current scale of the object, unlike ConvexShape.SetScale which overwrites it.
func (*ConvexShape) SetFillColor ¶
func (this *ConvexShape) SetFillColor(color Color)
Set the fill color of a convex shape
This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sfTransparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.
func (*ConvexShape) SetOrigin ¶
func (this *ConvexShape) SetOrigin(orig Vector2f)
Set the local origin of a convex shape
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a circle Shape object is (0, 0).
func (*ConvexShape) SetOutlineColor ¶
func (this *ConvexShape) SetOutlineColor(color Color)
Set the outline color of a convex shape
You can use sfTransparent to disable the outline. By default, the shape's outline color is opaque white.
func (*ConvexShape) SetOutlineThickness ¶
func (this *ConvexShape) SetOutlineThickness(thickness float32)
Set the thickness of a convex shape's outline
This number cannot be negative. Using zero disables the outline. By default, the outline thickness is 0.
func (*ConvexShape) SetPoint ¶
func (this *ConvexShape) SetPoint(index uint, point Vector2f)
Set the position of a point in a convex shape
Don't forget that the polygon must remain convex, and the points need to stay ordered! SetPointCount must be called first in order to set the total number of points. The result is undefined if index is out of the valid range.
func (*ConvexShape) SetPointCount ¶
func (this *ConvexShape) SetPointCount(count uint)
Set the number of points of a convex shap
count must be greater than 2 to define a valid shape.
func (*ConvexShape) SetPosition ¶
func (this *ConvexShape) SetPosition(pos Vector2f)
Set the position of a convex shape
This function completely overwrites the previous position. See sfConvexShape_move to apply an offset based on the previous position instead. The default position of a circle Shape object is (0, 0).
func (*ConvexShape) SetRotation ¶
func (this *ConvexShape) SetRotation(rot float32)
Set the scale factors of a convex shape
This function completely overwrites the previous scale. See sfConvexShape_scale to add a factor based on the previous scale instead. The default scale of a circle Shape object is (1, 1).
func (*ConvexShape) SetScale ¶
func (this *ConvexShape) SetScale(scale Vector2f)
Set the local origin of a convex shape
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a circle Shape object is (0, 0).
func (*ConvexShape) SetTexture ¶
func (this *ConvexShape) SetTexture(texture *Texture, resetRect bool)
Change the source texture of a convex shape
The texture argument can be nil to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.
func (*ConvexShape) SetTextureRect ¶
func (this *ConvexShape) SetTextureRect(rect IntRect)
Set the sub-rectangle of the texture that a convex shape will display
The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.
type Drawer ¶
type Drawer interface {
Draw(target RenderTarget, renderStates RenderStates)
}
Sprite, CircleShape, ConvexShape, RectangleShape, Text and VertexArray are Drawers A Drawer can be drawn on a RenderTarget
type EventClosed ¶
type EventClosed struct{}
The window requested to be closed (no data)
func (EventClosed) Type ¶
func (EventClosed) Type() EventType
type EventGainedFocus ¶
type EventGainedFocus struct{}
The window gained the focus (no data)
func (EventGainedFocus) Type ¶
func (EventGainedFocus) Type() EventType
type EventJoystickButtonPressed ¶
type EventJoystickButtonPressed eventJoystickButton
func (EventJoystickButtonPressed) Type ¶
func (EventJoystickButtonPressed) Type() EventType
type EventJoystickButtonReleased ¶
type EventJoystickButtonReleased eventJoystickButton
func (EventJoystickButtonReleased) Type ¶
func (EventJoystickButtonReleased) Type() EventType
type EventJoystickConnected ¶
type EventJoystickConnected eventJoystickConnection
func (EventJoystickConnected) Type ¶
func (EventJoystickConnected) Type() EventType
type EventJoystickDisconnected ¶
type EventJoystickDisconnected eventJoystickConnection
func (EventJoystickDisconnected) Type ¶
func (EventJoystickDisconnected) Type() EventType
type EventJoystickMoved ¶
type EventJoystickMoved struct { JoystickId uint //< Index of the joystick (in range [0 .. JoystickCount - 1]) Axis JoystickAxis //< Axis on which the joystick moved Position float32 //< New position on the axis (in range [-100 .. 100]) }
func (EventJoystickMoved) Type ¶
func (EventJoystickMoved) Type() EventType
type EventKeyPressed ¶
type EventKeyPressed eventKey
func (EventKeyPressed) Type ¶
func (EventKeyPressed) Type() EventType
type EventKeyReleased ¶
type EventKeyReleased eventKey
func (EventKeyReleased) Type ¶
func (EventKeyReleased) Type() EventType
type EventLostFocus ¶
type EventLostFocus struct{}
The window lost the focus (no data)
func (EventLostFocus) Type ¶
func (EventLostFocus) Type() EventType
type EventMouseButtonPressed ¶
type EventMouseButtonPressed eventMouseButton
func (EventMouseButtonPressed) Type ¶
func (EventMouseButtonPressed) Type() EventType
type EventMouseButtonReleased ¶
type EventMouseButtonReleased eventMouseButton
func (EventMouseButtonReleased) Type ¶
func (EventMouseButtonReleased) Type() EventType
type EventMouseEntered ¶
type EventMouseEntered struct{}
The mouse cursor entered the area of the window (no data)
func (EventMouseEntered) Type ¶
func (EventMouseEntered) Type() EventType
type EventMouseLeft ¶
type EventMouseLeft struct{}
The mouse cursor left the area of the window (no data)
func (EventMouseLeft) Type ¶
func (EventMouseLeft) Type() EventType
type EventMouseMoved ¶
type EventMouseMoved struct { X int //< X position of the mouse pointer, relative to the left of the owner window Y int //< Y position of the mouse pointer, relative to the top of the owner window }
func (EventMouseMoved) Type ¶
func (EventMouseMoved) Type() EventType
type EventMouseWheelMoved ¶
type EventMouseWheelMoved struct { Delta int //< Number of ticks the wheel has moved (positive is up, negative is down) X int //< X position of the mouse pointer, relative to the left of the owner window Y int //< Y position of the mouse pointer, relative to the top of the owner window }
func (EventMouseWheelMoved) Type ¶
func (EventMouseWheelMoved) Type() EventType
type EventResized ¶
type EventResized struct { Width uint //< New width, in pixels Height uint //< New height, in pixels }
func (EventResized) Type ¶
func (EventResized) Type() EventType
type EventTextEntered ¶
type EventTextEntered struct {
Char rune //< Value of the rune
}
func (EventTextEntered) Type ¶
func (EventTextEntered) Type() EventType
type EventType ¶
type EventType int
const ( EventTypeClosed EventType = C.sfEvtClosed EventTypeResized EventType = C.sfEvtResized EventTypeLostFocus EventType = C.sfEvtLostFocus EventTypeGainedFocus EventType = C.sfEvtGainedFocus EventTypeTextEntered EventType = C.sfEvtTextEntered EventTypeKeyPressed EventType = C.sfEvtKeyPressed EventTypeKeyReleased EventType = C.sfEvtKeyReleased EventTypeMouseWheelMoved EventType = C.sfEvtMouseWheelMoved EventTypeMouseButtonPressed EventType = C.sfEvtMouseButtonPressed EventTypeMouseButtonReleased EventType = C.sfEvtMouseButtonReleased EventTypeMouseMoved EventType = C.sfEvtMouseMoved EventTypeMouseEntered EventType = C.sfEvtMouseEntered EventTypeMouseLeft EventType = C.sfEvtMouseLeft EventTypeJoystickButtonPressed EventType = C.sfEvtJoystickButtonPressed EventTypeJoystickButtonReleased EventType = C.sfEvtJoystickButtonReleased EventTypeJoystickMoved EventType = C.sfEvtJoystickMoved EventTypeJoystickConnected EventType = C.sfEvtJoystickConnected EventTypeJoystickDisconnected EventType = C.sfEvtJoystickDisconnected )
type FloatRect ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
func NewFontFromFile ¶
Font constructor Creates a new font from file
The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. Note that this function know nothing about the standard fonts installed on the user's system, thus you can't load them directly.
func NewFontFromMemory ¶
Font constructor Creates a new font from memory
The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42.
func (*Font) GetGlyph ¶
Retrieve a glyph of the font
codePoint: Unicode code point of the character to get characterSize: Reference character size bold: Retrieve the bold version or the regular one?
return The glyph corresponding to codePoint and characterSize
func (*Font) GetKerning ¶
Get the kerning offset of two glyphs
The kerning is an extra offset (negative) to apply between two glyphs when rendering them, to make the pair look more "natural". For example, the pair "AV" have a special kerning to make them closer than other characters. Most of the glyphs pairs have a kerning offset of zero, though.
first: Unicode code point of the first character second: Unicode code point of the second character characterSize: Reference character size
return Kerning value for first and second, in pixels
func (*Font) GetLineSpacing ¶
Get the line spacing
Line spacing is the vertical offset to apply between two consecutive lines of text.
characterSize: Reference character size
return Line spacing, in pixels
func (*Font) GetTexture ¶
Retrieve the texture containing the loaded glyphs of a certain size
The contents of the returned texture changes as more glyphs are requested, thus it is not very relevant.
characterSize: Reference character size
Texture containing the glyphs of the requested size
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
func NewImage ¶
Create an image
This image is filled with black pixels.
width: Width of the image height: Height of the image
func NewImageFromColor ¶
Create an image and fill it with a unique color
width: Width of the image height: Height of the image color: Fill color
func NewImageFromFile ¶
Create an image from a file on disk
The supported image formats are bmp, png, tga, jpg, gif, psd, hdr and pic. Some format options are not supported, like progressive jpeg.
file: Path of the image file to load
func NewImageFromMemory ¶
Create an image from a file in memory
The supported image formats are bmp, png, tga, jpg, gif, psd, hdr and pic. Some format options are not supported, like progressive jpeg.
data: Slice containing the file data
func NewImageFromPixels ¶
Create an image from an array of pixels
The pixel array is assumed to contain 32-bits RGBA pixels, and have the given width and height. If not, this is an undefined behaviour. If pixels is nil, an empty image is created.
width: Width of the image height: Height of the image pixels: Slice of pixels to copy to the image
func (*Image) CopyImage ¶
Copy pixels from an image onto another
This function does a slow pixel copy and should not be used intensively. It can be used to prepare a complex static image from several others, but if you need this kind of feature in real-time you'd better use RenderTexture.
If sourceRect is empty, the whole image is copied. If applyAlpha is set to true, the transparency of source pixels is applied. If it is false, the pixels are copied unchanged with their alpha value.
source: Source image to copy destX: X coordinate of the destination position destY: Y coordinate of the destination position sourceRect: Sub-rectangle of the source image to copy applyAlpha: Should the copy take in account the source transparency?
func (*Image) CreateMaskFromColor ¶
Create a transparency mask from a specified color-key
This function sets the alpha value of every pixel matching the given color to alpha (0 by default), so that they become transparent.
color: Color to make transparent alpha: Alpha value to assign to transparent pixels
func (*Image) FlipHorizontally ¶
func (this *Image) FlipHorizontally()
Flip an image horizontally (left <-> right)
func (*Image) FlipVertically ¶
func (this *Image) FlipVertically()
Flip an image vertically (top <-> bottom)
func (*Image) GetPixel ¶
Get the color of a pixel in an image
This function doesn't check the validity of the pixel coordinates, using out-of-range values will result in an undefined behaviour.
x: X coordinate of pixel to get y: Y coordinate of pixel to get
func (*Image) GetPixelData ¶
Get a slice of pixels of an image
The length of the slice is width * height * 4 (RGBA).
func (*Image) SaveToFile ¶
Save an image to a file on disk
The format of the image is automatically deduced from the extension. The supported image formats are bmp, png, tga and jpg. The destination file is overwritten if it already exists. This function fails if the image is empty.
filename: Path of the file to save
type IntRect ¶
type JoystickAxis ¶
type JoystickAxis int
type MouseButton ¶
type MouseButton int
type Music ¶
type Music struct {
// contains filtered or unexported fields
}
func NewMusicFromFile ¶
Create a new music and load it from a file
/This function doesn't start playing the music (call Music.Play to do so). Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
file: Path of the music file to open
func NewMusicFromMemory ¶
Create a new music and load it from a file in memory
This function doesn't start playing the music (call Music.Play to do so). Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
data: Slice of files data
func (*Music) GetAttenuation ¶
Get the attenuation factor of a music
func (*Music) GetChannelCount ¶
Return the number of channels of a music
1 channel means a mono sound, 2 means stereo, etc
func (*Music) GetDuration ¶
Get the total duration of a music
func (*Music) GetMinDistance ¶
Get the minimum distance of a music
func (*Music) GetPlayingOffset ¶
Get the current playing position of a music
func (*Music) GetPosition ¶
Get the 3D position of a music in the audio scene
func (*Music) GetSampleRate ¶
Get the sample rate of a music
The sample rate is the number of audio samples played per second. The higher, the better the quality.
func (*Music) GetStatus ¶
func (this *Music) GetStatus() SoundStatus
Get the current status of a music (stopped, paused, playing)
func (*Music) IsRelativeToListner ¶
Tell whether a music's position is relative to the listener or is absolute
func (*Music) Pause ¶
func (this *Music) Pause()
Pause a music
This function pauses the music if it was playing, otherwise (music already paused or stopped) it has no effect.
func (*Music) Play ¶
func (this *Music) Play()
Start or resume playing a music
This function starts the music if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the music is played.
func (*Music) SetAttenuation ¶
Set the attenuation factor of a music
The attenuation is a multiplicative factor which makes the music more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated music, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the music fade out very quickly as it gets further from the listener. The default value of the attenuation is 1.
attenuation: New attenuation factor of the music
func (*Music) SetLoop ¶
Set whether or not a music should loop after reaching the end
If set, the music will restart from beginning after reaching the end and so on, until it is stopped or Music.SetLoop(false) is called. The default looping state for musics is false.
loop: true to play in loop, false to play once
func (*Music) SetMinDistance ¶
Set the minimum distance of a music
The "minimum distance" of a music is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1.
distance: New minimum distance of the music
func (*Music) SetPitch ¶
Set the pitch of a music
The pitch represents the perceived fundamental frequency of a sound; thus you can make a music more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the music as well. The default value for the pitch is 1.
pitch: New pitch to apply to the music
func (*Music) SetPlayingOffset ¶
Change the current playing position of a music
The playing position can be changed when the music is either paused or playing.
timeOffset: New playing position
func (*Music) SetPosition ¶
Set the 3D position of a music in the audio scene
Only musics with one channel (mono musics) can be spatialized. The default position of a music is (0, 0, 0).
position: Position of the music in the scene
func (*Music) SetRelativeToListener ¶
Make a musics's position relative to the listener or absolute
Making a music relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized musics, musics that are produced by the listener, or musics attached to it. The default value is false (position is absolute).
relative: true to set the position relative, false to set it absolute
type PrimitiveType ¶
type PrimitiveType int
const ( PrimitivePoints PrimitiveType = C.sfPoints ///< List of individual points PrimitiveLines PrimitiveType = C.sfLines ///< List of individual lines PrimitiveLinesStrip PrimitiveType = C.sfLinesStrip ///< List of connected lines, a point uses the previous point to form a line PrimitiveTriangles PrimitiveType = C.sfTriangles ///< List of individual triangles PrimitiveTrianglesStrip PrimitiveType = C.sfTrianglesStrip ///< List of connected triangles, a point uses the two previous points to form a triangle PrimitiveTrianglesFan PrimitiveType = C.sfTrianglesFan ///< List of connected triangles, a point uses the common center and the previous point to form a triangle PrimitiveQuads PrimitiveType = C.sfQuads ///< List of individual quads )
type RectangleShape ¶
type RectangleShape struct {
// contains filtered or unexported fields
}
func NewRectangleShape ¶
func NewRectangleShape() (*RectangleShape, error)
Create a new rectangle shape
func (*RectangleShape) Copy ¶
func (this *RectangleShape) Copy() *RectangleShape
Copy an existing rectangle shape
func (*RectangleShape) Draw ¶
func (this *RectangleShape) Draw(target RenderTarget, renderStates RenderStates)
Draws a RectangleShape on a render target
func (*RectangleShape) GetFillColor ¶
func (this *RectangleShape) GetFillColor() (color Color)
Set the fill color of a rectangle shape
This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sfTransparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.
color: New color of the shape
func (*RectangleShape) GetGlobalBounds ¶
func (this *RectangleShape) GetGlobalBounds() (rect FloatRect)
Get the global bounding rectangle of a rectangle shape
The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.
func (*RectangleShape) GetInverseTransform ¶
func (this *RectangleShape) GetInverseTransform() (transform Transform)
Get the inverse of the combined transform of a rectangle shape
func (*RectangleShape) GetLocalBounds ¶
func (this *RectangleShape) GetLocalBounds() (rect FloatRect)
Get the local bounding rectangle of a rectangle shape
The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
func (*RectangleShape) GetOrigin ¶
func (this *RectangleShape) GetOrigin() (origin Vector2f)
Get the local origin of a rectangle shape
func (*RectangleShape) GetOutlineColor ¶
func (this *RectangleShape) GetOutlineColor() (color Color)
Get the outline color of a rectangle shape
func (*RectangleShape) GetOutlineThickness ¶
func (this *RectangleShape) GetOutlineThickness() float32
Get the outline thickness of a rectangle shape
func (*RectangleShape) GetPoint ¶
func (this *RectangleShape) GetPoint(index uint) (point Vector2f)
Get a point of a rectangle shape
The result is undefined if index is out of the valid range.
index: Index of the point to get, in range [0 .. GetPointCount() - 1]
func (*RectangleShape) GetPointCount ¶
func (this *RectangleShape) GetPointCount() uint
Get the total number of points of a rectangle shape
func (*RectangleShape) GetPosition ¶
func (this *RectangleShape) GetPosition() (position Vector2f)
Get the position of a rectangle shape
func (*RectangleShape) GetRotation ¶
func (this *RectangleShape) GetRotation() float32
Get the orientation of a rectangle shape
The rotation is always in the range [0, 360].
func (*RectangleShape) GetScale ¶
func (this *RectangleShape) GetScale() (scale Vector2f)
Get the current scale of a rectangle shap
func (*RectangleShape) GetSize ¶
func (this *RectangleShape) GetSize() (size Vector2f)
Get the size of a rectangle shape
func (*RectangleShape) GetTexture ¶
func (this *RectangleShape) GetTexture() *Texture
Get the source texture of a rectangle shape
If the shape has no source texture, a nil pointer is returned.
func (*RectangleShape) GetTextureRect ¶
func (this *RectangleShape) GetTextureRect() (rect IntRect)
Get the sub-rectangle of the texture displayed by a rectangle shape
func (*RectangleShape) GetTransform ¶
func (this *RectangleShape) GetTransform() (transform Transform)
Get the combined transform of a rectangle shape
func (*RectangleShape) Move ¶
func (this *RectangleShape) Move(offset Vector2f)
Move a rectangle shape by a given offset
This function adds to the current position of the object, unlike RectangleShape.SetPosition which overwrites it.
func (*RectangleShape) Rotate ¶
func (this *RectangleShape) Rotate(angle float32)
Rotate a rectangle shape
This function adds to the current rotation of the object, unlike RectangleShape.SetRotation which overwrites it.
func (*RectangleShape) Scale ¶
func (this *RectangleShape) Scale(factor Vector2f)
Scale a rectangle shape
This function multiplies the current scale of the object, unlike RectangleShape.SetScale which overwrites it.
func (*RectangleShape) SetFillColor ¶
func (this *RectangleShape) SetFillColor(color Color)
Set the fill color of a rectangle shape
This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sfTransparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.
color: New color of the shape
func (*RectangleShape) SetOrigin ¶
func (this *RectangleShape) SetOrigin(orig Vector2f)
Set the local origin of a rectangle shape
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a circle Shape object is (0, 0).
origin: New origin
func (*RectangleShape) SetOutlineColor ¶
func (this *RectangleShape) SetOutlineColor(color Color)
Set the outline color of a rectangle shape
You can use sfTransparent to disable the outline. By default, the shape's outline color is opaque white.
color: New outline color of the shape
func (*RectangleShape) SetOutlineThickness ¶
func (this *RectangleShape) SetOutlineThickness(thickness float32)
Set the thickness of a rectangle shape's outline
This number cannot be negative. Using zero disables the outline. By default, the outline thickness is 0.
thickness: New outline thickness
func (*RectangleShape) SetPosition ¶
func (this *RectangleShape) SetPosition(pos Vector2f)
Set the position of a rectangle shape
This function completely overwrites the previous position. See sfRectangleShape_move to apply an offset based on the previous position instead. The default position of a circle Shape object is (0, 0).
position: New position
func (*RectangleShape) SetRotation ¶
func (this *RectangleShape) SetRotation(rot float32)
Set the orientation of a rectangle shape
This function completely overwrites the previous rotation. See sfRectangleShape_rotate to add an angle based on the previous rotation instead. The default rotation of a circle Shape object is 0.
angle: New rotation, in degrees
func (*RectangleShape) SetScale ¶
func (this *RectangleShape) SetScale(scale Vector2f)
Set the scale factors of a rectangle shape
This function completely overwrites the previous scale. See sfRectangleShape_scale to add a factor based on the previous scale instead. The default scale of a circle Shape object is (1, 1).
scale: New scale factors
func (*RectangleShape) SetSize ¶
func (this *RectangleShape) SetSize(size Vector2f)
Set the size of a rectangle shape
func (*RectangleShape) SetTexture ¶
func (this *RectangleShape) SetTexture(texture *Texture, resetRect bool)
Change the source texture of a rectangle shape
texture can be nil to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.
texture: New texture resetRect: Should the texture rect be reset to the size of the new texture?
func (*RectangleShape) SetTextureRect ¶
func (this *RectangleShape) SetTextureRect(rect IntRect)
Set the sub-rectangle of the texture that a rectangle shape will display
The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.
rect: Rectangle defining the region of the texture to display
type RenderStates ¶
type RenderStates struct { BlendMode BlendMode Transform Transform Shader *Shader Texture *Texture }
func DefaultRenderStates ¶
func DefaultRenderStates() RenderStates
type RenderTarget ¶
type RenderTarget interface { Clear(Color) Display() SetView(*View) GetView() *View GetDefaultView() *View GetViewport(view *View) IntRect MapPixelToCoords(Vector2i, *View) Vector2f MapCoordsToPixel(Vector2f, *View) Vector2i PushGLStates() PopGLStates() ResetGLStates() GetSize() Vector2u Draw(Drawer, RenderStates) DrawPrimitives([]Vertex, PrimitiveType, RenderStates) }
RenderTexture and RenderWindow are RenderTargets
type RenderTexture ¶
type RenderTexture struct {
// contains filtered or unexported fields
}
func NewRenderTexture ¶
func NewRenderTexture(width, height uint, depthbuffer bool) (*RenderTexture, error)
Construct a new render texture
width: Width of the render texture height: Height of the render texture depthBuffer: Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the rendertexture)
func (*RenderTexture) Clear ¶
func (this *RenderTexture) Clear(color Color)
Clear the rendertexture with the given color
color: Fill color
func (*RenderTexture) Display ¶
func (this *RenderTexture) Display()
Update the contents of the target texture
func (*RenderTexture) Draw ¶
func (this *RenderTexture) Draw(drawer Drawer, renderStates RenderStates)
Draws a RectangleShape on a render target
func (*RenderTexture) DrawPrimitives ¶
func (this *RenderTexture) DrawPrimitives(vertices []Vertex, primType PrimitiveType, renderStates RenderStates)
Draw primitives defined by a slice of vertices
func (*RenderTexture) GetDefaultView ¶
func (this *RenderTexture) GetDefaultView() *View
Get the default view of a render texture
func (*RenderTexture) GetSize ¶
func (this *RenderTexture) GetSize() (size Vector2u)
Get the size of the rendering region of a render texture
func (*RenderTexture) GetTexture ¶
func (this *RenderTexture) GetTexture() *Texture
Get the target texture of a render texture
func (*RenderTexture) GetView ¶
func (this *RenderTexture) GetView() *View
Get the current active view of a render texture
func (*RenderTexture) GetViewport ¶
func (this *RenderTexture) GetViewport(view *View) (viewport IntRect)
Get the viewport of a view applied to this target
view: Target view
func (*RenderTexture) IsRepeated ¶
func (this *RenderTexture) IsRepeated() bool
Tell whether the texture is repeated or not
func (*RenderTexture) IsSmooth ¶
func (this *RenderTexture) IsSmooth() bool
Tell whether the smooth filter is enabled or not for a render texture
func (*RenderTexture) MapCoordsToPixel ¶
func (this *RenderTexture) MapCoordsToPixel(pos Vector2f, view *View) (coords Vector2i)
Convert a point from world coordinates to texture coordinates
This function finds the pixel of the render-texture that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.
Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-texture, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-texture -- if the view is translated by (140, 25).
This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-texture.
point: Point to convert view: The view to use for converting the point
func (*RenderTexture) MapPixelToCoords ¶
func (this *RenderTexture) MapPixelToCoords(pos Vector2i, view *View) (coords Vector2f)
Convert a point from texture coordinates to world coordinates
This function finds the 2D position that matches the given pixel of the render-texture. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.
Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-texture, this assertion is not true anymore, ie. a point located at (10, 50) in your render-texture may map to the point (150, 75) in your 2D world -- if the view is translated by (140, 25).
This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-texture.
point: Pixel to convert view: The view to use for converting the point
func (*RenderTexture) PopGLStates ¶
func (this *RenderTexture) PopGLStates()
Restore the previously saved OpenGL render states and matrices
See the description of pushGLStates to get a detailed description of these functions.
func (*RenderTexture) PushGLStates ¶
func (this *RenderTexture) PushGLStates()
Save the current OpenGL render states and matrices
This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with popGLStates, it ensures that: SFML's internal states are not messed up by your OpenGL code your OpenGL states are not modified by a call to a SFML function
Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the resetGLStates function if you do so.
func (*RenderTexture) ResetGLStates ¶
func (this *RenderTexture) ResetGLStates()
Reset the internal OpenGL states so that the target is ready for drawing
This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use pushGLStates/popGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent RenderTexture.Draw calls will work as expected.
func (*RenderTexture) SetActive ¶
func (this *RenderTexture) SetActive(active bool)
Activate or deactivate a render texture as the current target for rendering
active: true to activate, false to deactivate
func (*RenderTexture) SetRepeated ¶
func (this *RenderTexture) SetRepeated(repeated bool)
Enable or disable texture repeating
repeated: true to enable repeating, false to disable it
func (*RenderTexture) SetSmooth ¶
func (this *RenderTexture) SetSmooth(smooth bool)
Enable or disable the smooth filter on a render texture
smooth: true to enable smoothing, false to disable it
func (*RenderTexture) SetView ¶
func (this *RenderTexture) SetView(view *View)
Change the current active view of a render texture
view: Pointer to the new view
type RenderWindow ¶
type RenderWindow struct {
// contains filtered or unexported fields
}
func NewRenderWindow ¶
func NewRenderWindow(videoMode VideoMode, title string, style WindowStyle, contextSettings ContextSettings) (window *RenderWindow)
Construct a new render window
mode: Video mode to use title: Title of the window style: Window style contextSettings: Creation settings
func (*RenderWindow) Capture ¶
func (this *RenderWindow) Capture() *Image
Copy the current contents of a render window to an image
his is a slow operation, whose main purpose is to make screenshots of the application. If you want to update an image with the contents of the window and then use it for drawing, you should rather use a sfTexture and its update(sfWindow*) function. You can also draw things directly to a texture with the sfRenderWindow class.
return New image containing the captured contents
func (*RenderWindow) Clear ¶
func (this *RenderWindow) Clear(color Color)
Clear a render window with the given color
color: Fill color
func (*RenderWindow) Close ¶
func (this *RenderWindow) Close()
Close a render window (but doesn't destroy the internal data)
func (*RenderWindow) Display ¶
func (this *RenderWindow) Display()
Display a render window on screen
func (*RenderWindow) Draw ¶
func (this *RenderWindow) Draw(drawer Drawer, renderStates RenderStates)
Draw a drawable object to the render-target
func (*RenderWindow) DrawPrimitives ¶
func (this *RenderWindow) DrawPrimitives(vertices []Vertex, primType PrimitiveType, renderStates RenderStates)
Draw primitives defined by a slice of vertices
func (*RenderWindow) GetDefaultView ¶
func (this *RenderWindow) GetDefaultView() *View
Get the default view of a render window
func (*RenderWindow) GetPosition ¶
func (this *RenderWindow) GetPosition() (pos Vector2i)
Get the position of a render window
func (*RenderWindow) GetSettings ¶
func (this *RenderWindow) GetSettings() (settings ContextSettings)
Get the creation settings of a render window
func (*RenderWindow) GetSize ¶
func (this *RenderWindow) GetSize() (size Vector2u)
Get the size of the rendering region of a render window
func (*RenderWindow) GetView ¶
func (this *RenderWindow) GetView() *View
Get the current active view of a render window
func (*RenderWindow) GetViewport ¶
func (this *RenderWindow) GetViewport(view *View) (viewport IntRect)
Get the viewport of a view applied to this target
view: Target view
func (*RenderWindow) HasFocus ¶
func (this *RenderWindow) HasFocus() bool
Check whether the render window has the input focus
At any given time, only one window may have the input focus to receive input events such as keystrokes or most mouse events.
True if window has focus, false otherwise
func (*RenderWindow) IsOpen ¶
func (this *RenderWindow) IsOpen() bool
Tell whether or not a render window is opened
func (*RenderWindow) MapCoordsToPixel ¶
func (this *RenderWindow) MapCoordsToPixel(pos Vector2f, view *View) (coords Vector2i)
Convert a point from world coordinates to window coordinates
This function finds the pixel of the render-window that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.
Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-window, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-window -- if the view is translated by (140, 25).
This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-window.
point Point to convert view The view to use for converting the point
return The converted point, in target coordinates (pixels)
func (*RenderWindow) MapPixelToCoords ¶
func (this *RenderWindow) MapPixelToCoords(pos Vector2i, view *View) (coords Vector2f)
Convert a point from window coordinates to world coordinates
This function finds the 2D position that matches the given pixel of the render-window. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.
Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-window, this assertion is not true anymore, ie. a point located at (10, 50) in your render-window may map to the point (150, 75) in your 2D world -- if the view is translated by (140, 25).
This function is typically used to find which point (or object) is located below the mouse cursor.
This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-window.
point: Pixel to convert view: The view to use for converting the point
return The converted point, in "world" units
func (*RenderWindow) PollEvent ¶
func (this *RenderWindow) PollEvent() Event
Get the event on top of event queue of a render window, if any, and pop it
returns nil if there are no events left.
func (*RenderWindow) PopGLStates ¶
func (this *RenderWindow) PopGLStates()
Restore the previously saved OpenGL render states and matrices
See the description of pushGLStates to get a detailed description of these functions.
func (*RenderWindow) PushGLStates ¶
func (this *RenderWindow) PushGLStates()
Save the current OpenGL render states and matrices
This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with PopGLStates, it ensures that: SFML's internal states are not messed up by your OpenGL code your OpenGL states are not modified by a call to a SFML function
Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the ResetGLStates function if you do so.
func (*RenderWindow) RequestFocus ¶
func (this *RenderWindow) RequestFocus()
Request the current render window to be made the active foreground window
At any given time, only one window may have the input focus to receive input events such as keystrokes or mouse events. If a window requests focus, it only hints to the operating system, that it would like to be focused. The operating system is free to deny the request. This is not to be confused with RenderWindow.SetActive().
func (*RenderWindow) ResetGLStates ¶
func (this *RenderWindow) ResetGLStates()
Reset the internal OpenGL states so that the target is ready for drawing
This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use PushGLStates/PopGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent RenderWindow.Draw calls will work as expected.
func (*RenderWindow) SetActive ¶
func (this *RenderWindow) SetActive(active bool) bool
Activate or deactivate a render window as the current target for rendering
active: true to activate, false to deactivate
return True if operation was successful, false otherwise
func (*RenderWindow) SetFramerateLimit ¶
func (this *RenderWindow) SetFramerateLimit(limit uint)
Limit the framerate to a maximum fixed frequency for a render window
limit: Framerate limit, in frames per seconds (use 0 to disable limit)
func (*RenderWindow) SetIcon ¶
func (this *RenderWindow) SetIcon(width, height uint, data []byte) error
Change a render window's icon
width: Icon's width, in pixels height: Icon's height, in pixels pixels: Slice of pixels, format must be RGBA 32 bits
func (*RenderWindow) SetJoystickThreshold ¶
func (this *RenderWindow) SetJoystickThreshold(threshold float32)
Change the joystick threshold, ie. the value below which no move event will be generated
threshold: New threshold, in range [0, 100]
func (*RenderWindow) SetKeyRepeatEnabled ¶
func (this *RenderWindow) SetKeyRepeatEnabled(enabled bool)
Enable or disable automatic key-repeat
If key repeat is enabled, you will receive repeated KeyPress events while keeping a key pressed. If it is disabled, you will only get a single event when the key is pressed.
Key repeat is enabled by default.
func (*RenderWindow) SetMouseCursorVisible ¶
func (this *RenderWindow) SetMouseCursorVisible(visible bool)
Show or hide the mouse cursor on a render window
visible: true to show, false to hide
func (*RenderWindow) SetPosition ¶
func (this *RenderWindow) SetPosition(pos Vector2i)
Change the position of a render window on screen
Only works for top-level windows
pos: New position, in pixels
func (*RenderWindow) SetSize ¶
func (this *RenderWindow) SetSize(size Vector2u)
Change the size of the rendering region of a render window
size: New size, in pixels
func (*RenderWindow) SetTitle ¶
func (this *RenderWindow) SetTitle(title string)
Change the title of a render window
title: New title
func (*RenderWindow) SetVSyncEnabled ¶
func (this *RenderWindow) SetVSyncEnabled(enabled bool)
Enable / disable vertical synchronization on a render window
enabled: true to enable v-sync, false to deactivate
func (*RenderWindow) SetView ¶
func (this *RenderWindow) SetView(view *View)
Change the current active view of a render window
view: Pointer to the new view
func (*RenderWindow) SetVisible ¶
func (this *RenderWindow) SetVisible(visible bool)
Show or hide a render window
visible: true to show the window, false to hide it
func (*RenderWindow) WaitEvent ¶
func (this *RenderWindow) WaitEvent() Event
Wait for an event and return it
type Shader ¶
type Shader struct {
// contains filtered or unexported fields
}
func NewShaderFromFile ¶
func NewShaderFromFile(vertexShaderFile, geometryShaderFile, fragmentShaderFile string) (*Shader, error)
Load both the vertex and fragment shaders from files
This function can load both the vertex and the fragment shaders, or only one of them: pass "" (empty string) if you don't want to load either the vertex shader or the fragment shader. The sources must be text files containing valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.
vertexShaderFile: Path of the vertex shader file to load, or "" to skip this shader fragmentShaderFile: Path of the fragment shader file to load, or "" to skip this shader
func NewShaderFromMemory ¶
Load both the vertex and fragment shaders from source codes in memory
This function can load both the vertex and the fragment shaders, or only one of them: pass "" (empty string) if you don't want to load either the vertex shader or the fragment shader. The sources must be valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.
vertexShader: String containing the source code of the vertex shader, or "" to skip this shader fragmentShader: String containing the source code of the fragment shader, or "" to skip this shader
func (*Shader) SetColorParameter ¶
Change a color parameter of a shader
name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 4x1 vector (vec4 GLSL type).
It is important to note that the components of the color are normalized before being passed to the shader. Therefore, they are converted from range [0 .. 255] to range [0 .. 1]. For example, a sf::Color(255, 125, 0, 255) will be transformed to a vec4(1.0, 0.5, 0.0, 1.0) in the shader.
name: Name of the parameter in the shader color: Color to assign
func (*Shader) SetCurrentTextureParameter ¶
Change a texture parameter of a shader
This function maps a shader texture variable to the texture of the object being drawn, which cannot be known in advance. The corresponding parameter in the shader must be a 2D texture (sampler2D GLSL type).
name: Name of the texture in the shader
func (*Shader) SetFloatParameter ¶
Change a n-components vector parameter of a shader
name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a n x 1 vector with n = 1 ... 4.
func (*Shader) SetTextureParameter ¶
Change a texture parameter of a shader
name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 2D texture (sampler2D GLSL type).
name: Name of the texture in the shader texture: Texture to assign
func (*Shader) SetTransformParameter ¶
Change a matrix parameter of a shader
name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 4x4 matrix (mat4 GLSL type).
name: Name of the parameter in the shader transform: Transform to assign
type Sound ¶
type Sound struct {
// contains filtered or unexported fields
}
func NewSound ¶
func NewSound(buffer *SoundBuffer) *Sound
Create a new sound with a given SoundBuffer
func (*Sound) GetAttenuation ¶
Get the attenuation factor of a sound
func (*Sound) GetBuffer ¶
func (this *Sound) GetBuffer() *SoundBuffer
Get the audio buffer attached to a sound
func (*Sound) GetMinDistance ¶
Get the minimum distance of a sound
func (*Sound) GetPlayingOffset ¶
Get the current playing position of a sound
func (*Sound) GetPosition ¶
Get the 3D position of a sound in the audio scene
func (*Sound) GetStatus ¶
func (this *Sound) GetStatus() SoundStatus
Get the current status of a sound (stopped, paused, playing)
func (*Sound) IsRelativeToListner ¶
Tell whether a sound's position is relative to the listener or is absolute
func (*Sound) Pause ¶
func (this *Sound) Pause()
Pause a sound
This function pauses the sound if it was playing, otherwise (sound already paused or stopped) it has no effect.
func (*Sound) Play ¶
func (this *Sound) Play()
Start or resume playing a sound
This function starts the sound if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the sound is played.
func (*Sound) SetAttenuation ¶
Set the attenuation factor of a sound
The attenuation is a multiplicative factor which makes the sound more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated sound, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the sound fade out very quickly as it gets further from the listener. The default value of the attenuation is 1.
func (*Sound) SetBuffer ¶
func (this *Sound) SetBuffer(buffer *SoundBuffer)
Set the source buffer containing the audio data to play
func (*Sound) SetLoop ¶
Set whether or not a sound should loop after reaching the end
If set, the sound will restart from beginning after reaching the end and so on, until it is stopped or Sound.SetLoop(false) is called. The default looping state for sounds is false.
func (*Sound) SetMinDistance ¶
Set the minimum distance of a sound
The "minimum distance" of a sound is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1.
func (*Sound) SetPitch ¶
Set the pitch of a sound
The pitch represents the perceived fundamental frequency of a sound; thus you can make a sound more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the sound as well. The default value for the pitch is 1.
func (*Sound) SetPlayingOffset ¶
Change the current playing position of a sound
The playing position can be changed when the sound is either paused or playing.
func (*Sound) SetPosition ¶
Set the 3D position of a sound in the audio scene
Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).
func (*Sound) SetRelativeToListener ¶
Make the sound's position relative to the listener or absolute
Making a sound relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized sounds, sounds that are produced by the listener, or sounds attached to it. The default value is false (position is absolute).
type SoundBuffer ¶
type SoundBuffer struct {
// contains filtered or unexported fields
}
func NewSoundBufferFromFile ¶
func NewSoundBufferFromFile(file string) (*SoundBuffer, error)
Create a new sound buffer and load it from a file
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
func NewSoundBufferFromMemory ¶
func NewSoundBufferFromMemory(data []byte) (*SoundBuffer, error)
Create a new sound buffer and load it from a file in memory
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
data: Slice of file data
func NewSoundBufferFromSamples ¶
func NewSoundBufferFromSamples(samples []int16, channelCount, sampleRate uint) (*SoundBuffer, error)
Create a new sound buffer and load it from an array of samples in memory
The assumed format of the audio samples is 16 bits signed integer (int16).
samples: Slice of samples channelCount: Number of channels (1 = mono, 2 = stereo, ...) sampleRate: Sample rate (number of samples to play per second)
func (*SoundBuffer) Copy ¶
func (this *SoundBuffer) Copy() *SoundBuffer
Create a new sound buffer by copying an existing one
func (*SoundBuffer) GetChannelCount ¶
func (this *SoundBuffer) GetChannelCount() uint
Get the number of channels used by a sound buffer
If the sound is mono then the number of channels will be 1, 2 for stereo, etc.
func (*SoundBuffer) GetDuration ¶
func (this *SoundBuffer) GetDuration() time.Duration
Get the total duration of a sound buffer
func (*SoundBuffer) GetSampleCount ¶
func (this *SoundBuffer) GetSampleCount() uint
Get the number of samples stored in a sound buffer
The array of samples can be accessed with the SoundBuffer.GetSamples function.
func (*SoundBuffer) GetSampleRate ¶
func (this *SoundBuffer) GetSampleRate() uint
Get the sample rate of a sound buffer
The sample rate is the number of samples played per second. The higher, the better the quality (for example, 44100 samples/s is CD quality).
func (*SoundBuffer) GetSamples ¶
func (this *SoundBuffer) GetSamples() []int16
Get the slice of audio samples stored in a sound buffer
The format of the returned samples is 16 bits signed integer (int16).
func (*SoundBuffer) SaveToFile ¶
func (this *SoundBuffer) SaveToFile(file string) error
Save a sound buffer to an audio file
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
file: Path of the sound file to write
type SoundBufferRecorder ¶
type SoundBufferRecorder struct {
// contains filtered or unexported fields
}
func NewSoundBufferRecorder ¶
func NewSoundBufferRecorder() (*SoundBufferRecorder, error)
/ Create a new sound buffer recorder
func (*SoundBufferRecorder) GetBuffer ¶
func (this *SoundBufferRecorder) GetBuffer() *SoundBuffer
Get the sound buffer containing the captured audio data
The sound buffer is valid only after the capture has ended.
func (*SoundBufferRecorder) GetSampleRate ¶
func (this *SoundBufferRecorder) GetSampleRate() uint
Get the sample rate of a sound buffer recorder
The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).
func (*SoundBufferRecorder) Start ¶
func (this *SoundBufferRecorder) Start(sampleRate uint)
Start the capture of a sound recorder recorder
The sampleRate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn't block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.
soundBufferRecorder Sound buffer recorder object sampleRate Desired capture rate, in number of samples per second
func (*SoundBufferRecorder) Stop ¶
func (this *SoundBufferRecorder) Stop()
Stop the capture of a sound recorder
type SoundRecorder ¶
type SoundRecorder struct {
// contains filtered or unexported fields
}
func NewSoundRecorder ¶
func NewSoundRecorder(onStart SoundRecorderCallbackStart, onProgress SoundRecorderCallbackProgress, onStop SoundRecorderCallbackStop, userData interface{}) (*SoundRecorder, error)
Construct a new sound recorder from callback functions
onStart Callback function which will be called when a new capture starts (can be nil) onProcess Callback function which will be called each time there's audio data to process (cannot be nil) onStop Callback function which will be called when the current capture stops (can be nil)
userData Data to pass to the callback function (can be nil)
func (*SoundRecorder) GetSampleRate ¶
func (this *SoundRecorder) GetSampleRate() uint
Get the sample rate of a sound recorder
The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).
func (*SoundRecorder) SetProcessingInterval ¶
func (this *SoundRecorder) SetProcessingInterval(interval time.Duration)
Set the processing interval
The processing interval controls the period between calls to the onProcessSamples function. You may want to use a small interval if you want to process the recorded data in real time, for example.
Note: this is only a hint, the actual period may vary. So don't rely on this parameter to implement precise timing.
The default processing interval is 100 ms.
interval Processing interval
func (*SoundRecorder) Start ¶
func (this *SoundRecorder) Start(sampleRate uint)
The sampleRate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn't block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.
sampleRate Desired capture rate, in number of samples per second
type SoundRecorderCallbackStart ¶
type SoundRecorderCallbackStart func(userData interface{}) bool
type SoundRecorderCallbackStop ¶
type SoundRecorderCallbackStop func(userData interface{})
type SoundStatus ¶
type SoundStatus int
type SoundStream ¶
type SoundStream struct {
// contains filtered or unexported fields
}
func NewSoundStream ¶
func NewSoundStream(onGetData SoundStreamDataCallback, onSeek SoundStreamSeekCallback, channelCount, sampleRate uint, userData interface{}) (*SoundStream, error)
Create a new sound stream
onGetData Function called when the stream needs more data (can't be nil) onSeek Function called when the stream seeks (can't be nil) channelCount Number of channels to use (1 = mono, 2 = stereo) sampleRate Sample rate of the sound (44100 = CD quality) userData Data to pass to the callback function (can be nil)
func (*SoundStream) GetAttenuation ¶
func (this *SoundStream) GetAttenuation() float32
Get the attenuation factor of a sound stream
func (*SoundStream) GetChannelCount ¶
func (this *SoundStream) GetChannelCount() uint
Return the number of channels of a sound stream
1 channel means a mono sound, 2 means stereo, etc.
func (*SoundStream) GetLoop ¶
func (this *SoundStream) GetLoop() bool
Tell whether or not a sound stream is in loop mode
func (*SoundStream) GetMinDistance ¶
func (this *SoundStream) GetMinDistance() float32
Get the minimum distance of a sound stream
func (*SoundStream) GetPitch ¶
func (this *SoundStream) GetPitch() float32
Get the pitch of a sound stream
func (*SoundStream) GetPlayingOffset ¶
func (this *SoundStream) GetPlayingOffset() time.Duration
Get the current playing position of a sound stream
func (*SoundStream) GetPosition ¶
func (this *SoundStream) GetPosition() (pos Vector3f)
Get the 3D position of a sound stream in the audio scene
func (*SoundStream) GetSampleRate ¶
func (this *SoundStream) GetSampleRate() uint
Get the sample rate of a sound stream
The sample rate is the number of audio samples played per second. The higher, the better the quality.
func (*SoundStream) GetStatus ¶
func (this *SoundStream) GetStatus() SoundStatus
Get the current status of a sound stream (stopped, paused, playing)
func (*SoundStream) GetVolume ¶
func (this *SoundStream) GetVolume() float32
Get the volume of a sound stream, in the range [0, 100]
func (*SoundStream) IsRelativeToListener ¶
func (this *SoundStream) IsRelativeToListener() bool
Tell whether a sound stream's position is relative to the listener or is absolute
func (*SoundStream) Pause ¶
func (this *SoundStream) Pause()
Pause a sound stream
This function pauses the stream if it was playing, otherwise (stream already paused or stopped) it has no effect.
func (*SoundStream) Play ¶
func (this *SoundStream) Play()
Start or resume playing a sound stream
This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the music is played.
func (*SoundStream) SetAttenuation ¶
func (this *SoundStream) SetAttenuation(attenuation float32)
Set the attenuation factor of a sound stream
The attenuation is a multiplicative factor which makes the stream more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated stream, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the stream fade out very quickly as it gets further from the listener. The default value of the attenuation is 1.
func (*SoundStream) SetLoop ¶
func (this *SoundStream) SetLoop(loop bool)
Set whether or not a sound stream should loop after reaching the end
If set, the stream will restart from beginning after reaching the end and so on, until it is stopped or SoundStream.SetLoop(false) is called. The default looping state for sound streams is false.
func (*SoundStream) SetMinDistance ¶
func (this *SoundStream) SetMinDistance(distance float32)
Set the minimum distance of a sound stream
The "minimum distance" of a stream is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1.
func (*SoundStream) SetPitch ¶
func (this *SoundStream) SetPitch(pitch float32)
Set the pitch of a sound stream
The pitch represents the perceived fundamental frequency of a sound; thus you can make a stream more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the stream as well. The default value for the pitch is 1.
func (*SoundStream) SetPlayingOffset ¶
func (this *SoundStream) SetPlayingOffset(offset time.Duration)
Change the current playing position of a sound stream
The playing position can be changed when the stream is either paused or playing.
func (*SoundStream) SetPosition ¶
func (this *SoundStream) SetPosition(position Vector3f)
Set the 3D position of a sound stream in the audio scene
Only streams with one channel (mono streams) can be spatialized. The default position of a stream is (0, 0, 0).
func (*SoundStream) SetRelativeToListener ¶
func (this *SoundStream) SetRelativeToListener(relative bool)
Make a sound stream's position relative to the listener or absolute
Making a stream relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized streams, streams that are produced by the listener, or streams attached to it. The default value is false (position is absolute).
func (*SoundStream) SetVolume ¶
func (this *SoundStream) SetVolume(volume float32)
Set the volume of a sound stream
The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100.
func (*SoundStream) Stop ¶
func (this *SoundStream) Stop()
Stop playing a sound stream
This function stops the stream if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike SoundStream.Pause).
type SoundStreamDataCallback ¶
type SoundStreamSeekCallback ¶
type Sprite ¶
type Sprite struct {
// contains filtered or unexported fields
}
func (*Sprite) Draw ¶
func (this *Sprite) Draw(target RenderTarget, renderStates RenderStates)
Draws a RectangleShape on a render target
func (*Sprite) GetGlobalBounds ¶
Get the global bounding rectangle of a sprite
The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.
func (*Sprite) GetInverseTransform ¶
Get the inverse of the combined transform of a sprite
func (*Sprite) GetLocalBounds ¶
Get the local bounding rectangle of a sprite
The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
func (*Sprite) GetPosition ¶
Get the position of a sprite
func (*Sprite) GetRotation ¶
Get the orientation of a sprite
The rotation is always in the range [0, 360].
func (*Sprite) GetTexture ¶
Get the source texture of a sprite
If the sprite has no source texture, nil is returned.
func (*Sprite) GetTextureRect ¶
Get the sub-rectangle of the texture displayed by a sprite
func (*Sprite) GetTransform ¶
Get the combined transform of a sprite
func (*Sprite) Move ¶
Move a sprite by a given offset
This function adds to the current position of the object, unlike Sprite.SetPosition which overwrites it.
func (*Sprite) Rotate ¶
Rotate a sprite
This function adds to the current rotation of the object, unlike Sprite.SetRotation which overwrites it.
func (*Sprite) Scale ¶
Scale a sprite
This function multiplies the current scale of the object, unlike Sprite.SetScale which overwrites it.
func (*Sprite) SetColor ¶
Set the global color of a sprite
This color is modulated (multiplied) with the sprite's texture. It can be used to colorize the sprite, or change its global opacity. By default, the sprite's color is opaque white.
func (*Sprite) SetOrigin ¶
Set the local origin of a sprite
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a sprite Sprite object is (0, 0).
func (*Sprite) SetPosition ¶
Set the position of a sprite
This function completely overwrites the previous position. See Sprite.Move to apply an offset based on the previous position instead. The default position of a sprite Sprite object is (0, 0).
func (*Sprite) SetRotation ¶
Set the orientation of a sprite
This function completely overwrites the previous rotation. See Sprite.Rotate to add an angle based on the previous rotation instead. The default rotation of a sprite Sprite object is 0.
func (*Sprite) SetScale ¶
Set the scale factors of a sprite
This function completely overwrites the previous scale. See sfSprite_scale to add a factor based on the previous scale instead. The default scale of a sprite Sprite object is (1, 1).
func (*Sprite) SetTexture ¶
Change the source texture of a sprite
The texture argument refers to a texture that must exist as long as the sprite uses it. Indeed, the sprite doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the sprite tries to use it, the behaviour is undefined. If resetRect is true, the TextureRect property of the sprite is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.
texture: New texture resetRect: Should the texture rect be reset to the size of the new texture?
func (*Sprite) SetTextureRect ¶
Set the sub-rectangle of the texture that a sprite will display
The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.
rect: Rectangle defining the region of the texture to display
type SystemWindow ¶
type SystemWindow interface { SetVSyncEnabled(bool) SetFramerateLimit(uint) SetJoystickThreshold(float32) SetKeyRepeatEnabled(bool) Display() IsOpen() bool Close() SetTitle(string) SetIcon(uint, uint, []byte) error SetMouseCursorVisible(bool) SetActive(bool) bool }
Window and RenderWindow are SystemWindows
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
func (*Text) Draw ¶
func (this *Text) Draw(target RenderTarget, renderStates RenderStates)
Draws a Text on a render target
func (*Text) FindCharacterPos ¶
Return the position of the index-th character in a text
This function computes the visual position of a character from its index in the string. The returned position is in global coordinates (translation, rotation, scale and origin are applied). If index is out of range, the position of the end of the string is returned.
func (*Text) GetCharacterSize ¶
Get the size of the characters of a text
func (*Text) GetFont ¶
Get the font used by a text
If the text has no font attached, a nil pointer is returned.
func (*Text) GetGlobalBounds ¶
Get the global bounding rectangle of a text
The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the text in the global 2D world's coordinate system.
func (*Text) GetInverseTransform ¶
Get the inverse of the combined transform of a text
func (*Text) GetLocalBounds ¶
Get the local bounding rectangle of a text
The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
func (*Text) GetPosition ¶
Get the position of a text
func (*Text) GetRotation ¶
Get the orientation of a text
The rotation is always in the range [0, 360].
func (*Text) GetTransform ¶
Get the combined transform of a text
func (*Text) Move ¶
Move a text by a given offset
This function adds to the current position of the object, unlike Text.SetPosition which overwrites it.
offset: Offset
func (*Text) Rotate ¶
Rotate a text
This function adds to the current rotation of the object, unlike Text.SetRotation which overwrites it.
angle: Angle of rotation, in degrees
func (*Text) Scale ¶
Scale a text
This function multiplies the current scale of the object, unlike Text.SetScale which overwrites it.
factor: Scale factors
func (*Text) SetColor ¶
Set the global color of a text
By default, the text's color is opaque white.
func (*Text) SetOrigin ¶
Set the local origin of a text
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a text object is (0, 0).
origin: New origin
func (*Text) SetPosition ¶
Set the position of a text
This function completely overwrites the previous position. See Text.Move to apply an offset based on the previous position instead. The default position of a text Text object is (0, 0).
position: New position
func (*Text) SetRotation ¶
Set the orientation of a text
This function completely overwrites the previous rotation. See sfText_rotate to add an angle based on the previous rotation instead. The default rotation of a text Text object is 0.
rot: New rotation, in degrees
func (*Text) SetScale ¶
Set the scale factors of a text
This function completely overwrites the previous scale. See Text.Scale to add a factor based on the previous scale instead. The default scale of a text Text object is (1, 1).
scale: New scale factors
type TextStyle ¶
type TextStyle int
const ( TextRegular TextStyle = C.sfTextRegular ///< Regular characters, no style TextBold TextStyle = C.sfTextBold ///< Characters are bold TextItalic TextStyle = C.sfTextItalic ///< Characters are in italic TextUnderlined TextStyle = C.sfTextUnderlined ///< Characters are underlined TextStrikeThrough TextStyle = C.sfTextStrikeThrough ///< Strike through characters )
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
func NewTextureFromFile ¶
Create a new texture from an image
file: Path of the image file to load area: Area of the source image to load (nil to load the entire image)
func NewTextureFromImage ¶
Create a new texture from an image
image: Image to upload to the texture area: Area of the source image to load (nil to load the entire image)
func NewTextureFromMemory ¶
Create a new texture from a file in memory
data: Slice containing the file data area: Area of the source image to load (nil to load the entire image)
func (*Texture) CopyToImage ¶
Copy a texture's pixels to an image
func (*Texture) IsRepeated ¶
Tell whether a texture is repeated or not
func (*Texture) SetRepeated ¶
Enable or disable repeating for a texture
Repeating is involved when using texture coordinates outside the texture rectangle [0, 0, width, height]. In this case, if repeat mode is enabled, the whole texture will be repeated as many times as needed to reach the coordinate (for example, if the X texture coordinate is 3 * width, the texture will be repeated 3 times). If repeat mode is disabled, the "extra space" will instead be filled with border pixels. Warning: on very old graphics cards, white pixels may appear when the texture is repeated. With such cards, repeat mode can be used reliably only if the texture has power-of-two dimensions (such as 256x128). Repeating is disabled by default.
func (*Texture) UpdateFromImage ¶
Update a texture from an image
image: Image to copy to the texture x: X offset in the texture where to copy the source pixels y: Y offset in the texture where to copy the source pixels
func (*Texture) UpdateFromPixels ¶
Update a texture from an array of pixels
pixels: Slice of pixels to copy to the texture width: Width of the pixel region contained in pixels height: Height of the pixel region contained in pixels x: X offset in the texture where to copy the source pixels y: Y offset in the texture where to copy the source pixels
func (*Texture) UpdateFromRenderWindow ¶
func (this *Texture) UpdateFromRenderWindow(window *RenderWindow, x, y uint)
Update a texture from the contents of a render-window
renderWindow: Render-window to copy to the texture x: X offset in the texture where to copy the source pixels y: Y offset in the texture where to copy the source pixels
func (*Texture) UpdateFromWindow ¶
Update a texture from the contents of a window
window: Window to copy to the texture x: X offset in the texture where to copy the source pixels y: Y offset in the texture where to copy the source pixels
type Transform ¶
type Transform [9]float32
func TransformIdentity ¶
func TransformIdentity() Transform
func (*Transform) Combine ¶
Combine two transforms
Mathematically, it is equivalent to a matrix multiplication.
func (*Transform) GetInverse ¶
Return the inverse of a transform
If the inverse cannot be computed, a new identity transform is returned.
func (*Transform) GetMatrix ¶
Return the 4x4 matrix of a transform
This function fills an array of 16 floats with the transform converted as a 4x4 matrix, which is directly compatible with OpenGL functions.
func (*Transform) Rotate ¶
Combine the current transform with a rotation
angle: Rotation angle, in degrees
func (*Transform) RotateWithCenter ¶
Combine the current transform with a rotation
The center of rotation is provided for convenience as a second argument, so that you can build rotations around arbitrary points more easily (and efficiently) than the usual [translate(-center), rotate(angle), translate(center)].
angle: Rotation angle, in degrees centerX: X coordinate of the center of rotation centerY: Y coordinate of the center of rotation
func (*Transform) Scale ¶
Combine the current transform with a scaling
scaleX: Scaling factor on the X axis scaleY: Scaling factor on the Y axis
func (*Transform) ScaleWithCenter ¶
Combine the current transform with a scaling
The center of scaling is provided for convenience as a second argument, so that you can build scaling around arbitrary points more easily (and efficiently) than the usual [translate(-center), scale(factors), translate(center)]
scaleX: Scaling factor on X axis scaleY: Scaling factor on Y axis centerX: X coordinate of the center of scaling centerY: Y coordinate of the center of scaling
func (*Transform) TransformRect ¶
Apply a transform to a rectangle
Since SFML doesn't provide support for oriented rectangles, the result of this function is always an axis-aligned rectangle. Which means that if the transform contains a rotation, the bounding rectangle of the transformed rectangle is returned.
rect: Rectangle to transform
type Transformable ¶
type Transformable struct {
// contains filtered or unexported fields
}
func (*Transformable) Copy ¶
func (this *Transformable) Copy() *Transformable
Copy an existing transformable
func (*Transformable) GetInverseTransform ¶
func (this *Transformable) GetInverseTransform() (transform Transform)
Get the inverse of the combined transform of a transformable
func (*Transformable) GetOrigin ¶
func (this *Transformable) GetOrigin() (origin Vector2f)
Get the local origin of a transformable
func (*Transformable) GetPosition ¶
func (this *Transformable) GetPosition() (pos Vector2f)
Get the position of a transformable
func (*Transformable) GetRotation ¶
func (this *Transformable) GetRotation() float32
Get the orientation of a transformable
The rotation is always in the range [0, 360].
func (*Transformable) GetScale ¶
func (this *Transformable) GetScale() (scale Vector2f)
Get the current scale of a transformable
func (*Transformable) GetTransform ¶
func (this *Transformable) GetTransform() (trans Transform)
Get the combined transform of a transformable
func (*Transformable) Move ¶
func (this *Transformable) Move(offset Vector2f)
Move a transformable by a given offset
This function adds to the current position of the object, unlike Transformable.SetPosition which overwrites it.
offset: Offset
func (*Transformable) Rotate ¶
func (this *Transformable) Rotate(angle float32)
Rotate a transformable
This function adds to the current rotation of the object, unlike Transformable.SetRotation which overwrites it.
angle: Angle of rotation, in degrees
func (*Transformable) Scale ¶
func (this *Transformable) Scale(factor Vector2f)
Scale a transformable
This function multiplies the current scale of the object, unlike Transformable.SetScale which overwrites it.
factors: Scale factors
func (*Transformable) SetOrigin ¶
func (this *Transformable) SetOrigin(orig Vector2f)
Set the local origin of a transformable
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable Transformable object is (0, 0).
origin: New origin
func (*Transformable) SetPosition ¶
func (this *Transformable) SetPosition(pos Vector2f)
Set the position of a transformable
This function completely overwrites the previous position. See Transformable.Move to apply an offset based on the previous position instead. The default position of a transformable Transformable object is (0, 0).
position: New position
func (*Transformable) SetRotation ¶
func (this *Transformable) SetRotation(rot float32)
Set the orientation of a transformable
This function completely overwrites the previous rotation. See Transformable.Rotate to add an angle based on the previous rotation instead. The default rotation of a transformable Transformable object is 0.
angle: New rotation, in degrees
func (*Transformable) SetScale ¶
func (this *Transformable) SetScale(scale Vector2f)
Set the scale factors of a transformable
This function completely overwrites the previous scale. See Transformable.Scale to add a factor based on the previous scale instead. The default scale of a transformable Transformable object is (1, 1).
scale: New scale factors
type Transformer ¶
type Transformer interface { SetPosition(Vector2f) SetScale(Vector2f) SetRotation(float32) SetOrigin(Vector2f) GetRotation() float32 GetPosition() Vector2f GetScale() Vector2f GetOrigin() Vector2f Move(Vector2f) Scale(Vector2f) Rotate(float32) GetTransform() Transform GetInverseTransform() Transform }
type Vector2f ¶
type Vector2f struct {
X, Y float32
}
type Vector2i ¶
type Vector2i struct {
X, Y int
}
func MouseGetPosition ¶
func MouseGetPosition(relativeTo SystemWindow) (pos Vector2i)
Get the current position of the mouse
This function returns the current position of the mouse cursor relative to the given window, or desktop if nil is passed.
relativeTo: Reference window
type Vector2u ¶
type Vector2u struct {
X, Y uint
}
type Vector3f ¶
type Vector3f struct {
X, Y, Z float32
}
func ListenerGetDirection ¶
func ListenerGetDirection() (direction Vector3f)
Get the listener's forward vector (not normalized)
func ListenerGetPosition ¶
func ListenerGetPosition() (pos Vector3f)
Get the current position of the listener in the scene
func ListenerGetUpVector ¶
func ListenerGetUpVector() (upVec Vector3f)
Get the current upward vector of the listener in the scene
type VertexArray ¶
type VertexArray struct { Vertices []Vertex PrimitiveType PrimitiveType }
func (*VertexArray) Append ¶
func (this *VertexArray) Append(vertex Vertex)
Add a vertex to a vertex array array
vertex: Vertex to add
Note: You may want to specify the vertex color - otherwise the newly added vertex will be invisible
example: vertexArray.Append(Vertex{Position: Vector2f{}, Color: ColorWhite})
func (*VertexArray) Clear ¶
func (this *VertexArray) Clear()
Clear a vertex array
This function removes all the vertices from the array. It doesn't deallocate the corresponding memory, so that adding new vertices after clearing doesn't involve reallocating all the memory.
func (*VertexArray) Copy ¶
func (this *VertexArray) Copy() *VertexArray
Copy an existing vertex array
func (*VertexArray) Draw ¶
func (this *VertexArray) Draw(target RenderTarget, renderStates RenderStates)
Draws a VertexArray on a render target
Note: Use RenderTarget.DrawPrimitives to draw only a subset of its vertices
func (*VertexArray) GetBounds ¶
func (this *VertexArray) GetBounds() FloatRect
Compute the bounding rectangle of a vertex array
This function returns the axis-aligned rectangle that contains all the vertices of the array
func (*VertexArray) GetVertexCount ¶
func (this *VertexArray) GetVertexCount() int
Return the vertex count of a vertex array
func (*VertexArray) Resize ¶
func (this *VertexArray) Resize(vertexCount int)
Resize the vertex array
If vertexCount is greater than the current size, the previous vertices are kept and new (default-constructed i.e. Vertex.Color is set to white) vertices are added. If vertexCount is less than the current size, existing vertices are removed from the array.
vertexCount: New size of the array (number of vertices)
type VideoMode ¶
type VideoMode struct { Width uint ///< Video mode width, in pixels Height uint ///< Video mode height, in pixels BitsPerPixel uint ///< Video mode pixel depth, in bits per pixels }
func GetDesktopVideoMode ¶
func GetDesktopVideoMode() (videoMode VideoMode)
Get the current desktop video mode
func GetFullscreenModes ¶
func GetFullscreenModes() []VideoMode
Retrieve all the video modes supported in fullscreen mode
When creating a fullscreen window, the video mode is restricted to be compatible with what the graphics driver and monitor support. This function returns the complete list of all video modes that can be used in fullscreen mode. The returned array is sorted from best to worst, so that the first element will always give the best mode (higher width, height and bits-per-pixel).
Slice containing all the supported fullscreen modes
type View ¶
type View struct {
// contains filtered or unexported fields
}
func NewView ¶
func NewView() *View
Create a default view
This function creates a default view of (0, 0, 1000, 1000)
func NewViewFromRect ¶
Construct a view from a rectangle
rect: Rectangle defining the zone to display
func (*View) GetRotation ¶
Get the current orientation of a view
func (*View) GetViewport ¶
Get the target viewport rectangle of a view
func (*View) Reset ¶
Reset a view to the given rectangle
Note that this function resets the rotation angle to 0.
rect: Rectangle defining the zone to display
func (*View) Rotate ¶
Rotate a view relatively to its current orientation
angle: Angle to rotate, in degrees
func (*View) SetRotation ¶
Set the orientation of a view
The default rotation of a view is 0 degree.
rotation: New angle, in degrees
func (*View) SetViewport ¶
Set the target viewport of a view
The viewport is the rectangle into which the contents of the view are displayed, expressed as a factor (between 0 and 1) of the size of the render target to which the view is applied. For example, a view which takes the left side of the target would be defined by a rect of (0, 0, 0.5, 1). By default, a view has a viewport which covers the entire target.
viewport: New viewport rectangle
func (*View) Zoom ¶
Resize a view rectangle relatively to its current size
Resizing the view simulates a zoom, as the zone displayed on screen grows or shrinks.
factor is a multiplier:
1 keeps the size unchanged > 1 makes the view bigger (objects appear smaller) < 1 makes the view smaller (objects appear bigger) factor: Zoom factor to apply
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
func NewWindow ¶
func NewWindow(videoMode VideoMode, title string, style WindowStyle, contextSettings ContextSettings) (window *Window)
Construct a new window
videoMode: Video mode to use title: Title of the window style: Window style contextSettings: Creation settings (pass nil to use default values)
func (*Window) Close ¶
func (this *Window) Close()
Close a window (but doesn't destroy the internal data)
func (*Window) GetPosition ¶
Get the position of a render window
func (*Window) GetSettings ¶
func (this *Window) GetSettings() (settings ContextSettings)
Get the creation settings of a window
func (*Window) HasFocus ¶
Check whether the window has the input focus
At any given time, only one window may have the input focus to receive input events such as keystrokes or most mouse events.
True if window has focus, false otherwise
func (*Window) PollEvent ¶
Get the event on top of event queue of a window, if any, and pop it
returns nil if there are no events left.
func (*Window) RequestFocus ¶
func (this *Window) RequestFocus()
Request the current window to be made the active foreground window
At any given time, only one window may have the input focus to receive input events such as keystrokes or mouse events. If a window requests focus, it only hints to the operating system, that it would like to be focused. The operating system is free to deny the request. This is not to be confused with Window.SetActive().
func (*Window) SetActive ¶
Activate or deactivate a window as the current target for rendering
active: true to activate, false to deactivate
return True if operation was successful, false otherwise
func (*Window) SetFramerateLimit ¶
Limit the framerate to a maximum fixed frequency for a window
limit: Framerate limit, in frames per seconds (use 0 to disable limit)
func (*Window) SetIcon ¶
Change a window's icon
width: Icon's width, in pixels height: Icon's height, in pixels pixels: Slice of pixels, format must be RGBA 32 bits
func (*Window) SetJoystickThreshold ¶
/Change the joystick threshold, ie. the value below which no move event will be generated
threshold: New threshold, in range [0, 100]
func (*Window) SetKeyRepeatEnabled ¶
Enable or disable automatic key-repeat
If key repeat is enabled, you will receive repeated KeyPress events while keeping a key pressed. If it is disabled, you will only get a single event when the key is pressed.
Key repeat is enabled by default.
func (*Window) SetMouseCursorVisible ¶
Show or hide the mouse cursor on a window
visible: true to show, false to hide
func (*Window) SetPosition ¶
Change the position of a window on screen
Only works for top-level windows
pos: New position, in pixels
func (*Window) SetSize ¶
Change the size of the rendering region of a window
size: New size, in pixels
func (*Window) SetVSyncEnabled ¶
Enable / disable vertical synchronization on a window
enabled: true to enable v-sync, false to deactivate
type WindowStyle ¶
type WindowStyle int
const ( StyleNone WindowStyle = C.sfNone ///< No border / title bar (this flag and all others are mutually exclusive) StyleTitlebar WindowStyle = C.sfTitlebar ///< Title bar + fixed border StyleResize WindowStyle = C.sfResize ///< Titlebar + resizable border + maximize button StyleClose WindowStyle = C.sfClose ///< Titlebar + close button StyleFullscreen WindowStyle = C.sfFullscreen ///< Fullscreen mode (this flag and all others are mutually exclusive) StyleDefault WindowStyle = C.sfDefaultStyle ///< Default window style )
Source Files ¶
- cgo.go
- circleShape.go
- color.go
- context.go
- contextSettings.go
- convexShape.go
- doc.go
- drawer.go
- event.go
- font.go
- glyph.go
- helpers.go
- image.go
- joystick.go
- keyboard.go
- listener.go
- mouse.go
- music.go
- rect.go
- rectangleShape.go
- renderStates.go
- renderTarget.go
- renderTexture.go
- renderWindow.go
- shader.go
- sound.go
- soundBuffer.go
- soundBufferRecorder.go
- soundRecorder.go
- soundRecorderCallbacks.go
- soundStream.go
- soundStreamCallbacks.go
- sprite.go
- text.go
- texture.go
- transform.go
- transformable.go
- vector.go
- vertexArray.go
- videoMode.go
- view.go
- window.go