sfml

package module
v0.0.0-...-0ff82d6 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2015 License: Zlib Imports: 6 Imported by: 2

README

Go bindings for:
Simple and Fast Multimedia Library
http://www.sfml-dev.org/

See CONTRIB for contributers

Get the deps, then
$ go get github.com/drhodes/go-sfml

_____________________________________________________________________________
WARNING:

This is a work in progress, expect things to change.  I plan to peg the bindings
to the next stable version of CSFML when it's released.  For now users are 
required to build SFML and CSFML from git.  

module progress


todo:
gfx 99%
	- Shape.h	
	  
aud 85%
	-SoundRecorder.h
	-SoundRecorderBuffer.h
	-SoundStream.h

win 
sys


_____________________________________________________________________________
DEPENDENCIES:

Both SFML and CSFML libraries are needed, as CSFML links to SFML.

SFML 
--
git clone https://github.com/LaurentGomila/SFML.git
git checkout -b go-sfml abd842510efaa2816b2f2e7348426163c57058c5


CSFML 
--
git clone https://github.com/SFML/CSFML.git
git checkout -b go-csfml d7240abb18344b773e5f457a6a45f20b16d139f9

libjpeg 8   http://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download
libglew 1.7 http://www.ijg.org/files/jpegsrc.v8.tar.gz

-and more-

pthread
opengl
xlib
xrandr
freetype
sndfile
openal

I'm not sure on the required version of the latter libs. 
For more infomation, please checkout Laurent's very helpful sfml tutorial located at:
http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php


_____________________________________________________________________________
BUILDING SFML/CSFML

SFML/CSFML both use cmake-1.8 or better.  For those unfamiliar with cmake's
idiosyncrasies, hang in there, you can do it!  I found that using the 
interactive switch (cmake -i) is a good way to go.

Build+Install SFML first. Somewhere within the install directory 
there should exist a file called FindSFML.cmake.

I had to copy it to here (yours may differ).  
/usr/share/cmake-2.8/Modules

To be perfectly clear, I had to get root priviledges and copy FindSFML.cmake
into a global directory sanctioned by cmake. Odd and unexpected! If due to my
 ignorance this is in fact not necessary, please disabuse me of the notion.

Also I had to add the following to line 19 of file:
/my/path/to/git-csfml/cmake/Config.cmake

so it looks like:

17: elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
18:    set(LINUX 1)
19:    set(SFML_INCLUDE_DIR "/my/path/to/git-sfml-install/include")

Then, as I mention above 
/git-csfml$  cmake -i


_____________________________________________________________________________
BASIC LINUX LIBRARY CONFIGURATION

For whom it applies, you might add something 
like the following to your ~/.bashrc

export C_INCLUDE_PATH=${C_INCLUDE_PATH}:/path/to/git-csfml-install/include
export C_INCLUDE_PATH=${C_INCLUDE_PATH}:/path/to/glew-1.7.0/include
export C_INCLUDE_PATH=${C_INCLUDE_PATH}:/path/to/jpeg-8/build/include

export LIBRARY_PATH=${LIBRARY_PATH}:/path/to/git-csfml-install/lib
export LIBRARY_PATH=${LIBRARY_PATH}:/path/to/git-sfml-install/lib
export LIBRARY_PATH=${LIBRARY_PATH}:/path/to/jpeg-8/build/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/git-csfml-install/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/git-sfml-install/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/glew-1.7.0/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/jpeg-8/build/lib


_____________________________________________________________________________
NOTE:
finalizers shouldn't be used for cleaning up C memory. as outlined here:
http://golang.org/pkg/runtime/#SetFinalizer

> There is no guarantee that finalizers will run before a
> program exits, so typically they are useful only for
> releasing non-memory resources associated with an
> object during a long-running program. 

I've been using memory pools to elide this, and am glad to report that
long running (4 hour) processes showing no memory leaks.


_____________________________________________________________________________
NAMING CONVENTION:

Against the more tasteful approach go adopts on Getter methods, I've opted 
to keep the "Get" prefix to preserve the naming convention set by SFML; for
the simple reason that it is consistent.  If someone is trying to lookup a
function signature at the SFML site, they will immediately know what to 
look for without exception.

_____________________________________________________________________________
GIVE IT A WHIRL:

There is a small game of pong

cd ./test/pong
pong $ go build
pong $ ./pong


Documentation

Overview

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////

SFML - Simple and Fast Multimedia Library Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  1. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

//////////////////////////////////////////////////////////

Index

Constants

View Source
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
)

Mouse buttons

View Source
const (
	// No border / title bar (this flag and all others are mutually exclusive)
	StyleNone = 0
	// Title bar + fixed border
	StyleTitlebar = 1 << 0
	// Titlebar + resizable border + maximize button
	StyleResize = 1 << 1
	// Titlebar + close button
	StyleClose = 1 << 2
	// Fullscreen mode (this flag and all others are mutually exclusive)
	StyleFullscreen = 1 << 3
	// Default window style
	StyleDefaultStyle = StyleTitlebar | StyleResize | StyleClose
)

Enumeration of window creation styles

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) C.sfBool

func Debug

func Debug(x interface{})

func DebugN

func DebugN(x interface{})

func DebugT

func DebugT(x interface{})

func GetGlobalVolume

func GetGlobalVolume() float32

\brief Get the current value of the global volume \return Current global volume, in the range [0, 100] float sfListener_getGlobalVolume(void);

func IsKeyPressed

func IsKeyPressed(key KeyCode) bool

Check if a key is pressed key Key to check return true if the key is pressed, false otherwise sfBool sfKeyboard_isKeyPressed(sfKeyCode key);

func MouseGetPosition

func MouseGetPosition(win Window) (int, int)

Get the current position of the mouse This function returns the current position of the mouse cursor relative to the given window.

func MouseGetPositionAbsolute

func MouseGetPositionAbsolute() (int, int)

Get the current position of the mouse This function returns the current position of the mouse cursor relative to the desktop

func SetDirection

func SetDirection(orientation Vector3f)

\brief Set the orientation of the listener in the scene The orientation defines the 3D axes of the listener (left, up, front) in the scene. The orientation vector doesn't have to be normalized. The default listener's orientation is (0, 0, -1). \param position New direction of the listener sfListener_setDirection(sfVector3f orientation);

func SetGlobalVolume

func SetGlobalVolume(volume float32)

\brief 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). \param volume New global volume, in the range [0, 100] sfListener_setGlobalVolume(float volume);

func SetMousePosition

func SetMousePosition(x, y int, win Window)

Set the current position of the mouse This function sets the current position of the mouse cursor relative to the given window.

func SetMousePositionAbsolute

func SetMousePositionAbsolute(x, y int)

Set the current position of the mouse. This function sets the current position of the mouse cursor relative to the desktop.

func SetPosition

func SetPosition(pos Vector3f)

\brief Set the position of the listener in the scene The default listener's position is (0, 0, 0). \param position New position of the listener sfListener_setPosition(sfVector3f position);

func TextureMaximumSize

func TextureMaximumSize() uint

\brief Get the maximum texture size allowed \return Maximum size allowed for textures, in pixels unsigned int sfTexture_getMaximumSize();

Types

type CEvent

type CEvent *C.sfEvent

type CWindow

type CWindow *C.sfWindow

need to export this C type.

type CWindowHandle

type CWindowHandle C.sfWindowHandle

type CircleShape

type CircleShape struct {
	Cref *C.sfCircleShape
}

func NewCircle

func NewCircle() CircleShape

Create a new circle shape \return A new sfCircleShape object, or NULL if it failed sfCircleShape* sfCircleShape_create(void);

func (CircleShape) Copy

func (self CircleShape) Copy() CircleShape

Copy an existing circle shape \param shape Shape to copy \return Copied object sfCircleShape* sfCircleShape_copy(sfCircleShape* shape);

func (CircleShape) Destroy

func (self CircleShape) Destroy()

Destroy an existing circle Shape \param Shape Shape to delete void sfCircleShape_destroy(sfCircleShape* shape);

func (CircleShape) FillColor

func (self CircleShape) FillColor() Color

Get the fill color of a circle shape \param shape Shape object \return Fill color of the shape sfColor sfCircleShape_getFillColor(const sfCircleShape* shape);

func (CircleShape) GetScale

func (self CircleShape) GetScale() (float32, float32)

Get the current scale of a circle shape \param shape Shape object \return Current scale factors sfVector2f sfCircleShape_GetScale(const sfCircleShape* shape);

func (CircleShape) GlobalBounds

func (self CircleShape) GlobalBounds() 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. \param shape Shape object \return Global bounding rectangle of the entity sfFloatRect sfCircleShape_getGlobalBounds(const sfCircleShape* shape);

func (CircleShape) InverseTransform

func (self CircleShape) InverseTransform() Transform

Get the inverse of the combined transform of a circle shape \param shape Shape object \return Inverse of the combined transformations applied to the object const sfTransform* sfCircleShape_getInverseTransform(const sfCircleShape* shape);

func (CircleShape) LocalBounds

func (self CircleShape) LocalBounds() 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. \param shape Shape object \return Local bounding rectangle of the entity sfFloatRect sfCircleShape_getLocalBounds(const sfCircleShape* shape);

func (CircleShape) Move

func (self CircleShape) Move(x, y float32)

Move a circle shape by a given offset This function adds to the current position of the object, unlike sfCircleShape_setPosition which overwrites it. \param shape Shape object \param offset Offset void sfCircleShape_move(sfCircleShape* shape, sfVector2f offset);

func (CircleShape) Origin

func (self CircleShape) Origin() (float32, float32)

Get the local origin of a circle shape \param shape Shape object \return Current origin sfVector2f sfCircleShape_GetOrigin(const sfCircleShape* shape);

func (CircleShape) OutlineColor

func (self CircleShape) OutlineColor() Color

Get the outline color of a circle shape \param shape Shape object \return Outline color of the shape sfColor sfCircleShape_getOutlineColor(const sfCircleShape* shape);

func (CircleShape) OutlinkThickness

func (self CircleShape) OutlinkThickness() float32

Get the outline thickness of a circle shape \param shape Shape object \return Outline thickness of the shape float sfCircleShape_getOutlineThickness(const sfCircleShape* shape);

func (CircleShape) Point

func (self CircleShape) Point(index uint) (float32, float32)

Get a point of a circle shape The result is undefined if \a index is out of the valid range. \param shape Shape object \param index Index of the point to get, in range [0 .. getPointCount() - 1] \return Index-th point of the shape sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, unsigned int index);

func (CircleShape) PointCount

func (self CircleShape) PointCount() int

Get the total number of points of a circle shape \param shape Shape object \return Number of points of the shape unsigned int sfCircleShape_getPointCount(const sfCircleShape* shape);

func (CircleShape) Position

func (self CircleShape) Position() (float32, float32)

Get the position of a circle shape \param shape Shape object \return Current position sfVector2f sfCircleShape_getPosition(const sfCircleShape* shape);

func (CircleShape) Radius

func (self CircleShape) Radius() float32

Get the radius of a circle \param shape Shape object \return Radius of the circle float sfCircleShape_getRadius(const sfCircleShape* shape);

func (CircleShape) Rotate

func (self CircleShape) Rotate(angle float32)

Rotate a circle shape This function adds to the current rotation of the object, unlike sfCircleShape_setRotation which overwrites it. \param shape Shape object \param angle Angle of rotation, in degrees void sfCircleShape_rotate(sfCircleShape* shape, float angle);

func (CircleShape) Rotation

func (self CircleShape) Rotation() float32

Get the orientation of a circle shape The rotation is always in the range [0, 360]. \param shape Shape object \return Current rotation, in degrees float sfCircleShape_getRotation(const sfCircleShape* shape);

func (CircleShape) Scale

func (self CircleShape) Scale(x, y float32)

Scale a circle shape This function multiplies the current scale of the object, unlike sfCircleShape_setScale which overwrites it. \param shape Shape object \param factors Scale factors void sfCircleShape_scale(sfCircleShape* shape, sfVector2f factors);

func (CircleShape) SetFillColor

func (self 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. \param shape Shape object \param color New color of the shape void sfCircleShape_setFillColor(sfCircleShape* shape, sfColor color);

func (CircleShape) SetOrigin

func (self CircleShape) SetOrigin(x, y float32)

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). \param shape Shape object \param origin New origin void sfCircleShape_setOrigin(sfCircleShape* shape, sfVector2f origin);

func (CircleShape) SetOutlineColor

func (self 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. \param shape Shape object \param color New outline color of the shape void sfCircleShape_setOutlineColor(sfCircleShape* shape, sfColor color);

func (CircleShape) SetOutlineThickness

func (self 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. \param shape Shape object \param thickness New outline thickness void sfCircleShape_setOutlineThickness(sfCircleShape* shape, float thickness);

func (CircleShape) SetPointCount

func (self CircleShape) SetPointCount(count uint)

Set the number of points of a circle \param shape Shape object \param count New number of points of the circle void sfCircleShape_setPointCount(sfCircleShape* shape, unsigned int count);

func (CircleShape) SetPosition

func (self CircleShape) SetPosition(x, y float32)

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). \param shape Shape object \param position New position void sfCircleShape_setPosition(sfCircleShape* shape, sfVector2f position);

func (CircleShape) SetRadius

func (self CircleShape) SetRadius(radius float32)

Set the radius of a circle \param shape Shape object \param radius New radius of the circle void sfCircleShape_setRadius(sfCircleShape* shape, float radius);

func (CircleShape) SetRotation

func (self CircleShape) SetRotation(angle 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. \param shape Shape object \param angle New rotation, in degrees void sfCircleShape_setRotation(sfCircleShape* shape, float angle);

func (CircleShape) SetScale

func (self CircleShape) SetScale(x, y float32)

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). \param shape Shape object \param scale New scale factors void sfCircleShape_setScale(sfCircleShape* shape, sfVector2f scale);

func (CircleShape) SetTexture

func (self CircleShape) SetTexture(tex Texture, resetRect bool)

Change the source texture of a circle shape The \a texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape 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 shape tries to use it, the behaviour is undefined. \a texture can be NULL to disable texturing. If \a 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. \param shape Shape object \param texture New texture \param resetRect Should the texture rect be reset to the size of the new texture? void sfCircleShape_setTexture(sfCircleShape* shape, const sfTexture* texture, sfBool resetRect);

func (CircleShape) SetTextureRect

func (self 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. \param shape Shape object \param rect Rectangle defining the region of the texture to display void sfCircleShape_setTextureRect(sfCircleShape* shape, sfIntRect rect);

func (CircleShape) Texture

func (self CircleShape) Texture() Texture

Get the source texture of a circle shape If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function. \param shape Shape object \return Pointer to the shape's texture const sfTexture* sfCircleShape_getTexture(const sfCircleShape* shape);

func (CircleShape) TextureRect

func (self CircleShape) TextureRect() IntRect

Get the sub-rectangle of the texture displayed by a circle shape \param shape Shape object \return Texture rectangle of the shape sfIntRect sfCircleShape_getTextureRect(const sfCircleShape* shape);

func (CircleShape) Transform

func (self CircleShape) Transform() Transform

Get the combined transform of a circle shape \param shape Shape object \return Transform combining the position/rotation/scale/origin of the object const sfTransform* sfCircleShape_getTransform(const sfCircleShape* shape);

type Clock

type Clock struct {
	Cref *C.sfClock
}

func NewClock

func NewClock() Clock

func (Clock) Copy

func (self Clock) Copy() Clock

func (Clock) Destroy

func (self Clock) Destroy()

func (Clock) GetElapsedTime

func (self Clock) GetElapsedTime() Time

func (Clock) Restart

func (self Clock) Restart() Time

type Color

type Color struct {
	Cref C.sfColor
}

Utility class for manpulating RGBA colors

func FromRGB

func FromRGB(red uint8, green uint8, blue uint8) Color

Construct a color from its 3 RGB components

\param red Red component (0 .. 255) \param green Green component (0 .. 255) \param blue Blue component (0 .. 255)

\return sfColor constructed from the components sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 blue);

func FromRGBA

func FromRGBA(red uint8, green uint8, blue uint8, alpha uint8) Color

Construct a color from its 4 RGBA components

\param red Red component (0 .. 255) \param green Green component (0 .. 255) \param blue Blue component (0 .. 255) \param alpha Alpha component (0 .. 255)

\return sfColor constructed from the components

sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha);

func (Color) Add

func (self Color) Add(color2 Color) Color

Add two colors

\param color2 Second color

\return Component-wise saturated addition of the two colors

sfColor sfColor_add(sfColor color1, sfColor color2);

func (Color) Alpha

func (self Color) Alpha() uint8

Return the alpha component of a color

func (Color) Blue

func (self Color) Blue() uint8

Return the blue component of a color

func (Color) Components

func (self Color) Components() (uint8, uint8, uint8, uint8)

Return the components of a color

func (Color) Green

func (self Color) Green() uint8

Return the green component of a color

func (Color) Modulate

func (self Color) Modulate(color2 Color) Color

Modulate two colors

\param color1 First color \param color2 Second color

\return Component-wise multiplication of the two colors

sfColor sfColor_modulate(sfColor color1, sfColor color2);

func (Color) Red

func (self Color) Red() uint8

Return the red component of a color

func (Color) String

func (self Color) String() string

Return a string describing the color

type Context

type Context struct {
	Cref *C.sfContext
}

func NewContext

func NewContext() (Context, error)

Create a new context This function activates the new context. \return New sfContext object sfContext* sfContext_create(void);

func (Context) Destroy

func (self Context) Destroy()
Destroy a context

\param context Context to destroy void sfContext_destroy(sfContext* context);

func (Context) SetActive

func (self Context) SetActive(active bool)
Activate or deactivate explicitely a context

\param context Context object \param active sfTrue to activate, sfFalse to deactivate void sfContext_setActive(sfContext* context, sfBool active);

type ContextSettings

type ContextSettings struct {
	Cref *C.sfContextSettings
}

Structure defining the window's creation settings

func NewContextSettings

func NewContextSettings(depthbits, stencilbits, antialiasinglevel,
	majVersion, minVersion uint) ContextSettings

func (ContextSettings) AntialiasingLevel

func (self ContextSettings) AntialiasingLevel() uint

func (ContextSettings) DepthBits

func (self ContextSettings) DepthBits() uint

func (ContextSettings) MajorVersion

func (self ContextSettings) MajorVersion() uint

func (ContextSettings) MinorVersion

func (self ContextSettings) MinorVersion() uint

func (ContextSettings) Nil

func (self ContextSettings) Nil() bool

func (ContextSettings) StencilBits

func (self ContextSettings) StencilBits() uint

type ConvexShape

type ConvexShape struct {
	Cref *C.sfConvexShape
}

func NewConvexShape

func NewConvexShape() ConvexShape

\brief Create a new convex shape \return A new sfConvexShape object, or NULL if it failed sfConvexShape* sfConvexShape_create(void);

func (ConvexShape) Copy

func (self ConvexShape) Copy() ConvexShape

\brief Copy an existing convex shape \param shape Shape to copy \return Copied object sfConvexShape* sfConvexShape_copy(sfConvexShape* shape);

func (ConvexShape) Destroy

func (self ConvexShape) Destroy()

\brief Destroy an existing convex Shape \param Shape Shape to delete void sfConvexShape_destroy(sfConvexShape* shape);

func (ConvexShape) GetFillColor

func (self ConvexShape) GetFillColor() Color

\brief Get the fill color of a convex shape \param shape Shape object \return Fill color of the shape sfColor sfConvexShape_getFillColor(const sfConvexShape* shape);

func (ConvexShape) GetGlobalBounds

func (self ConvexShape) GetGlobalBounds() FloatRect

\brief 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. \param shape Shape object \return Global bounding rectangle of the entity sfFloatRect sfConvexShape_getGlobalBounds(const sfConvexShape* shape);

func (ConvexShape) GetInverseTransform

func (self ConvexShape) GetInverseTransform() Transform

\brief Get the inverse of the combined transform of a convex shape \param shape shape object \return Inverse of the combined transformations applied to the object const sfTransform* sfConvexShape_getInverseTransform(const sfConvexShape* shape);

func (ConvexShape) GetLocalBounds

func (self ConvexShape) GetLocalBounds() FloatRect

\brief 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. \param shape Shape object \return Local bounding rectangle of the entity sfFloatRect sfConvexShape_getLocalBounds(const sfConvexShape* shape);

func (ConvexShape) GetOrigin

func (self ConvexShape) GetOrigin() (x, y float32)

\brief Get the local origin of a convex shape \param shape Shape object \return Current origin sfVector2f sfConvexShape_getOrigin(const sfConvexShape* shape);

func (ConvexShape) GetOutlineColor

func (self ConvexShape) GetOutlineColor() Color

\brief Get the outline color of a convex shape \param shape Shape object \return Outline color of the shape sfColor sfConvexShape_getOutlineColor(const sfConvexShape* shape);

func (ConvexShape) GetOutlineThickness

func (self ConvexShape) GetOutlineThickness() float32

\brief Get the outline thickness of a convex shape \param shape Shape object \return Outline thickness of the shape float sfConvexShape_getOutlineThickness(const sfConvexShape* shape);

func (ConvexShape) GetPoint

func (self ConvexShape) GetPoint(index uint) (x, y float32)

\brief Get a point of a convex shape The result is undefined if \a index is out of the valid range. \param shape Shape object \param index Index of the point to get, in range [0 .. getPointCount() - 1] \return Index-th point of the shape sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, unsigned int index);

func (ConvexShape) GetPointCount

func (self ConvexShape) GetPointCount() uint

\brief Get the total number of points of a convex shape \param shape Shape object \return Number of points of the shape unsigned int sfConvexShape_getPointCount(const sfConvexShape* shape);

func (ConvexShape) GetPosition

func (self ConvexShape) GetPosition() (x, y float32)

\brief Get the position of a convex shape \param shape Shape object \return Current position sfVector2f sfConvexShape_getPosition(const sfConvexShape* shape);

func (ConvexShape) GetRotation

func (self ConvexShape) GetRotation() float32

\brief Get the orientation of a convex shape The rotation is always in the range [0, 360]. \param shape Shape object \return Current rotation, in degrees float sfConvexShape_getRotation(const sfConvexShape* shape);

func (ConvexShape) GetScale

func (self ConvexShape) GetScale() (x, y float32)

\brief Get the current scale of a convex shape \param shape Shape object \return Current scale factors sfVector2f sfConvexShape_getScale(const sfConvexShape* shape);

func (ConvexShape) GetTexture

func (self ConvexShape) GetTexture() Texture

\brief Get the source texture of a convex shape If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function. \param shape Shape object \return Pointer to the shape's texture const sfTexture* sfConvexShape_getTexture(const sfConvexShape* shape);

func (ConvexShape) GetTextureRect

func (self ConvexShape) GetTextureRect() IntRect

\brief Get the sub-rectangle of the texture displayed by a convex shape \param shape Shape object \return Texture rectangle of the shape sfIntRect sfConvexShape_getTextureRect(const sfConvexShape* shape);

func (ConvexShape) GetTransform

func (self ConvexShape) GetTransform() Transform

\brief Get the combined transform of a convex shape \param shape shape object \return Transform combining the position/rotation/scale/origin of the object const sfTransform* sfConvexShape_getTransform(const sfConvexShape* shape);

func (ConvexShape) Move

func (self ConvexShape) Move(x, y float32)

\brief Move a convex shape by a given offset This function adds to the current position of the object, unlike sfConvexShape_setPosition which overwrites it. \param shape Shape object \param offset Offset void sfConvexShape_move(sfConvexShape* shape, sfVector2f offset);

func (ConvexShape) Rotate

func (self ConvexShape) Rotate(angle float32)

\brief Rotate a convex shape This function adds to the current rotation of the object, unlike sfConvexShape_setRotation which overwrites it. \param shape Shape object \param angle Angle of rotation, in degrees void sfConvexShape_rotate(sfConvexShape* shape, float angle);

func (ConvexShape) Scale

func (self ConvexShape) Scale(x, y float32)

\brief Scale a convex shape This function multiplies the current scale of the object, unlike sfConvexShape_setScale which overwrites it. \param shape Shape object \param factors Scale factors void sfConvexShape_scale(sfConvexShape* shape, sfVector2f factors);

func (ConvexShape) SetFillColor

func (self ConvexShape) SetFillColor(color Color)

\brief 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. \param shape Shape object \param color New color of the shape void sfConvexShape_setFillColor(sfConvexShape* shape, sfColor color);

func (ConvexShape) SetOutlineColor

func (self ConvexShape) SetOutlineColor(color Color)

\brief 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. \param shape Shape object \param color New outline color of the shape void sfConvexShape_setOutlineColor(sfConvexShape* shape, sfColor color);

func (ConvexShape) SetOutlineThickness

func (self ConvexShape) SetOutlineThickness(thickness float32)

\brief 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. \param shape Shape object \param thickness New outline thickness void sfConvexShape_setOutlineThickness(sfConvexShape* shape, float thickness);

func (ConvexShape) SetPoint

func (self ConvexShape) SetPoint(index uint, x, y float32)

\brief 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 \a index is out of the valid range. \param shape Shape object \param index Index of the point to change, in range [0 .. GetPointCount() - 1] \param point New point void sfConvexShape_setPoint(sfConvexShape* shape, unsigned int index, sfVector2f point);

func (ConvexShape) SetPointCount

func (self ConvexShape) SetPointCount(count uint)

\brief Set the number of points of a convex shap \a count must be greater than 2 to define a valid shape. \param shape Shape object \param count New number of points of the shape void sfConvexShape_setPointCount(sfConvexShape* shape, unsigned int count);

func (ConvexShape) SetScale

func (self ConvexShape) SetScale(x, y float32)

\brief 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). \param shape Shape object \param scale New scale factors void sfConvexShape_setScale(sfConvexShape* shape, sfVector2f scale);

func (ConvexShape) SetTexture

func (self ConvexShape) SetTexture(txt Texture, resetRect bool)

\brief Change the source texture of a convex shape The \a texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape 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 shape tries to use it, the behaviour is undefined. \a texture can be NULL to disable texturing. If \a 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. \param shape Shape object \param texture New texture \param resetRect Should the texture rect be reset to the size of the new texture? void sfConvexShape_setTexture(sfConvexShape* shape, const sfTexture* texture, sfBool resetRect);

func (ConvexShape) Setorigin

func (self ConvexShape) Setorigin(x, y float32)

\brief 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). \param shape Shape object \param origin New origin void sfConvexShape_setOrigin(sfConvexShape* shape, sfVector2f origin);

func (ConvexShape) Setposition

func (self ConvexShape) Setposition(position Vector2f)

\brief 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). \param shape Shape object \param position New position void sfConvexShape_setPosition(sfConvexShape* shape, sfVector2f position);

func (ConvexShape) Setrotation

func (self ConvexShape) Setrotation(angle float32)

\brief Set the orientation of a convex shape This function completely overwrites the previous rotation. See sfConvexShape_rotate to add an angle based on the previous rotation instead. The default rotation of a circle Shape object is 0. \param shape Shape object \param angle New rotation, in degrees void sfConvexShape_setRotation(sfConvexShape* shape, float angle);

func (ConvexShape) Settexturerect

func (self ConvexShape) Settexturerect(rect IntRect)

\brief 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. \param shape Shape object \param rect Rectangle defining the region of the texture to display void sfConvexShape_setTextureRect(sfConvexShape* shape, sfIntRect rect);

type Event

type Event struct {
	Cref *C.sfEvent
}

func NewEvent

func NewEvent() Event

func (Event) ToJoystickButtonEvent

func (self Event) ToJoystickButtonEvent() JoystickButtonEvent

func (Event) ToJoystickConnectEvent

func (self Event) ToJoystickConnectEvent() JoystickConnectEvent

func (Event) ToJoystickMoveEvent

func (self Event) ToJoystickMoveEvent() JoystickMoveEvent

func (Event) ToKeyEvent

func (self Event) ToKeyEvent() KeyEvent

func (Event) ToMouseButtonEvent

func (self Event) ToMouseButtonEvent() MouseButtonEvent

func (Event) ToMouseMoveEvent

func (self Event) ToMouseMoveEvent() MouseMoveEvent

func (Event) ToMouseWheelEvent

func (self Event) ToMouseWheelEvent() MouseWheelEvent

func (Event) ToSizeEvent

func (self Event) ToSizeEvent() SizeEvent

func (Event) ToTextEvent

func (self Event) ToTextEvent() TextEvent

type EventType

type EventType uint
const (
	EvtClosed EventType = iota
	EvtResized
	EvtLostFocus
	EvtGainedFocus
	EvtTextEntered
	EvtKeyPressed
	EvtKeyReleased
	EvtMouseWheelMoved
	EvtMouseButtonPressed
	EvtMouseButtonReleased
	EvtMouseMoved
	EvtMouseEntered
	EvtMouseLeft
	EvtJoystickButtonPressed
	EvtJoystickButtonReleased
	EvtJoystickMoved
	EvtJoystickConnected
	EvtJoystickDisconnected
	EvtNone // go introduction.
)

type FloatRect

type FloatRect struct {
	Cref *C.sfFloatRect
}

------------------------------------------------------------------

func NewFloatRect

func NewFloatRect(left, top, width, height float32) FloatRect

func (FloatRect) Contains

func (self FloatRect) Contains(x, y float32) bool

func (FloatRect) Height

func (self FloatRect) Height() float32

func (FloatRect) Intersects

func (self FloatRect) Intersects(rect FloatRect) (*FloatRect, bool)

brief Check intersection between two rectangles param rect1 First rectangle to test param rect2 Second rectangle to test param intersection Rectangle to be filled with overlapping rect (can be NULL) return sfTrue if rectangles overlap sfBool sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* // intersection);

func (FloatRect) Left

func (self FloatRect) Left() float32

func (FloatRect) Show

func (self FloatRect) Show() string

func (FloatRect) Top

func (self FloatRect) Top() float32

func (FloatRect) Width

func (self FloatRect) Width() float32

type Font

type Font struct {
	Cref *C.sfFont
}

func FontFromFile

func FontFromFile(fname string) (Font, error)

\brief Create a new font from a file \param filename Path of the font file to load \return A new sfFont object, or NULL if it failed sfFont* sfFont_createFromFile(const char* filename);

func (Font) Copy

func (self Font) Copy() Font

\brief Copy an existing font \param font Font to copy \return Copied object sfFont* sfFont_copy(sfFont* font);

func (Font) Destroy

func (self Font) Destroy()

\brief Destroy an existing font \param font Font to delete void sfFont_destroy(sfFont* font);

func (Font) Glyph

func (self Font) Glyph(codePoint, characterSize uint32, bold bool) Glyph

\brief Get a glyph in a font \param font Source font \param codePoint Unicode code point of the character to get \param characterSize Character size, in pixels \param bold Retrieve the bold version or the regular one? \return The corresponding glyph sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold);

func (Font) Kerning

func (self Font) Kerning(first, second uint32, characterSize uint) int

\brief Get the kerning value corresponding to a given pair of characters in a font \param font Source font \param first Unicode code point of the first character \param second Unicode code point of the second character \param characterSize Character size, in pixels \return Kerning offset, in pixels int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);

func (Font) LineSpacing

func (self Font) LineSpacing(characterSize int) int

\brief Get the line spacing value \param font Source font \param codePoint Unicode code point of the character to get \param characterSize Character size, in pixels \return Line spacing, in pixels int sfFont_getLineSpacing(sfFont* font, unsigned int characterSize);

func (Font) Texture

func (self Font) Texture(characterSize uint) Texture

\brief Get the texture containing the glyphs of a given size in a font \param font Source font \param characterSize Character size, in pixels \return Read-only pointer to the texture const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize);

type Glyph

type Glyph struct {
	Cref *C.sfGlyph
}

type Image

type Image struct {
	Cref *C.sfImage
}

func ImageFromColor

func ImageFromColor(width, height uint, color Color) Image

Create an image and fill it with a unique color width Width of the image height Height of the image color Fill color return A new sfImage object sfImage* sfImage_createFromColor(unsigned int width, unsigned int height, sfColor color);

func ImageFromFile

func ImageFromFile(fname string) (Image, error)

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. If this function fails, the image is left unchanged. \param filename Path of the image file to load \return A new sfImage object, or NULL if it failed sfImage* sfImage_createFromFile(const char* filename);

func ImageFromPixels

func ImageFromPixels(width, height uint, pixels []uint8) Image

Create an image from an array of pixels The \a pixel array is assumed to contain 32-bits RGBA pixels, and have the given \a width and \a height. If not, this is an undefined behaviour. If \a pixels is null, an empty image is created. \param width Width of the image \param height Height of the image \param pixels Array of pixels to copy to the image \return A new sfImage object sfImage* sfImage_createFromPixels(unsigned int width, unsigned int height, const sfUint8* pixels);

func NewImage

func NewImage(width, height uint) Image

Create an image This image is filled with black pixels. width Width of the image height Height of the image return A new Image object sfImage* sfImage_create(unsigned int width, unsigned int height);

func (Image) Copy

func (self Image) Copy() Image
Copy an existing image

\param image Image to copy \return Copied object sfImage* sfImage_copy(sfImage* image);

func (Image) CopyImage

func (self Image) CopyImage(source Image, destX, destY int, sourceRect IntRect, applyAlpha bool)
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 sfRenderTexture. If \a sourceRect is empty, the whole image is copied. If \a 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. \param image Image object \param source Source image to copy \param destX X coordinate of the destination position \param destY Y coordinate of the destination position \param sourceRect Sub-rectangle of the source image to copy \param applyAlpha Should the copy take in account the source transparency? void sfImage_copyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect, sfBool applyAlpha);

func (Image) Destroy

func (self Image) Destroy()
Destroy an existing image

\param image Image to delete void sfImage_destroy(sfImage* image);

func (Image) FlipHorizontally

func (self Image) FlipHorizontally()
Flip an image horizontally (left <-> right)

\param image Image object void sfImage_flipHorizontally(sfImage* image);

func (Image) FlipVertically

func (self Image) FlipVertically()

func (Image) Pixel

func (self Image) Pixel(x, y uint) Color
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. \param image Image object \param x X coordinate of pixel to get \param y Y coordinate of pixel to get \return Color of the pixel at coordinates (x, y) sfColor sfImage_getPixel(const sfImage* image, unsigned int x, unsigned int y);

func (Image) Savetofile

func (self Image) Savetofile(filename string) bool
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. \param image Image object \param filename Path of the file to save \return sfTrue if saving was successful sfBool sfImage_saveToFile(const sfImage* image, const char* filename);

func (Image) SetPixel

func (self Image) SetPixel(x, y uint, color Color)
Change 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. \param image Image object \param x X coordinate of pixel to change \param y Y coordinate of pixel to change \param color New color of the pixel void sfImage_setPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color);

func (Image) Size

func (self Image) Size() (uint, uint)

Return the size of an image \param image Image object \return Size in pixels sfVector2u sfImage_getSize(const sfImage* image);

type IntRect

type IntRect struct {
	Cref *C.sfIntRect
}

func NewIntRect

func NewIntRect(left, top, width, height int32) IntRect

func (IntRect) Contains

func (self IntRect) Contains(x, y int32) bool

func (IntRect) Height

func (self IntRect) Height() int32

func (IntRect) Intersects

func (self IntRect) Intersects(rect IntRect) (*IntRect, bool)

brief Check intersection between two rectangles param rect1 First rectangle to test param rect2 Second rectangle to test param intersection Rectangle to be filled with overlapping rect (can be NULL) return sfTrue if rectangles overlap sfBool sfIntRect_intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* // intersection);

func (IntRect) Left

func (self IntRect) Left() int32

func (IntRect) Show

func (self IntRect) Show() string

func (IntRect) Top

func (self IntRect) Top() int32

func (IntRect) Width

func (self IntRect) Width() int32

type Joystick

type Joystick uint

func (Joystick) AxisPosition

func (self Joystick) AxisPosition(axis JoystickAxis) float32

Get the current position of a joystick axis If the joystick is not connected, this function returns 0. \param joystick Index of the joystick \param axis Axis to check \return Current position of the axis, in range [-100 .. 100] float sfJoystick_getAxisPosition(unsigned int joystick, sfJoystickAxis axis);

func (Joystick) ButtonCount

func (self Joystick) ButtonCount() uint

Return the number of buttons supported by a joystick If the joystick is not connected, this function returns 0. \param joystick Index of the joystick \return Number of buttons supported by the joystick unsigned int sfJoystick_getButtonCount(unsigned int joystick);

func (Joystick) HasAxis

func (self Joystick) HasAxis(axis JoystickAxis) bool

Check if a joystick supports a given axis If the joystick is not connected, this function returns false. \param joystick Index of the joystick \param axis Axis to check \return sfTrue if the joystick supports the axis, sfFalse otherwise sfBool sfJoystick_hasAxis(unsigned int joystick, sfJoystickAxis axis);

func (Joystick) IsButtonPressed

func (self Joystick) IsButtonPressed(button uint) bool

Check if a joystick button is pressed If the joystick is not connected, this function returns false. \param joystick Index of the joystick \param button Button to check \return sfTrue if the button is pressed, sfFalse otherwise sfBool sfJoystick_isButtonPressed(unsigned int joystick, unsigned int button);

func (Joystick) Isconnected

func (self Joystick) Isconnected() bool

Check if a joystick is connected \param joystick Index of the joystick to check \return sfTrue if the joystick is connected, sfFalse otherwise sfBool sfJoystick_isConnected(unsigned int joystick);

func (Joystick) Update

func (self Joystick) Update()

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. void sfJoystick_update(void);

type JoystickAxis

type JoystickAxis struct {
	Cref *C.sfJoystickAxis
}

type JoystickButtonEvent

type JoystickButtonEvent struct {
	Type EventType
	Cref *C.sfJoystickButtonEvent
}

////////////////////////////////////////////////////////// / \brief Joystick buttons events parameters / ////////////////////////////////////////////////////////// struct sfJoystickButtonEvent

{
    sfEventType  type;
    unsigned int joystickId;
    unsigned int button;
};

func (JoystickButtonEvent) Button

func (self JoystickButtonEvent) Button() uint

func (JoystickButtonEvent) JoystickID

func (self JoystickButtonEvent) JoystickID() uint

type JoystickConnectEvent

type JoystickConnectEvent struct {
	Type EventType
	Cref *C.sfJoystickConnectEvent
}

////////////////////////////////////////////////////////// / \brief Joystick connection/disconnection event parameters / ////////////////////////////////////////////////////////// struct sfJoystickConnectEvent

{
    sfEventType  type;
    unsigned int joystickId;
};

func (JoystickConnectEvent) JoystickID

func (self JoystickConnectEvent) JoystickID() uint

type JoystickMoveEvent

type JoystickMoveEvent struct {
	Type EventType
	Cref *C.sfJoystickMoveEvent
}

////////////////////////////////////////////////////////// / \brief Joystick axis move event parameters / ////////////////////////////////////////////////////////// struct sfJoystickMoveEvent

{
    sfEventType    type;
    unsigned int   joystickId;
    sfJoystickAxis axis;
    float          position;
};

func (JoystickMoveEvent) Axis

func (self JoystickMoveEvent) Axis() JoystickAxis

func (JoystickMoveEvent) JoystickID

func (self JoystickMoveEvent) JoystickID() uint

func (JoystickMoveEvent) Position

func (self JoystickMoveEvent) Position() float32

type KeyCode

type KeyCode uint
const (
	KeyA         KeyCode = 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 [Win | apple key]
	KeyRControl                 // The right Control key
	KeyRShift                   // The right Shift key
	KeyRAlt                     // The right Alt key
	KeyRSystem                  // The right OS specific key [Win | apple key]
	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 F8 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
)

type KeyEvent

type KeyEvent struct {
	Type EventType
	Cref *C.sfKeyEvent
}

func (KeyEvent) Alt

func (self KeyEvent) Alt() bool

func (KeyEvent) Code

func (self KeyEvent) Code() KeyCode

func (KeyEvent) Control

func (self KeyEvent) Control() bool

func (KeyEvent) Shift

func (self KeyEvent) Shift() bool

func (KeyEvent) System

func (self KeyEvent) System() bool

type MouseButton

type MouseButton uint

func (MouseButton) IsButtonPressed

func (self MouseButton) IsButtonPressed() bool

Check if a mouse button is pressed Returns true if the button is pressed, false otherwise

type MouseButtonEvent

type MouseButtonEvent struct {
	Type EventType
	Cref *C.sfMouseButtonEvent
}

////////////////////////////////////////////////////////// / \brief Mouse buttons events parameters / ////////////////////////////////////////////////////////// struct sfMouseButtonEvent

{
    sfEventType   type;
    sfMouseButton button;
    int           x;
    int           y;
};

func (MouseButtonEvent) Button

func (self MouseButtonEvent) Button() MouseButton

func (MouseButtonEvent) X

func (self MouseButtonEvent) X() int

func (MouseButtonEvent) Y

func (self MouseButtonEvent) Y() int

type MouseMoveEvent

type MouseMoveEvent struct {
	Type EventType
	Cref *C.sfMouseMoveEvent
}

////////////////////////////////////////////////////////// / \brief Mouse move event parameters / ////////////////////////////////////////////////////////// struct sfMouseMoveEvent

{
    sfEventType type;
    int         x;
    int         y;
};

func (MouseMoveEvent) X

func (self MouseMoveEvent) X() int

func (MouseMoveEvent) Y

func (self MouseMoveEvent) Y() int

type MouseWheelEvent

type MouseWheelEvent struct {
	Type EventType
	Cref *C.sfMouseWheelEvent
}

////////////////////////////////////////////////////////// / \brief Mouse wheel events parameters / ////////////////////////////////////////////////////////// struct sfMouseWheelEvent

{
    sfEventType type;
    int         delta;
    int         x;
    int         y;
};

func (MouseWheelEvent) Delta

func (self MouseWheelEvent) Delta() int

func (MouseWheelEvent) X

func (self MouseWheelEvent) X() int

func (MouseWheelEvent) Y

func (self MouseWheelEvent) Y() int

type Music

type Music struct {
	Cref *C.sfMusic
}

func NewMusicFromFile

func NewMusicFromFile(filename string) (Music, error)

Create a new music and load it from a file This function doesn't start playing the music (call 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. \param filename Path of the music file to open \return A new sfMusic object (NULL if failed)

func NewMusicFromMemory

func NewMusicFromMemory(music []byte) (Music, error)

\brief Create a new music and load it from a file in memory This function doesn't start playing the music (call sfMusic_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. \param data Pointer to the file data in memory \param sizeInBytes Size of the data to load, in bytes \return A new sfMusic object (NULL if failed) sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeInBytes);

func (Music) Destroy

func (self Music) Destroy()

func (Music) GetChannelCount

func (self Music) GetChannelCount() uint

\brief Return the number of channels of a music 1 channel means a mono sound, 2 means stereo, etc. \param music Music object \return Number of channels unsigned int sfMusic_getChannelCount(const sfMusic* music);

func (Music) GetDuration

func (self Music) GetDuration() Time

\brief Get the total duration of a music \param music Music object \return Music duration sfTime sfMusic_getDuration(const sfMusic* music);

func (Music) GetLoop

func (self Music) GetLoop() bool

\brief Tell whether or not a music is in loop mode \param music Music object \return sfTrue if the music is looping, sfFalse otherwise sfBool sfMusic_getLoop(const sfMusic* music);

func (Music) GetPitch

func (self Music) GetPitch() float32

\brief Get the pitch of a music \param music Music object \return Pitch of the music float sfMusic_getPitch(const sfMusic* music);

func (Music) GetPlayingOffset

func (self Music) GetPlayingOffset() Time

\brief Get the current playing position of a music \param music Music object \return Current playing position sfTime sfMusic_getPlayingOffset(const sfMusic* music);

func (Music) GetPosition

func (self Music) GetPosition() Vector3f

\brief Get the 3D position of a music in the audio scene \param music Music object \return Position of the music in the world sfVector3f sfMusic_getPosition(const sfMusic* music);

func (Music) GetSampleRate

func (self Music) GetSampleRate() int

\brief 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. \param music Music object \return Sample rate, in number of samples per second unsigned int sfMusic_getSampleRate(const sfMusic* music);

func (Music) GetStatus

func (self Music) GetStatus() SoundStatus

\brief Get the current status of a music (stopped, paused, playing) \param music Music object \return Current status sfSoundStatus sfMusic_getStatus(const sfMusic* music);

func (Music) GetVolume

func (self Music) GetVolume() float32

\brief Get the volume of a music \param music Music object \return Volume of the music, in the range [0, 100] float sfMusic_getVolume(const sfMusic* music);

func (Music) Getattenuation

func (self Music) Getattenuation() float32

\brief Get the attenuation factor of a music \param music Music object \return Attenuation factor of the music float sfMusic_getAttenuation(const sfMusic* music);

func (Music) Getmindistance

func (self Music) Getmindistance() float32

\brief Get the minimum distance of a music \param music Music object \return Minimum distance of the music float sfMusic_getMinDistance(const sfMusic* music);

func (Music) IsRelativeToListener

func (self Music) IsRelativeToListener() bool

\brief Tell whether a music's position is relative to the

listener or is absolute

\param music Music object \return sfTrue if the position is relative, sfFalse if it's absolute sfBool sfMusic_isRelativeToListener(const sfMusic* music);

func (Music) Pause

func (self Music) Pause()

\brief Pause a music This function pauses the music if it was playing, otherwise (music already paused or stopped) it has no effect. \param music Music object void sfMusic_pause(sfMusic* music);

func (Music) Play

func (self Music) Play()

\brief 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. \param music Music object void sfMusic_play(sfMusic* music);

func (Music) SetAttenuation

func (self Music) SetAttenuation(attenuation float32)

\brief 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. \param music Music object \param attenuation New attenuation factor of the music void sfMusic_setAttenuation(sfMusic* music, float attenuation);

func (Music) SetLoop

func (self Music) SetLoop(loop bool)

\brief 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 sfMusic_setLoop(music, sfFalse) is called. The default looping state for musics is false. \param music Music object \param loop sfTrue to play in loop, sfFalse to play once void sfMusic_setLoop(sfMusic* music, sfBool loop);

func (Music) SetMinDistance

func (self Music) SetMinDistance(distance float32)

\brief 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. \param music Music object \param distance New minimum distance of the music void sfMusic_setMinDistance(sfMusic* music, float distance);

func (Music) SetPitch

func (self Music) SetPitch(pitch float32)

\brief 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. \param music Music object \param pitch New pitch to apply to the music void sfMusic_setPitch(sfMusic* music, float pitch);

func (Music) SetPlayingOffset

func (self Music) SetPlayingOffset(time Time)

\brief Change the current playing position of a music The playing position can be changed when the music is either paused or playing. \param music Music object \param timeOffset New playing position, in milliseconds void sfMusic_setPlayingOffset(sfMusic* music, sfTime timeOffset); TODO: file this doc as a bug, the second arg is sfTime, not int.

func (Music) SetPosition

func (self Music) SetPosition(position Vector3f)

\brief 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). \param music Music object \param position Position of the music in the scene void sfMusic_setPosition(sfMusic* music, sfVector3f position);

func (Music) SetRelativeToListener

func (self Music) SetRelativeToListener(relative bool)

\brief 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). \param music Music object \param relative sfTrue to set the position relative, sfFalse to set it absolute void sfMusic_setRelativeToListener(sfMusic* music, sfBool relative);

func (Music) SetVolume

func (self Music) SetVolume(volume float32)

\brief Set the volume of a music The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100. \param music Music object \param volume Volume of the music void sfMusic_setVolume(sfMusic* music, float volume);

func (Music) Stop

func (self Music) Stop()

\brief Stop playing a music This function stops the music if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike sfMusic_Pause). \param music Music object void sfMusic_stop(sfMusic* music);

type NullEvent

type NullEvent uint

type PrimitiveType

type PrimitiveType uint

type RectangleShape

type RectangleShape struct {
	Cref *C.sfRectangleShape
}

func NewRectangleShape

func NewRectangleShape() RectangleShape

Create a new rectangle shape \return A new sfRectangleShape object, or NULL if it failed sfRectangleShape* sfRectangleShape_create(void);

func (RectangleShape) Copy

func (self RectangleShape) Copy() RectangleShape

Copy an existing rectangle shape \param shape Shape to copy \return Copied object sfRectangleShape* sfRectangleShape_copy(sfRectangleShape* shape);

func (RectangleShape) Destroy

func (self RectangleShape) Destroy()

Destroy an existing rectangle shape \param Shape Shape to delete void sfRectangleShape_destroy(sfRectangleShape* shape);

func (RectangleShape) FillColor

func (self RectangleShape) FillColor() Color

Get the fill color of a rectangle shape \param shape Shape object \return Fill color of the shape sfColor sfRectangleShape_getFillColor(const sfRectangleShape* shape);

func (RectangleShape) GetScale

func (self RectangleShape) GetScale() (float32, float32)

Get the current scale of a rectangle shape \param shape Shape object \return Current scale factors sfVector2f sfRectangleShape_getScale(const sfRectangleShape* shape);

func (RectangleShape) GlobalBounds

func (self RectangleShape) GlobalBounds() 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. \param shape Shape object \return Global bounding rectangle of the entity

func (RectangleShape) InverseTransform

func (self RectangleShape) InverseTransform() Transform

Get the inverse of the combined transform of a rectangle shape \param shape shape object \return Inverse of the combined transformations applied to the object const sfTransform* sfRectangleShape_getInverseTransform(const sfRectangleShape* shape);

func (RectangleShape) LocalBounds

func (self RectangleShape) LocalBounds() 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. \param shape Shape object \return Local bounding rectangle of the entity sfFloatRect sfRectangleShape_getLocalBounds(const sfRectangleShape* shape);

func (RectangleShape) Move

func (self RectangleShape) Move(x, y float32)

Move a rectangle shape by a given offset This function adds to the current position of the object, unlike sfRectangleShape_setPosition which overwrites it. \param shape Shape object \param offset Offset void sfRectangleShape_move(sfRectangleShape* shape, sfVector2f offset);

func (RectangleShape) Origin

func (self RectangleShape) Origin() (float32, float32)

Get the local origin of a rectangle shape \param shape Shape object \return Current origin sfVector2f sfRectangleShape_getOrigin(const sfRectangleShape* shape);

func (RectangleShape) OutlineColor

func (self RectangleShape) OutlineColor() Color

Get the outline color of a rectangle shape \param shape Shape object \return Outline color of the shape sfColor sfRectangleShape_getOutlineColor(const sfRectangleShape* shape);

func (RectangleShape) OutlinkThickness

func (self RectangleShape) OutlinkThickness() float32

Get the outline thickness of a rectangle shape \param shape Shape object \return Outline thickness of the shape float sfRectangleShape_getOutlineThickness(const sfRectangleShape* shape);

func (RectangleShape) Point

func (self RectangleShape) Point(index uint) (float32, float32)

Get a point of a rectangle shape The result is undefined if \a index is out of the valid range. \param shape Shape object \param index Index of the point to get, in range [0 .. getPointCount() - 1] \return Index-th point of the shape sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, unsigned int index);

func (RectangleShape) PointCount

func (self RectangleShape) PointCount() int

Get the total number of points of a rectangle shape \param shape Shape object \return Number of points of the shape unsigned int sfRectangleShape_getPointCount(const sfRectangleShape* shape);

func (RectangleShape) Position

func (self RectangleShape) Position() (float32, float32)

Get the position of a rectangle shape \param shape Shape object \return Current position sfVector2f sfRectangleShape_getPosition(const sfRectangleShape* shape);

func (RectangleShape) Rotate

func (self RectangleShape) Rotate(angle float32)

Rotate a rectangle shape This function adds to the current rotation of the object, unlike sfRectangleShape_setRotation which overwrites it. \param shape Shape object \param angle Angle of rotation, in degrees void sfRectangleShape_rotate(sfRectangleShape* shape, float angle);

func (RectangleShape) Rotation

func (self RectangleShape) Rotation() float32

Get the orientation of a rectangle shape The rotation is always in the range [0, 360]. \param shape Shape object \return Current rotation, in degrees float sfRectangleShape_getRotation(const sfRectangleShape* shape);

func (RectangleShape) Scale

func (self RectangleShape) Scale(x, y float32)

Scale a rectangle shape This function multiplies the current scale of the object, unlike sfRectangleShape_setScale which overwrites it. \param shape Shape object \param factors Scale factors void sfRectangleShape_scale(sfRectangleShape* shape, sfVector2f factors);

func (RectangleShape) SetFillColor

func (self 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. \param shape Shape object \param color New color of the shape void sfRectangleShape_setFillColor(sfRectangleShape* shape, sfColor color);

func (RectangleShape) SetOrigin

func (self RectangleShape) SetOrigin(x, y float32)

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). \param shape Shape object \param origin New origin void sfRectangleShape_setOrigin(sfRectangleShape* shape, sfVector2f origin);

func (RectangleShape) SetOutlineColor

func (self 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. \param shape Shape object \param color New outline color of the shape void sfRectangleShape_setOutlineColor(sfRectangleShape* shape, sfColor color);

func (RectangleShape) SetOutlineThickness

func (self 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. \param shape Shape object \param thickness New outline thickness void sfRectangleShape_setOutlineThickness(sfRectangleShape* shape, float thickness);

func (RectangleShape) SetPosition

func (self RectangleShape) SetPosition(x, y float32)

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). \param shape Shape object \param position New position void sfRectangleShape_setPosition(sfRectangleShape* shape, sfVector2f position);

func (RectangleShape) SetRotation

func (self RectangleShape) SetRotation(angle 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. \param shape Shape object \param angle New rotation, in degrees void sfRectangleShape_setRotation(sfRectangleShape* shape, float angle);

func (RectangleShape) SetScale

func (self RectangleShape) SetScale(x, y float32)

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). \param shape Shape object \param scale New scale factors void sfRectangleShape_setScale(sfRectangleShape* shape, sfVector2f scale);

func (RectangleShape) SetSize

func (self RectangleShape) SetSize(x, y float32)

Set the size of a rectangle shape \param shape Shape object \param size New size of the rectangle void sfRectangleShape_setSize(sfRectangleShape* shape, sfVector2f size);

func (RectangleShape) SetTexture

func (self RectangleShape) SetTexture(tex Texture, resetRect bool)

Change the source texture of a rectangle shape The \a texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape 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 shape tries to use it, the behaviour is undefined. \a texture can be NULL to disable texturing. If \a 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. \param shape Shape object \param texture New texture \param resetRect Should the texture rect be reset to the size of the new texture? void sfRectangleShape_setTexture(sfRectangleShape* shape, const sfTexture* texture, sfBool resetRect);

func (RectangleShape) SetTextureRect

func (self 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. \param shape Shape object \param rect Rectangle defining the region of the texture to display void sfRectangleShape_setTextureRect(sfRectangleShape* shape, sfIntRect rect);

func (RectangleShape) Size

func (self RectangleShape) Size() (float32, float32)

Get the size of a rectangle shape \param shape Shape object \return height Size of the rectangle sfVector2f sfRectangleShape_getSize(const sfRectangleShape* shape);

func (RectangleShape) Texture

func (self RectangleShape) Texture() Texture

Get the source texture of a rectangle shape If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function. \param shape Shape object \return Pointer to the shape's texture const sfTexture* sfRectangleShape_getTexture(const sfRectangleShape* shape);

func (RectangleShape) TextureRect

func (self RectangleShape) TextureRect() IntRect

Get the sub-rectangle of the texture displayed by a rectangle shape \param shape Shape object \return Texture rectangle of the shape sfIntRect sfRectangleShape_getTextureRect(const sfRectangleShape* shape);

func (RectangleShape) Transform

func (self RectangleShape) Transform() Transform

Get the combined transform of a rectangle shape \param shape shape object \return Transform combining the position/rotation/scale/origin of the object const sfTransform* sfRectangleShape_getTransform(const sfRectangleShape* shape);

type RenderTexture

type RenderTexture struct {
	Cref *C.sfRenderTexture
}

func NewRenderTexture

func NewRenderTexture(width, height uint, depthBuffer bool) RenderTexture

Construct a new render texture \param width Width of the render texture \param height Height of the render texture \param depthBuffer Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the rendertexture) \return A new sfRenderTexture object, or NULL if it failed sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, sfBool depthBuffer);

func (RenderTexture) Clear

func (self RenderTexture) Clear(color Color)

Clear the rendertexture with the given color \param renderTexture Render texture object \param color Fill color void sfRenderTexture_clear(sfRenderTexture* renderTexture, sfColor color);

func (RenderTexture) Destroy

func (self RenderTexture) Destroy()

Destroy an existing render texture \param renderTexture Render texture to destroy void sfRenderTexture_destroy(sfRenderTexture* renderTexture);

func (RenderTexture) Display

func (self RenderTexture) Display()

Update the contents of the target texture \param renderTexture Render texture object void sfRenderTexture_display(sfRenderTexture* renderTexture);

func (RenderTexture) DrawCircleShapeDefault

func (self RenderTexture) DrawCircleShapeDefault(obj CircleShape)

void sfRenderTexture_drawCircleShape(sfRenderTexture* renderTexture, const sfCircleShape* object, const sfRenderStates* states);

func (RenderTexture) DrawRectangleShapeDefault

func (self RenderTexture) DrawRectangleShapeDefault(obj RectangleShape)

void sfRenderTexture_drawRectangleShape(sfRenderTexture* renderTexture, const sfRectangleShape* object, const sfRenderStates* states);

func (RenderTexture) DrawSpriteDefault

func (self RenderTexture) DrawSpriteDefault(obj Sprite)

Draw a drawable object to the render-target \param renderTexture Render texture object \param object Object to draw \param states Render states to use for drawing (NULL to use the default states) void sfRenderTexture_drawSprite(sfRenderTexture* renderTexture, const sfSprite* object, const sfRenderStates* states);

func (RenderTexture) DrawTextDefault

func (self RenderTexture) DrawTextDefault(obj Text)

void sfRenderTexture_drawText(sfRenderTexture* renderTexture, const sfText* object, const sfRenderStates* states);

func (RenderTexture) IsSmooth

func (self RenderTexture) IsSmooth() bool

Tell whether the smooth filter is enabled or not for a render texture \param renderTexture Render texture object \return sfTrue if smoothing is enabled, sfFalse if it is disabled sfBool sfRenderTexture_isSmooth(const sfRenderTexture* renderTexture);

func (RenderTexture) PopGLStates

func (self RenderTexture) PopGLStates()

Restore the previously saved OpenGL render states and matrices See the description of pushGLStates to get a detailed description of these functions. \param renderTexture Render texture object void sfRenderTexture_popGLStates(sfRenderTexture* renderTexture);

func (RenderTexture) PushGLStates

func (self 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: \li SFML's internal states are not messed up by your OpenGL code \li 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. \param renderTexture Render texture object void sfRenderTexture_pushGLStates(sfRenderTexture* renderTexture);

func (RenderTexture) ResetGLStates

func (self 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 sfRenderTexture_draw*() calls will work as expected. \param renderTexture Render texture object void sfRenderTexture_resetGLStates(sfRenderTexture* renderTexture);

func (RenderTexture) SetActive

func (self RenderTexture) SetActive(active bool) bool

Activate or deactivate a render texture as the current target for rendering \param renderTexture Render texture object \param active sfTrue to activate, sfFalse to deactivate \return True if operation was successful, false otherwise sfBool sfRenderTexture_setActive(sfRenderTexture* renderTexture, sfBool active);

func (RenderTexture) SetSmooth

func (self RenderTexture) SetSmooth(smooth bool)

Enable or disable the smooth filter on a render texture \param renderTexture Render texture object \param smooth sfTrue to enable smoothing, sfFalse to disable it void sfRenderTexture_setSmooth(sfRenderTexture* renderTexture, sfBool smooth);

func (RenderTexture) Size

func (self RenderTexture) Size() (uint, uint)

Get the size of the rendering region of a render texture \param renderTexture Render texture object \return Size in pixels sfVector2u sfRenderTexture_getSize(const sfRenderTexture* renderTexture);

func (RenderTexture) Texture

func (self RenderTexture) Texture() Texture

Get the target texture of a render texture \param renderTexture Render texture object \return Pointer to the target texture const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture);

type RenderWindow

type RenderWindow struct {
	Cref *C.sfRenderWindow
}

func NewRenderWindow

func NewRenderWindow(mode VideoMode, title string, style uint32, settings ContextSettings) RenderWindow

\brief Construct a new render window

\param mode Video mode to use \param title Title of the window \param style Window style \param settings Creation settings (pass NULL to use default values)

sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);

func NewRenderWindowDefault

func NewRenderWindowDefault(mode VideoMode, title string) RenderWindow

func (RenderWindow) Capture

func (self RenderWindow) Capture() Image

Copy the current contents of a render window to an image This 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. \param renderWindow Render window object \return New image containing the captured contents sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow);

func (RenderWindow) Clear

func (self RenderWindow) Clear(color Color)

Clear a render window with the given color \param renderWindow Render window object \param color Fill color void sfRenderWindow_clear(sfRenderWindow* renderWindow, sfColor color);

func (RenderWindow) Close

func (self RenderWindow) Close()

Close a render window (but doesn't destroy the internal data) \param renderWindow Render window to close void sfRenderWindow_close(sfRenderWindow* renderWindow);

func (RenderWindow) Destroy

func (self RenderWindow) Destroy()

Destroy an existing render window \param renderWindow Render window to destroy void sfRenderWindow_destroy(sfRenderWindow* renderWindow);

func (RenderWindow) Display

func (self RenderWindow) Display()

Display a render window on screen \param renderWindow Render window object void sfRenderWindow_display(sfRenderWindow* renderWindow);

func (RenderWindow) Drain

func (self RenderWindow) Drain()

func (RenderWindow) DrawCircleShapeDefault

func (self RenderWindow) DrawCircleShapeDefault(obj CircleShape)

void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWindow, const sfCircleShape* object, const sfRenderStates* states);

func (RenderWindow) DrawRectangleShapeDefault

func (self RenderWindow) DrawRectangleShapeDefault(obj RectangleShape)

void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow, const sfRectangleShape* object, const sfRenderStates* states);

func (RenderWindow) DrawSpriteDefault

func (self RenderWindow) DrawSpriteDefault(obj Sprite)

// Change the current active view of a render window // \param renderWindow Render window object // \param view Pointer to the new view // void sfRenderWindow_setView(sfRenderWindow* renderWindow, const sfView* view);

func (self RenderWindow) Setview(view *View ) void {
    return C.sfRenderWindow_setView(self.Cref, sf(*View));
}

// Get the current active view of a render window // \param renderWindow Render window object // \return Current active view // const sfView* sfRenderWindow_getView(const sfRenderWindow* renderWindow);

func (self *View) *View(RenderWindow_getView)  {
    return C.sf*View(self.Cref, sf(*View));
}

// Get the default view of a render window // \param renderWindow Render window object // \return Default view of the render window // const sfView* sfRenderWindow_getDefaultView(const sfRenderWindow* renderWindow);

func (self *View) *View(RenderWindow_getDefaultView)  {
    return C.sf*View(self.Cref, sf(*View));
}

// Get the viewport of a view applied to this target // \param renderWindow Render window object // \param view Target view // \return Viewport rectangle, expressed in pixels in the current target // sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const sfView* view);

func (self RenderWindow) Getviewport(view *View ) IntRect {
    return C.sfRenderWindow_getViewport(self.Cref, sf(*View));
}

// Convert a point in window coordinates into view coordinates // \param renderWindow Render window object // \param point Point to convert, relative to the window // \param targetView Target view to convert the point to (pass NULL to use the current view) // \return The converted point, in "world" units // sfVector2f sfRenderWindow_convertCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView);

func (self RenderWindow) Convertcoords(point Vector2i, targetView *View ) Vector2f {
    return C.sfRenderWindow_convertCoords(self.Cref, sfVector2i(point), sf(*View));
}

Draw a drawable object to the render-target \param renderWindow render window object \param object Object to draw \param states Render states to use for drawing (NULL to use the default states) void sfRenderWindow_drawSprite(sfRenderWindow* renderWindow, const sfSprite* object, const sfRenderStates* states);

func (self RenderWindow) DrawSprite(object *Sprite , states *RenderStates ) {
    return C.sfRenderWindow_drawSprite(self.Cref, sf(*Sprite), sf(*RenderStates));
}

func (RenderWindow) DrawTextDefault

func (self RenderWindow) DrawTextDefault(obj Text)

void sfRenderWindow_drawText(sfRenderWindow* renderWindow, const sfText* object, const sfRenderStates* states);

func (self RenderWindow) Drawtext(object *Text , states *RenderStates ) void {
    return C.sfRenderWindow_drawText(self.Cref, sf(*Text), sf(*RenderStates));
}

func (RenderWindow) GetSize

func (self RenderWindow) GetSize() (x, y uint)

Get the size of the rendering region of a render window \param renderWindow Render window object \return Size in pixels sfVector2u sfRenderWindow_getSize(const sfRenderWindow* renderWindow);

func (RenderWindow) IsOpen

func (self RenderWindow) IsOpen() bool

Tell whether or not a render window is opened \param renderWindow Render window object sfBool sfRenderWindow_isOpen(const sfRenderWindow* renderWindow);

func (RenderWindow) PollEvent

func (self RenderWindow) PollEvent() (interface{}, bool)

Get the event on top of events stack of a render window, if any, and pop it \param renderWindow Render window object \param event Event to fill, if any \return sfTrue if an event was returned, sfFalse if events stack was empty sfBool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event);

func (RenderWindow) PopGLStates

func (self RenderWindow) PopGLStates()

Restore the previously saved OpenGL render states and matrices See the description of pushGLStates to get a detailed description of these functions. \param renderWindow render window object void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow);

func (RenderWindow) Position

func (self RenderWindow) Position() (int, int)

Get the position of a render window \param renderWindow Render window object \return Position in pixels sfVector2i sfRenderWindow_getPosition(const sfRenderWindow* renderWindow);

func (RenderWindow) PushGLStates

func (self 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: \li SFML's internal states are not messed up by your OpenGL code \li 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. \param renderWindow render window object void sfRenderWindow_pushGLStates(sfRenderWindow* renderWindow);

func (RenderWindow) ResetGLStates

func (self 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 sfRenderWindow_draw*() calls will work as expected. \param renderWindow render window object void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow);

func (RenderWindow) SetActive

func (self RenderWindow) SetActive(active bool) bool

Activate or deactivate a render window as the current target for rendering \param renderWindow Render window object \param active sfTrue to activate, sfFalse to deactivate \return True if operation was successful, false otherwise sfBool sfRenderWindow_setActive(sfRenderWindow* renderWindow, sfBool active);

func (RenderWindow) SetFramerateLimit

func (self RenderWindow) SetFramerateLimit(limit uint)

Limit the framerate to a maximum fixed frequency for a render window \param renderWindow Render window object \param limit Framerate limit, in frames per seconds (use 0 to disable limit)

void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit);

func (RenderWindow) SetJoystickThreshold

func (self RenderWindow) SetJoystickThreshold(threshold float32)

Change the joystick threshold, ie. the value below which no move event will be generated \param renderWindow Render window object \param threshold New threshold, in range [0, 100] void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold);

func (RenderWindow) SetKeyRepeatEnabled

func (self RenderWindow) SetKeyRepeatEnabled(enabled bool)

Enable or disable automatic key-repeat for keydown events Automatic key-repeat is enabled by default \param renderWindow Render window object \param enabled sfTrue to enable, sfFalse to disable void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled);

func (RenderWindow) SetMouseCursorVisible

func (self RenderWindow) SetMouseCursorVisible(show bool)

Show or hide the mouse cursor on a render window \param renderWindow Render window object \param show sfTrue to show, sfFalse to hide void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool show);

func (RenderWindow) SetPosition

func (self RenderWindow) SetPosition(x, y int)

Change the position of a render window on screen Only works for top-level windows \param renderWindow Render window object \param position New position, in pixels void sfRenderWindow_setPosition(sfRenderWindow* renderWindow, sfVector2i position);

func (RenderWindow) SetSize

func (self RenderWindow) SetSize(x, y uint)

Change the size of the rendering region of a render window \param renderWindow Render window object \param size New size, in pixels void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size);

func (RenderWindow) SetTitle

func (self RenderWindow) SetTitle(title string)

Change the title of a render window \param renderWindow Render window object \param title New title void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title);

func (RenderWindow) SetVerticalSyncEnabled

func (self RenderWindow) SetVerticalSyncEnabled(enabled bool)

Enable / disable vertical synchronization on a render window \param renderWindow Render window object \param enabled sfTrue to enable v-sync, sfFalse to deactivate void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled);

func (RenderWindow) SetVisible

func (self RenderWindow) SetVisible(visible bool)

Show or hide a render window \param renderWindow Render window object \param visible sfTrue to show the window, sfFalse to hide it void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, sfBool visible);

func (RenderWindow) Settings

func (self RenderWindow) Settings() ContextSettings

Get the creation settings of a render window \param renderWindow Render window object \return Settings used to create the window sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow);

func (RenderWindow) ToWindow

func (self RenderWindow) ToWindow() Window

func (RenderWindow) WaitEvent

func (self RenderWindow) WaitEvent(event Event) bool

Wait for an event and return it \param renderWindow Render window object \param event Event to fill \return sfFalse if an error occured sfBool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfEvent* event);

type Shader

type Shader struct {
	Cref *C.sfShader
}

func NewShaderFromFile

func NewShaderFromFile(vertexShaderFilename, fragmentShaderFilename string) Shader

\brief 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 NULL 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. \param vertexShaderFilename Path of the vertex shader file to load, or NULL to skip this shader \param fragmentShaderFilename Path of the fragment shader file to load, or NULL to skip this shader \return A new sfShader object, or NULL if it failed sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* fragmentShaderFilename);

func (Shader) Bind

func (self Shader) Bind()

\brief Bind a shader for rendering (activate it) This function is normally for internal use only, unless you want to use the shader with a custom OpenGL rendering instead of a SFML drawable. \code sfWindow_setActive(window, sfTrue); sfShader_bind(shader); ... render OpenGL geometry ... sfShader_unbind(shader); \endcode \param shader Shader to bind void sfShader_bind(const sfShader* shader);

func (Shader) Destroy

func (self Shader) Destroy()

\brief Destroy an existing shader \param shader Shader to delete void sfShader_destroy(sfShader* shader);

func (Shader) IsAvailable

func (self Shader) IsAvailable() bool

\brief 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 sfShader will fail. \return sfTrue if the system can use shaders, sfFalse otherwise sfBool sfShader_isAvailable(void);

func (Shader) SetColorParameter

func (self Shader) SetColorParameter(name string, color Color)

\brief Change a color parameter of a shader \a 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. Example: \code uniform vec4 color; // this is the variable in the shader \endcode \code sfShader_setColorParameter(shader, "color", sfColor_FromRGB(255, 128, 0)); \endcode \param shader Shader object \param name Name of the parameter in the shader \param color Color to assign void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);

func (Shader) SetCurrentTextureParameter

func (self Shader) SetCurrentTextureParameter(name string)

\brief 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). Example: \code uniform sampler2D current; // this is the variable in the shader \endcode \code sfShader_setCurrentTextureParameter(shader, "current"); \endcode \param shader Shader object \param name Name of the texture in the shader void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);

func (Shader) SetFloat2Parameter

func (self Shader) SetFloat2Parameter(name string, x, y float32)

\brief Change a 2-components vector parameter of a shader \a name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 2x1 vector (vec2 GLSL type). Example: \code uniform vec2 myparam; // this is the variable in the shader \endcode \code sfShader_setFloat2Parameter(shader, "myparam", 5.2f, 6.0f); \endcode \param shader Shader object \param name Name of the parameter in the shader \param x First component of the value to assign \param y Second component of the value to assign void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y);

func (Shader) SetFloat3Parameter

func (self Shader) SetFloat3Parameter(name string, x, y, z float32)

\brief Change a 3-components vector parameter of a shader \a name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 3x1 vector (vec3 GLSL type). Example: \code uniform vec3 myparam; // this is the variable in the shader \endcode \code sfShader_setFloat3Parameter(shader, "myparam", 5.2f, 6.0f, -8.1f); \endcode \param shader Shader object \param name Name of the parameter in the shader \param x First component of the value to assign \param y Second component of the value to assign \param z Third component of the value to assign void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);

func (Shader) SetFloatParameter

func (self Shader) SetFloatParameter(name string, x float32)

\brief Change a float parameter of a shader \a name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a float (float GLSL type). Example: \code uniform float myparam; // this is the variable in the shader \endcode \code sfShader_setFloatParameter(shader, "myparam", 5.2f); \endcode \param shader Shader object \param name Name of the parameter in the shader \param x Value to assign void sfShader_setFloatParameter(sfShader* shader, const char* name, float x);

func (Shader) SetTextureParameter

func (self Shader) SetTextureParameter(name string, texture Texture)

\brief Change a texture parameter of a shader \a 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). Example: \code uniform sampler2D the_texture; // this is the variable in the shader \endcode \code sf::Texture texture; ... sfShader_setTextureParameter(shader, "the_texture", texture); \endcode It is important to note that \a texture must remain alive as long as the shader uses it, no copy is made internally. To use the texture of the object being draw, which cannot be known in advance, you can use the special function sfShader_setCurrentTextureParameter: \code sfShader_setCurrentTextureParameter(shader, "the_texture"). \endcode \param shader Shader object \param name Name of the texture in the shader \param texture Texture to assign void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);

func (Shader) SetTransformParameter

func (self Shader) SetTransformParameter(name string, transform Transform)

\brief Change a matrix parameter of a shader \a 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). Example: \code uniform mat4 matrix; // this is the variable in the shader \endcode \code @todo sfShader_setTransformParameter(shader, "matrix", transform); \endcode \param shader Shader object \param name Name of the parameter in the shader \param transform Transform to assign void sfShader_setTransformParameter(sfShader* shader, const char* name, const sfTransform* transform);

func (Shader) SetVector2Parameter

func (self Shader) SetVector2Parameter(name string, x, y float32)

\brief Change a 2-components vector parameter of a shader \a name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 2x1 vector (vec2 GLSL type). Example: \code uniform vec2 myparam; // this is the variable in the shader \endcode \code sfVector2f vec = {5.2f, 6.0f}; sfShader_setVector2Parameter(shader, "myparam", vec); \endcode \param shader Shader object \param name Name of the parameter in the shader \param vector Vector to assign void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector);

func (Shader) SetVector3parameter

func (self Shader) SetVector3parameter(name string, vector Vector3f)

\brief Change a 3-components vector parameter of a shader \a name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 3x1 vector (vec3 GLSL type). Example: \code uniform vec3 myparam; // this is the variable in the shader \endcode \code sfVector3f vec = {5.2f, 6.0f, -8.1f}; sfShader_setVector3Parameter(shader, "myparam", vec); \endcode \param shader Shader object \param name Name of the parameter in the shader \param vector Vector to assign void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);

func (Shader) Setfloat4parameter

func (self Shader) Setfloat4parameter(name string, x, y, z, w float32)

\brief Change a 4-components vector parameter of a shader \a 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). Example: \code uniform vec4 myparam; // this is the variable in the shader \endcode \code sfShader_setFloat4Parameter(shader, "myparam", 5.2f, 6.0f, -8.1f, 0.4f); \endcode \param shader Shader object \param name Name of the parameter in the shader \param x First component of the value to assign \param y Second component of the value to assign \param z Third component of the value to assign \param w Fourth component of the value to assign void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w);

type SizeEvent

type SizeEvent struct {
	Type EventType
	Cref *C.sfSizeEvent
}

////////////////////////////////////////////////////////// / \brief Size events parameters / ////////////////////////////////////////////////////////// struct sfSizeEvent

{
    sfEventType  type;
    unsigned int width;
    unsigned int height;
};

func (SizeEvent) Height

func (self SizeEvent) Height() int

func (SizeEvent) Width

func (self SizeEvent) Width() int

type Sound

type Sound struct {
	Cref *C.sfSound
}

func (Sound) Copy

func (self Sound) Copy() Sound

\brief Create a new sound by copying an existing one \param sound Sound to copy \return A new sfSound object which is a copy of \a sound sfSound* sfSound_copy(sfSound* sound);

func (Sound) Destroy

func (self Sound) Destroy()

\brief Destroy a sound \param sound Sound to destroy void sfSound_destroy(sfSound* sound);

func (Sound) GetAttenuation

func (self Sound) GetAttenuation() float32

\brief Get the attenuation factor of a sound \param sound Sound object \return Attenuation factor of the sound float sfSound_getAttenuation(const sfSound* sound);

func (Sound) GetLoop

func (self Sound) GetLoop() bool

\brief Tell whether or not a soud is in loop mode \param sound Sound object \return sfTrue if the sound is looping, sfFalse otherwise sfBool sfSound_getLoop(const sfSound* sound);

func (Sound) GetPlayingOffset

func (self Sound) GetPlayingOffset() Time

\brief Get the current playing position of a sound \param sound Sound object \return Current playing position sfTime sfSound_getPlayingOffset(const sfSound* sound);

func (Sound) GetVolume

func (self Sound) GetVolume() float32

\brief Get the volume of a sound \param sound Sound object \return Volume of the sound, in the range [0, 100] float sfSound_getVolume(const sfSound* sound);

func (Sound) Getmindistance

func (self Sound) Getmindistance() float32

\brief Get the minimum distance of a sound \param sound Sound object \return Minimum distance of the sound float sfSound_getMinDistance(const sfSound* sound);

func (Sound) Getpitch

func (self Sound) Getpitch() float32

\brief Get the pitch of a sound \param sound Sound object \return Pitch of the sound float sfSound_getPitch(const sfSound* sound);

func (Sound) Getposition

func (self Sound) Getposition() (v Vector3f)

\brief Get the 3D position of a sound in the audio scene \param sound Sound object \return Position of the sound in the world sfVector3f sfSound_getPosition(const sfSound* sound);

func (Sound) Getstatus

func (self Sound) Getstatus() SoundStatus

\brief Get the current status of a sound (stopped, paused, playing) \param sound Sound object \return Current status sfSoundStatus sfSound_getStatus(const sfSound* sound);

func (Sound) IsRelativeToListener

func (self Sound) IsRelativeToListener() bool

\brief Tell whether a sound's position is relative to the

listener or is absolute

\param sound Sound object \return sfTrue if the position is relative, sfFalse if it's absolute sfBool sfSound_isRelativeToListener(const sfSound* sound);

func (Sound) NewSound

func (self Sound) NewSound() Sound

\brief Create a new sound \return A new sfSound object sfSound* sfSound_create(void);

func (Sound) Pause

func (self Sound) Pause()

\brief Pause a sound This function pauses the sound if it was playing, otherwise (sound already paused or stopped) it has no effect. \param sound Sound object void sfSound_pause(sfSound* sound);

func (Sound) Play

func (self Sound) Play()

\brief 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. \param sound Sound object void sfSound_play(sfSound* sound);

func (Sound) SetLoop

func (self Sound) SetLoop(loop bool)

\brief 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 sfSound_setLoop(sound, sfFalse) is called. The default looping state for sounds is false. \param sound Sound object \param loop sfTrue to play in loop, sfFalse to play once void sfSound_setLoop(sfSound* sound, sfBool loop);

func (Sound) SetMinDistance

func (self Sound) SetMinDistance(distance float32)

\brief 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. \param sound Sound object \param distance New minimum distance of the sound void sfSound_setMinDistance(sfSound* sound, float distance);

func (Sound) SetPitch

func (self Sound) SetPitch(pitch float32)

\brief 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. \param sound Sound object \param pitch New pitch to apply to the sound void sfSound_setPitch(sfSound* sound, float pitch);

func (Sound) SetPlayingOffset

func (self Sound) SetPlayingOffset(timeOffset Time)

\brief Change the current playing position of a sound The playing position can be changed when the sound is either paused or playing. \param sound Sound object \param timeOffset New playing position void sfSound_setPlayingOffset(sfSound* sound, sfTime timeOffset);

func (Sound) SetPosition

func (self Sound) SetPosition(v Vector3f)

\brief 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). \param sound Sound object \param position Position of the sound in the scene void sfSound_setPosition(sfSound* sound, sfVector3f position);

func (Sound) SetVolume

func (self Sound) SetVolume(volume float32)

\brief Set the volume of a sound The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100. \param sound Sound object \param volume Volume of the sound void sfSound_setVolume(sfSound* sound, float volume);

func (Sound) Setattenuation

func (self Sound) Setattenuation(attenuation float32)

func (Sound) Stop

func (self Sound) Stop()

\brief Stop playing a sound// This function stops the sound if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike sfSound_pause). \param sound Sound object void sfSound_stop(sfSound* sound);

type SoundBuffer

type SoundBuffer struct {
	Cref *C.sfSoundBuffer
}

func SoundBufferFromFile

func SoundBufferFromFile(filename string) SoundBuffer

\brief 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. \param filename Path of the sound file to load \return A new sfSoundBuffer object (NULL if failed) sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename);

func (SoundBuffer) Copy

func (self SoundBuffer) Copy() SoundBuffer

\brief Create a new sound buffer by copying an existing one \param soundBuffer Sound buffer to copy \return A new sfSoundBuffer object which is a copy of \a soundBuffer sfSoundBuffer* sfSoundBuffer_copy(sfSoundBuffer* soundBuffer);

func (SoundBuffer) Destroy

func (self SoundBuffer) Destroy()

\brief Destroy a sound buffer \param soundBuffer Sound buffer to destroy void sfSoundBuffer_destroy(sfSoundBuffer* soundBuffer);

func (SoundBuffer) GetChannelCount

func (self SoundBuffer) GetChannelCount() uint

\brief 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. \param soundBuffer Sound buffer object \return Number of channels unsigned int sfSoundBuffer_getChannelCount(const sfSoundBuffer* soundBuffer);

func (SoundBuffer) GetSampleCount

func (self SoundBuffer) GetSampleCount() C.size_t

TODO Verify how to handle size_t in this context. \brief Get the number of samples stored in a sound buffer The array of samples can be accessed with the sfSoundBuffer_getSamples function. \param soundBuffer Sound buffer object \return Number of samples size_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);

func (SoundBuffer) GetSampleRate

func (self SoundBuffer) GetSampleRate() uint

\brief 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). \param soundBuffer Sound buffer object \return Sample rate (number of samples per second) unsigned int sfSoundBuffer_getSampleRate(const sfSoundBuffer* soundBuffer);

func (SoundBuffer) Getduration

func (self SoundBuffer) Getduration() Time

\brief Get the total duration of a sound buffer \param soundBuffer Sound buffer object \return Sound duration sfTime sfSoundBuffer_getDuration(const sfSoundBuffer* soundBuffer);

func (SoundBuffer) SaveToFile

func (self SoundBuffer) SaveToFile(filename string) bool

\brief 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. \param soundBuffer Sound buffer object \param filename Path of the sound file to write \return sfTrue if saving succeeded, sfFalse if it failed sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename);

type SoundBufferRecorder

type SoundBufferRecorder struct {
	Cref *C.sfSoundBufferRecorder
}

func NewSoundBufferRecorder

func NewSoundBufferRecorder() SoundBufferRecorder

\brief Create a new sound buffer recorder \return A new sfSoundBufferRecorder object (NULL if failed) sfSoundBufferRecorder* sfSoundBufferRecorder_create(void);

func (SoundBufferRecorder) Destroy

func (self SoundBufferRecorder) Destroy()

\brief Destroy a sound buffer recorder \param soundBufferRecorder Sound buffer recorder to destroy void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundBufferRecorder);

func (SoundBufferRecorder) GetBuffer

func (self SoundBufferRecorder) GetBuffer() SoundBuffer

\brief Get the sound buffer containing the captured audio data The sound buffer is valid only after the capture has ended. This function provides a read-only access to the internal sound buffer, but it can be copied if you need to make any modification to it. \param soundBufferRecorder Sound buffer recorder object \return Read-only access to the sound buffer const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder* soundBufferRecorder);

func (SoundBufferRecorder) GetSampleRate

func (self SoundBufferRecorder) GetSampleRate() uint

\brief 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). \param soundBufferRecorder Sound buffer recorder object \return Sample rate, in samples per second unsigned int sfSoundBufferRecorder_getSampleRate(const sfSoundBufferRecorder* soundBufferRecorder);

func (SoundBufferRecorder) Start

func (self SoundBufferRecorder) Start(sampleRate uint)

\brief Start the capture of a sound recorder recorder The \a 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. \param soundBufferRecorder Sound buffer recorder object \param sampleRate Desired capture rate, in number of samples per second void sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);

func (SoundBufferRecorder) Stop

func (self SoundBufferRecorder) Stop()

\brief Stop the capture of a sound recorder \param soundBufferRecorder Sound buffer recorder object void sfSoundBufferRecorder_stop(sfSoundBufferRecorder* soundBufferRecorder);

type SoundStatus

type SoundStatus uint
const (
	Stopped SoundStatus = iota // Sound / music is not playing
	Paused                     // Sound / music is paused
	Playing                    // Sound / music is playing
	UnknownSoundStatus
)

type Sprite

type Sprite struct {
	Cref *C.sfSprite
}

func NewSprite

func NewSprite() (Sprite, error)

Create a new sprite \return A new sfSprite object, or NULL if it failed sfSprite* sfSprite_create(void);

func (Sprite) Color

func (self Sprite) Color() Color

Get the global color of a sprite \param sprite Sprite object \return Global color of the sprite sfColor sfSprite_getColor(const sfSprite* sprite);

func (Sprite) Copy

func (self Sprite) Copy() Sprite

Copy an existing sprite \param sprite Sprite to copy \return Copied object sfSprite* sfSprite_copy(sfSprite* sprite);

func (Sprite) Destroy

func (self Sprite) Destroy()

Destroy an existing sprite \param sprite Sprite to delete void sfSprite_destroy(sfSprite* sprite);

func (Sprite) GetScale

func (self Sprite) GetScale() (float32, float32)

Get the current scale of a sprite \param sprite Sprite object \return Current scale factors sfVector2f sfSprite_getScale(const sfSprite* sprite);

func (Sprite) GlobalBounds

func (self Sprite) GlobalBounds() FloatRect

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. \param sprite Sprite object \return Global bounding rectangle of the entity sfFloatRect sfSprite_getGlobalBounds(const sfSprite* sprite);

func (Sprite) InverseTransform

func (self Sprite) InverseTransform() Transform

Get the inverse of the combined transform of a sprite \param sprite Sprite object \return Inverse of the combined transformations applied to the object const sfTransform* sfSprite_getInverseTransform(const sfSprite* sprite);

func (Sprite) LocalBounds

func (self Sprite) LocalBounds() FloatRect

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. \param sprite Sprite object \return Local bounding rectangle of the entity sfFloatRect sfSprite_getLocalBounds(const sfSprite* sprite);

func (Sprite) Move

func (self Sprite) Move(x, y float32)

Move a sprite by a given offset This function adds to the current position of the object, unlike sfSprite_setPosition which overwrites it. \param sprite Sprite object \param offset Offset void sfSprite_move(sfSprite* sprite, sfVector2f offset);

func (Sprite) Origin

func (self Sprite) Origin() (float32, float32)

Get the local origin of a sprite \param sprite Sprite object \return Current origin sfVector2f sfSprite_getOrigin(const sfSprite* sprite);

func (Sprite) Position

func (self Sprite) Position() (float32, float32)

Get the position of a sprite \param sprite Sprite object \return Current position sfVector2f sfSprite_getPosition(const sfSprite* sprite);

func (Sprite) Rotate

func (self Sprite) Rotate(angle float32)

Rotate a sprite This function adds to the current rotation of the object, unlike sfSprite_setRotation which overwrites it. \param sprite Sprite object \param angle Angle of rotation, in degrees void sfSprite_rotate(sfSprite* sprite, float angle);

func (Sprite) Rotation

func (self Sprite) Rotation() float32

Get the orientation of a sprite The rotation is always in the range [0, 360]. \param sprite Sprite object \return Current rotation, in degrees float sfSprite_getRotation(const sfSprite* sprite);

func (Sprite) Scale

func (self Sprite) Scale(x, y float32)

Scale a sprite This function multiplies the current scale of the object, unlike sfSprite_setScale which overwrites it. \param sprite Sprite object \param factors Scale factors void sfSprite_scale(sfSprite* sprite, sfVector2f factors);

func (Sprite) SetColor

func (self Sprite) SetColor(color Color)

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. \param sprite Sprite object \param color New color of the sprite void sfSprite_setColor(sfSprite* sprite, sfColor color);

func (Sprite) SetOrigin

func (self Sprite) SetOrigin(x, y float32)

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). \param sprite Sprite object \param origin New origin void sfSprite_setOrigin(sfSprite* sprite, sfVector2f origin);

func (Sprite) SetPosition

func (self Sprite) SetPosition(x, y float32)

Set the position of a sprite This function completely overwrites the previous position. See sfSprite_move to apply an offset based on the previous position instead. The default position of a sprite Sprite object is (0, 0). \param sprite Sprite object \param position New position void sfSprite_setPosition(sfSprite* sprite, sfVector2f position);

func (Sprite) SetRotation

func (self Sprite) SetRotation(angle float32)

Set the orientation of a sprite This function completely overwrites the previous rotation. See sfSprite_rotate to add an angle based on the previous rotation instead. The default rotation of a sprite Sprite object is 0. \param sprite Sprite object \param angle New rotation, in degrees void sfSprite_setRotation(sfSprite* sprite, float angle);

func (Sprite) SetScale

func (self Sprite) SetScale(x, y float32)

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). \param sprite Sprite object \param scale New scale factors void sfSprite_setScale(sfSprite* sprite, sfVector2f scale);

func (Sprite) SetTexture

func (self Sprite) SetTexture(tex Texture, resetRect bool)

Change the source texture of a sprite The \a 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 \a 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. \param sprite Sprite object \param texture New texture \param resetRect Should the texture rect be reset to the size of the new texture? void sfSprite_setTexture(sfSprite* sprite, const sfTexture* texture, sfBool resetRect);

func (Sprite) SetTextureRect

func (self Sprite) SetTextureRect(rect IntRect)

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. \param sprite Sprite object \param rectangle Rectangle defining the region of the texture to display void sfSprite_setTextureRect(sfSprite* sprite, sfIntRect rectangle);

func (Sprite) Texture

func (self Sprite) Texture() Texture

Get the source texture of a sprite If the sprite has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function. \param sprite Sprite object \return Pointer to the sprite's texture const sfTexture* sfSprite_getTexture(const sfSprite* sprite);

func (Sprite) TextureRect

func (self Sprite) TextureRect() IntRect

Get the sub-rectangle of the texture displayed by a sprite \param sprite Sprite object \return Texture rectangle of the sprite sfIntRect sfSprite_getTextureRect(const sfSprite* sprite);

func (Sprite) Transform

func (self Sprite) Transform() Transform

Get the combined transform of a sprite \param sprite Sprite object \return Transform combining the position/rotation/scale/origin of the object const sfTransform* sfSprite_getTransform(const sfSprite* sprite);

type Text

type Text struct {
	Cref *C.sfText
}

func NewText

func NewText() (Text, error)

sfText styles Create a new text \return A new sfText object, or NULL if it failed sfText* sfText_create(void);

func (Text) CharacterSize

func (self Text) CharacterSize() uint

Get the size of the characters of a text \param text Text object \return Size of the characters unsigned int sfText_getCharacterSize(const sfText* text);

func (Text) Color

func (self Text) Color() Color

Get the global color of a text \param text Text object \return Global color of the text sfColor sfText_getColor(const sfText* text);

func (Text) Copy

func (self Text) Copy() Text

Copy an existing text \param text Text to copy \return Copied object sfText* sfText_copy(sfText* text);

func (Text) Destroy

func (self Text) Destroy()

Destroy an existing text \param text Text to delete void sfText_destroy(sfText* text);

func (Text) FindCharacterPos

func (self Text) FindCharacterPos(index uint) Vector2f

Return the position of the \a 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 \a index is out of range, the position of the end of the string is returned. \param text Text object \param index Index of the character \return Position of the character sfVector2f sfText_findCharacterPos(const sfText* text, size_t index);

func (Text) Font

func (self Text) Font() Font

Get the font used by a text \param text Text object \return Pointer to the font const sfFont* sfText_getFont(const sfText* text);

func (Text) GetScale

func (self Text) GetScale() (x, y float32)

Get the current scale of a text \param text Text object \return Current scale factors sfVector2f sfText_getScale(const sfText* text);

func (Text) GlobalBounds

func (self Text) GlobalBounds() FloatRect

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. \param text Text object \return Global bounding rectangle of the entity sfFloatRect sfText_getGlobalBounds(const sfText* text);

func (Text) InverseTransform

func (self Text) InverseTransform() Transform

Get the inverse of the combined transform of a text \param text Text object \return Inverse of the combined transformations applied to the object const sfTransform* sfText_getInverseTransform(const sfText* text);

func (Text) LocalBounds

func (self Text) LocalBounds() FloatRect

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. \param text Text object \return Local bounding rectangle of the entity sfFloatRect sfText_getLocalBounds(const sfText* text);

func (Text) Move

func (self Text) Move(x, y float32)

Move a text by a given offset This function adds to the current position of the object, unlike sfText_setPosition which overwrites it. \param text Text object \param offset Offset void sfText_move(sfText* text, sfVector2f offset);

func (Text) Origin

func (self Text) Origin() (x, y float32)

Get the local origin of a text \param text Text object \return Current origin sfVector2f sfText_getOrigin(const sfText* text);

func (Text) Position

func (self Text) Position(x, y float32) (float32, float32)

Get the position of a text \param text Text object \return Current position sfVector2f sfText_getPosition(const sfText* text);

func (Text) Rotate

func (self Text) Rotate(angle float32)

Rotate a text This function adds to the current rotation of the object, unlike sfText_setRotation which overwrites it. \param text Text object \param angle Angle of rotation, in degrees void sfText_rotate(sfText* text, float angle);

func (Text) Rotation

func (self Text) Rotation() float32

Get the orientation of a text The rotation is always in the range [0, 360]. \param text Text object \return Current rotation, in degrees float sfText_getRotation(const sfText* text);

func (Text) Scale

func (self Text) Scale(x, y float32)

Scale a text This function multiplies the current scale of the object, unlike sfText_setScale which overwrites it. \param text Text object \param factors Scale factors void sfText_scale(sfText* text, sfVector2f factors);

func (Text) SetCharacterSize

func (self Text) SetCharacterSize(size int)

Set the character size of a text The default size is 30. \param text Text object \param size New character size, in pixels void sfText_setCharacterSize(sfText* text, unsigned int size);

func (Text) SetColor

func (self Text) SetColor(color Color)

Set the global color of a text By default, the text's color is opaque white. \param text Text object \param color New color of the text void sfText_setColor(sfText* text, sfColor color);

func (Text) SetFont

func (self Text) SetFont(font Font)

Set the font of a text The \a font argument refers to a texture that must exist as long as the text uses it. Indeed, the text doesn't store its own copy of the font, but rather keeps a pointer to the one that you passed to this function. If the font is destroyed and the text tries to use it, the behaviour is undefined. Texts have a valid font by default, which the built-in sfFont_getDefaultFont(). \param text Text object \param font New font void sfText_setFont(sfText* text, const sfFont* font);

func (Text) SetOrigin

func (self Text) SetOrigin(x, y float32)

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). \param text Text object \param origin New origin void sfText_setOrigin(sfText* text, sfVector2f origin);

func (Text) SetPosition

func (self Text) SetPosition(x, y float32)

Set the position of a text This function completely overwrites the previous position. See sfText_move to apply an offset based on the previous position instead. The default position of a text Text object is (0, 0). \param text Text object \param position New position void sfText_setPosition(sfText* text, sfVector2f position);

func (Text) SetRotation

func (self Text) SetRotation(angle float32)

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. \param text Text object \param angle New rotation, in degrees void sfText_setRotation(sfText* text, float angle);

func (Text) SetScale

func (self Text) SetScale(x, y float32)

Set the scale factors of a text This function completely overwrites the previous scale. See sfText_scale to add a factor based on the previous scale instead. The default scale of a text Text object is (1, 1). \param text Text object \param scale New scale factors void sfText_setScale(sfText* text, sfVector2f scale);

func (Text) SetString

func (self Text) SetString(s string)

Set the string of a text (from an ANSI string) A text's string is empty by default. \param text Text object \param string New string void sfText_setString(sfText* text, const char* string);

func (Text) SetStyle

func (self Text) SetStyle(style uint32)

Set the style of a text You can pass a combination of one or more styles, for example sfTextBold | sfTextItalic. The default style is sfTextRegular. \param text Text object \param style New style void sfText_setStyle(sfText* text, sfUint32 style);

func (Text) SetUnicodeString

func (self Text) SetUnicodeString(s string)

Set the string of a text (from a unicode string) \param text Text object \param string New string void sfText_setUnicodeString(sfText* text, const sfUint32* string);

func (Text) String

func (self Text) String() string

Get the text of a text (returns an ANSI string) \param text Text object \return String an a locale-dependant ANSI string const char* sfText_getString(const sfText* text);

func (Text) Style

func (self Text) Style() uint

Get the style of a text \param text Text object \return Current string style (see sfTextStyle enum) sfUint32 sfText_getStyle(const sfText* text);

func (Text) Transform

func (self Text) Transform() Transform

Get the combined transform of a text \param text Text object \return Transform combining the position/rotation/scale/origin of the object const sfTransform* sfText_getTransform(const sfText* text);

func (Text) UnicodeString

func (self Text) UnicodeString() string

Get the string of a text (returns a unicode string) \param text Text object \return String as UTF-32 const sfUint32* sfText_getUnicodeString(const sfText* text);

type TextEvent

type TextEvent struct {
	Type EventType
	Cref *C.sfTextEvent
}

////////////////////////////////////////////////////////// / \brief Text event parameters / ////////////////////////////////////////////////////////// struct sfTextEvent

{
    sfEventType type;
    sfUint32    unicode;
};

type Texture

type Texture struct {
	Cref *C.sfTexture
}

func NewTexture

func NewTexture(w, h int) Texture

\brief Create a new texture \param width Texture width \param height Texture height \return A new sfTexture object, or NULL if it failed sfTexture* sfTexture_create(unsigned int width, unsigned int height);

func TextureFromFile

func TextureFromFile(fname string, area IntRect) (Texture, error)

\brief Create a new texture from a file \param filename Path of the image file to load \param area Area of the source image to load (NULL to load the entire image) \return A new sfTexture object, or NULL if it failed sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area);

func TextureFromImageRect

func TextureFromImageRect(img Image, area IntRect) (Texture, error)

\brief Create a new texture from an image \param image Image to upload to the texture \param area Area of the source image to load (NULL to load the entire image) \return A new sfTexture object, or NULL if it failed sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area);

func TextureFromImageWhole

func TextureFromImageWhole(img Image) (Texture, error)

func (Texture) Bind

func (self Texture) Bind()

\brief Activate a texture for rendering \param texture Texture to bind void sfTexture_bind(const sfTexture* texture);

func (Texture) Copy

func (self Texture) Copy() Texture

\brief Copy an existing texture \param texture Texture to copy \return Copied object sfTexture* sfTexture_copy(sfTexture* texture);

func (Texture) CopyToImage

func (self Texture) CopyToImage() Image

\brief Copy a texture's pixels to an image \param texture Texture to copy \return Image containing the texture's pixels sfImage* sfTexture_copyToImage(const sfTexture* texture);

func (Texture) Destroy

func (self Texture) Destroy()

\brief Destroy an existing texture \param texture Texture to delete void sfTexture_destroy(sfTexture* texture);

func (Texture) IsRepeated

func (self Texture) IsRepeated() bool

\brief Tell whether a texture is repeated or not \param texture The texture object \return sfTrue if repeat mode is enabled, sfFalse if it is disabled sfBool sfTexture_isRepeated(const sfTexture* texture);

func (Texture) IsSmooth

func (self Texture) IsSmooth() bool

\brief Tell whether the smooth filter is enabled or not for a texture \param texture The texture object \return sfTrue if smoothing is enabled, sfFalse if it is disabled sfBool sfTexture_isSmooth(const sfTexture* texture);

func (Texture) SetRepeated

func (self Texture) SetRepeated(repeated bool)

\brief 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. \param texture The texture object \param repeated True to repeat the texture, false to disable repeating void sfTexture_setRepeated(sfTexture* texture, sfBool repeated);

func (Texture) SetSmooth

func (self Texture) SetSmooth(smooth bool)

\brief Enable or disable the smooth filter on a texture \param texture The texture object \param smooth sfTrue to enable smoothing, sfFalse to disable it void sfTexture_setSmooth(sfTexture* texture, sfBool smooth);

func (Texture) Size

func (self Texture) Size() (x, y uint)

\brief Return the size of the texture \param texture Texture to read \return Size in pixels sfVector2u sfTexture_getSize(const sfTexture* texture);

func (Texture) UpdateFromImage

func (self Texture) UpdateFromImage(img Image, x, y uint)

\brief Update a texture from an image \param texture Texture to update \param image Image to copy to the texture \param x X offset in the texture where to copy the source pixels \param y Y offset in the texture where to copy the source pixels void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y);

func (Texture) UpdateFromPixels

func (self Texture) UpdateFromPixels(pixels []uint8, w, h, x, y int)

\brief Update a texture from an array of pixels \param texture Texture to update \param pixels Array of pixels to copy to the texture \param width Width of the pixel region contained in \a pixels \param height Height of the pixel region contained in \a pixels \param x X offset in the texture where to copy the source pixels \param y Y offset in the texture where to copy the source pixels void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);

func (Texture) UpdateFromRenderWindow

func (self Texture) UpdateFromRenderWindow(win RenderWindow, x, y uint)

\brief Update a texture from the contents of a render-window \param texture Texture to update \param renderWindow Render-window to copy to the texture \param x X offset in the texture where to copy the source pixels \param y Y offset in the texture where to copy the source pixels void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y);

func (Texture) UpdateFromWindow

func (self Texture) UpdateFromWindow(w Window, x, y uint)

\brief Update a texture from the contents of a window \param texture Texture to update \param window Window to copy to the texture \param x X offset in the texture where to copy the source pixels \param y Y offset in the texture where to copy the source pixels void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y);

type Time

type Time struct {
	Cref C.sfTime
}
var Zero Time = Seconds(0)

func Microseconds

func Microseconds(amount int64) Time

func Milliseconds

func Milliseconds(amount int32) Time

func Seconds

func Seconds(amount float32) Time

func (Time) AsMicroseconds

func (self Time) AsMicroseconds() int64

func (Time) AsMilliseconds

func (self Time) AsMilliseconds() int32

func (Time) AsSeconds

func (self Time) AsSeconds() float32

func (Time) String

func (self Time) String() string

type Transform

type Transform struct {
	Cref *C.sfTransform
}

func (Transform) Combine

func (self Transform) Combine(other Transform)

\brief Combine two transforms The result is a transform that is equivalent to applying \a transform followed by \a other. Mathematically, it is equivalent to a matrix multiplication. \param transform Transform object \param right Transform to combine to \a transform void sfTransform_combine(sfTransform* transform, const sfTransform* other);

func (Transform) GetInverse

func (self Transform) GetInverse() Transform

\brief Return the inverse of a transform

If the inverse cannot be computed, a new identity transform is returned.

\param transform Transform object \return The inverse matrix CSFML_GRAPHICS_API sfTransform sfTransform_getInverse(const sfTransform* transform);

func (Transform) GetMatrix

func (self Transform) GetMatrix(matrix [16]float32)

\brief 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.

\code sfTransform transform = ...; float matrix[16]; sfTransform_getMatrix(&transform, matrix) glLoadMatrixf(matrix); \endcode

\param transform Transform object \param matrix Pointer to the 16-element array to fill with the matrix

///////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_getMatrix(const sfTransform* transform, float* matrix);

func (Transform) Rotate

func (self Transform) Rotate(angle float32)

\brief Combine the current transform with a rotation \param transform Transform object \param angle Rotation angle, in degrees void sfTransform_rotate(sfTransform* transform, float angle);

func (Transform) RotateWithCenter

func (self Transform) RotateWithCenter(angle, centerX, centerY float32)

\brief 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)]. \param transform Transform object \param angle Rotation angle, in degrees \param centerX X coordinate of the center of rotation \param centerY Y coordinate of the center of rotation void sfTransform_rotateWithCenter(sfTransform* transform, float angle, float centerX, float centerY);

func (Transform) Scale

func (self Transform) Scale(scaleX, scaleY float32)

\brief Combine the current transform with a scaling \param transform Transform object \param scaleX Scaling factor on the X axis \param scaleY Scaling factor on the Y axis void sfTransform_scale(sfTransform* transform, float scaleX, float scaleY);

func (Transform) ScaleWithCenter

func (self Transform) ScaleWithCenter(scaleX, scaleY, centerX, centerY float32)

\brief 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)] \param transform Transform object \param scaleX Scaling factor on X axis \param scaleY Scaling factor on Y axis \param centerX X coordinate of the center of scaling \param centerY Y coordinate of the center of scaling void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY);

func (Transform) TransformPoint

func (self Transform) TransformPoint(x, y float32) (float32, float32)

\brief Apply a transform to a 2D point \param transform Transform object \param point Point to transform \return Transformed point sfVector2f sfTransform_transformPoint(const sfTransform* transform, sfVector2f point);

func (Transform) TransformRect

func (self Transform) TransformRect(rect FloatRect) FloatRect

\brief 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. \param transform Transform object \param rectangle Rectangle to transform \return Transformed rectangle sfFloatRect sfTransform_transformRect(const sfTransform* transform, sfFloatRect rectangle);

func (Transform) Translate

func (self Transform) Translate(x, y float32)

\brief Combine a transform with a translation \param transform Transform object \param x Offset to apply on X axis \param y Offset to apply on Y axis void sfTransform_translate(sfTransform* transform, float x, float y);

type Vector2f

type Vector2f struct {
	Cref C.sfVector2f
}

func CNewVector2f

func CNewVector2f(x, y C.float) Vector2f

internal

func NewVector2f

func NewVector2f(x, y float32) Vector2f

func (Vector2f) X

func (self Vector2f) X() float64

func (Vector2f) Y

func (self Vector2f) Y() float64

type Vector2i

type Vector2i struct {
	Cref C.sfVector2i
}

func CNewVector2i

func CNewVector2i(x, y C.int) Vector2i

internal

func NewVector2i

func NewVector2i(x, y int) Vector2i

func (Vector2i) X

func (self Vector2i) X() int

func (Vector2i) Y

func (self Vector2i) Y() int

type Vector2u

type Vector2u struct {
	Cref C.sfVector2u
}

func CNewVector2u

func CNewVector2u(x, y C.uint) Vector2u

internal

func NewVector2u

func NewVector2u(x, y uint) Vector2u

func (Vector2u) X

func (self Vector2u) X() uint

func (Vector2u) Y

func (self Vector2u) Y() uint

type Vector3f

type Vector3f struct {
	Cref C.sfVector3f
}

func CNewVector3f

func CNewVector3f(x, y, z C.float) Vector3f

internal

func GetDirection

func GetDirection() Vector3f

\brief Get the current orientation of the listener in the scene \return The listener's direction sfVector3f sfListener_getDirection();

func GetPosition

func GetPosition() Vector3f

\brief Get the current position of the listener in the scene \return The listener's position sfVector3f sfListener_getPosition();

func NewVector3f

func NewVector3f(x, y, z float32) Vector3f

func (Vector3f) X

func (self Vector3f) X() float32

func (Vector3f) Y

func (self Vector3f) Y() float32

func (Vector3f) Z

func (self Vector3f) Z() float32

type Vertex

type Vertex struct {
	Cref *C.sfVertex
}

func (Vertex) GetColor

func (self Vertex) GetColor() Color

func (Vertex) GetPosition

func (self Vertex) GetPosition() (x, y float32)

func (Vertex) GetTexCoords

func (self Vertex) GetTexCoords() (x, y float32)

func (Vertex) SetColor

func (self Vertex) SetColor(c Color)

func (Vertex) SetPosition

func (self Vertex) SetPosition(x, y float32)

func (Vertex) SetTexCoords

func (self Vertex) SetTexCoords(x, y float32)

type VertexArray

type VertexArray struct {
	Cref *C.sfVertexArray
}

func NewVertexArray

func NewVertexArray() VertexArray

\brief Create a new vertex array \return A new sfVertexArray object sfVertexArray* sfVertexArray_create(void);

func (VertexArray) Append

func (self VertexArray) Append(vertex Vertex)

\brief Add a vertex to a vertex array array \param vertexArray Vertex array objet \param vertex Vertex to add void sfVertexArray_append(sfVertexArray* vertexArray, sfVertex vertex);

func (VertexArray) Clear

func (self VertexArray) Clear()

\brief 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. \param vertexArray Vertex array object void sfVertexArray_clear(sfVertexArray* vertexArray);

func (VertexArray) Copy

func (self VertexArray) Copy() VertexArray

\brief Copy an existing vertex array \param vertexArray Vertex array to copy \return Copied object sfVertexArray* sfVertexArray_copy(sfVertexArray* vertexArray);

func (VertexArray) Destroy

func (self VertexArray) Destroy()

\brief Destroy an existing vertex array \param vertexArray Vertex array to delete void sfVertexArray_destroy(sfVertexArray* vertexArray);

func (VertexArray) GetVertex

func (self VertexArray) GetVertex(index uint) Vertex

\brief Get access to a vertex by its index This function doesn't check \a index, it must be in range [0, vertex count - 1]. The behaviour is undefined otherwise. \param vertexArray Vertex array object \param index Index of the vertex to get \return Pointer to the index-th vertex sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, unsigned int index);

func (VertexArray) GetVertexCount

func (self VertexArray) GetVertexCount() uint

\brief Return the vertex count of a vertex array \param vertexArray Vertex array object \return Number of vertices in the array unsigned int sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);

func (VertexArray) Getbounds

func (self VertexArray) Getbounds() FloatRect

\brief Compute the bounding rectangle of a vertex array This function returns the axis-aligned rectangle that contains all the vertices of the array. \param vertexArray Vertex array objet \return Bounding rectangle of the vertex array sfFloatRect sfVertexArray_getBounds(sfVertexArray* vertexArray);

func (VertexArray) Getprimitivetype

func (self VertexArray) Getprimitivetype() PrimitiveType

\brief Get the type of primitives drawn by a vertex array \param vertexArray Vertex array objet \return Primitive type sfPrimitiveType sfVertexArray_getPrimitiveType(sfVertexArray* vertexArray);

func (VertexArray) Resize

func (self VertexArray) Resize(vertexCount uint)

\brief Resize the vertex array If \a vertexCount is greater than the current size, the previous vertices are kept and new (default-constructed) vertices are added. If \a vertexCount is less than the current size, existing vertices are removed from the array. \param vertexArray Vertex array objet \param vertexCount New size of the array (number of vertices) void sfVertexArray_resize(sfVertexArray* vertexArray, unsigned int vertexCount);

func (VertexArray) SetPrimitiveType

func (self VertexArray) SetPrimitiveType(ptype PrimitiveType)

\brief Set the type of primitives of a vertex array This function defines how the vertices must be interpreted when it's time to draw them: \li As points \li As lines \li As triangles \li As quads The default primitive type is sfPoints. \param vertexArray Vertex array objet \param type Type of primitive void sfVertexArray_setPrimitiveType(sfVertexArray* vertexArray, sfPrimitiveType type);

type VideoMode

type VideoMode struct {
	Cref *C.sfVideoMode
}

sfVideoMode defines a video mode (width, height, bpp, frequency) and provides functions for getting modes supported by the display device

func DesktopMode

func DesktopMode() VideoMode

Get the current desktop video mode sfVideoMode sfVideoMode_getDesktopMode(void)

func FullscreenModes

func FullscreenModes() []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 slice is sorted from best to worst, so that the first element will always give the best mode (higher width, height and bits-per-pixel). const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* Count)

func NewVideoMode

func NewVideoMode(w, h, bpp uint) VideoMode

func (VideoMode) BitsPerPixel

func (self VideoMode) BitsPerPixel() uint

func (VideoMode) Height

func (self VideoMode) Height() uint

func (VideoMode) IsValid

func (self VideoMode) IsValid() bool

Tell whether or not a video mode is valid The validity of video modes is only relevant when using fullscreen windows otherwise any video mode can be used with no restriction. *return true if the video mode is valid for fullscreen mode sfBool sfVideoMode_isValid(sfVideoMode mode)

func (VideoMode) Nil

func (self VideoMode) Nil() bool

func (VideoMode) String

func (self VideoMode) String() string

func (VideoMode) Width

func (self VideoMode) Width() uint

type View

type View struct {
	Cref *C.sfView
}

func (View) Copy

func (self View) Copy() View

\brief Copy an existing view \param view View to copy \return Copied object sfView* sfView_copy(sfView* view);

func (View) Destroy

func (self View) Destroy()

\brief Destroy an existing view \param view View to destroy void sfView_destroy(sfView* view);

func (View) GetCenter

func (self View) GetCenter() (x, y float32)

\brief Get the center of a view \param view View object \return Center of the view sfVector2f sfView_getCenter(const sfView* view);

func (View) GetRotation

func (self View) GetRotation() float32

\brief Get the current orientation of a view \param view View object \return Rotation angle of the view, in degrees float sfView_getRotation(const sfView* view);

func (View) GetSize

func (self View) GetSize() (x, y float32)

\brief Get the size of a view \param view View object \return Size of the view sfVector2f sfView_getSize(const sfView* view);

func (View) GetViewport

func (self View) GetViewport() FloatRect

\brief Get the target viewport rectangle of a view \param view View object \return Viewport rectangle, expressed as a factor of the target size sfFloatRect sfView_getViewport(const sfView* view);

func (View) Move

func (self View) Move(x, y float32)

\brief Move a view relatively to its current position \param view View object \param offset Offset void sfView_move(sfView* view, sfVector2f offset);

func (View) NewView

func (self View) NewView() View

\brief Create a default view This function creates a default view of (0, 0, 1000, 1000) \return A new sfView object sfView* sfView_create(void);

func (View) NewViewFromRect

func (self View) NewViewFromRect(r FloatRect) View

\brief Construct a view from a rectangle \param rectangle Rectangle defining the zone to display \return A new sfView object sfView* sfView_createFromRect(sfFloatRect rectangle);

func (View) Reset

func (self View) Reset(rectangle FloatRect)

\brief Reset a view to the given rectangle Note that this function resets the rotation angle to 0. \param view View object \param rectangle Rectangle defining the zone to display void sfView_reset(sfView* view, sfFloatRect rectangle);

func (View) Rotate

func (self View) Rotate(angle float32)

\brief Rotate a view relatively to its current orientation \param view View object \param angle Angle to rotate, in degrees void sfView_rotate(sfView* view, float angle);

func (View) SetCenter

func (self View) SetCenter(x, y float32)

\brief Set the center of a view \param view View object \param center New center void sfView_setCenter(sfView* view, sfVector2f center);

func (View) SetRotation

func (self View) SetRotation(angle float32)

\brief Set the orientation of a view The default rotation of a view is 0 degree. \param view View object \param angle New angle, in degrees void sfView_setRotation(sfView* view, float angle);

func (View) SetSize

func (self View) SetSize(x, y float32)

\brief Set the size of a view \param view View object \param size New size of the view void sfView_setSize(sfView* view, sfVector2f size);

func (View) SetViewport

func (self View) SetViewport(viewport FloatRect)

\brief 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. \param view View object \param viewport New viewport rectangle void sfView_setViewport(sfView* view, sfFloatRect viewport);

func (View) Zoom

func (self View) Zoom(factor float32)

\brief Resize a view rectangle relatively to its current size Resizing the view simulates a zoom, as the zone displayed on screen grows or shrinks. \a factor is a multiplier: \li 1 keeps the size unchanged \li > 1 makes the view bigger (objects appear smaller) \li < 1 makes the view smaller (objects appear bigger) \param view View object \param factor Zoom factor to apply void sfView_zoom(sfView* view, float factor);

type Window

type Window struct {
	Cref CWindow
}

func NewWindow

func NewWindow(mode VideoMode, title string, style int32, settings ContextSettings) (Window, error)

Construct a new window This function creates the window with the size and pixel depth defined in \a mode. An optional style can be passed to customize the look and behaviour of the window (borders, title bar, resizable, closable, ...). If \a style contains sfFullscreen, then \a mode must be a valid video mode. The fourth parameter is a pointer to a structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc. param mode Video mode to use (defines the width, height and depth of the rendering area of the window) param title Title of the window param style Window style param settings Additional settings for the underlying OpenGL context return A new Window. sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);

func (Window) Close

func (self Window) Close()

Close a window and destroy all the attached resources After calling this function, the sfWindow object remains valid, you must call sfWindow_destroy to actually delete it. All other functions such as sfWindow_pollEvent or sfWindow_display will still work (i.e. you don't have to test sfWindow_isOpen every time), and will have no effect on closed windows. \param window Window object void sfWindow_close(sfWindow* window);

func (Window) Destroy

func (self Window) Destroy()

Destroy a window void sfWindow_destroy(sfWindow* window);

func (Window) Display

func (self Window) Display()

Display on screen what has been rendered to the

window so far

This function is typically called after all OpenGL rendering has been done for the current frame, in order to show it on screen. \param window Window object void sfWindow_display(sfWindow* window);

func (Window) GetSize

func (self Window) GetSize() (x, y uint)

Get the size of the rendering region of a window The size doesn't include the titlebar and borders of the window. \param window Window object \return Size in pixels sfVector2u sfWindow_getSize(const sfWindow* window);

func (Window) IsOpen

func (self Window) IsOpen() bool

Tell whether or not a window is opened This function returns whether or not the window exists. Note that a hidden window (sfWindow_SetVisible(sfFalse)) will return sfTrue. \param window Window object \return sfTrue if the window is opened, sfFalse if it has been closed sfBool sfWindow_isOpen(const sfWindow* window);

func (Window) PollEvent

func (self Window) PollEvent() (interface{}, bool)

Pop the event on top of events stack, if any, and return it This function is not blocking: if there's no pending event then it will return false and leave \a event unmodified. Note that more than one event may be present in the events stack, thus you should always call this function in a loop to make sure that you process every pending event in: window Window object in: event Event to be returned returns true if an event was returned, or false if the events stack was empty sfBool sfWindow_pollEvent(sfWindow* window, sfEvent* event);

func (Window) Position

func (self Window) Position() (x, y int)

Get the position of a window \param window Window object \return (x, y) sfVector2i sfWindow_getPosition(const sfWindow* window); TODO evalutate which is better [ multiple return | vector type ]

func (Window) SetActive

func (self Window) SetActive(active bool) bool

Activate or deactivate a window as the current target

for OpenGL rendering

A window is active only on the current thread, if you want to make it active on another thread you have to deactivate it on the previous thread first if it was active. Only one window can be active on a thread at a time, thus the window previously active (if any) automatically gets deactivated. \param window Window object \param active sfTrue to activate, sfFalse to deactivate \return sfTrue if operation was successful, sfFalse otherwise sfBool sfWindow_setActive(sfWindow* window, sfBool active);

func (Window) SetFramerateLimit

func (self Window) SetFramerateLimit(limit uint)

Limit the framerate to a maximum fixed frequency If a limit is set, the window will use a small delay after each call to sfWindow_Display to ensure that the current frame lasted long enough to match the framerate limit. \param window Window object \param limit Framerate limit, in frames per seconds (use 0 to disable limit) void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit);

func (Window) SetIcon

func (self Window) SetIcon(width, height int, pixels []uint8)

Change a window's icon \a pixels must be an array of \a width x \a height pixels in 32-bits RGBA format. \param window Window object \param width Icon's width, in pixels \param height Icon's height, in pixels \param pixels Pointer to the array of pixels in memory void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels);

func (Window) SetJoystickThreshold

func (self Window) SetJoystickThreshold(threshold float32)

Change the joystick threshold The joystick threshold is the value below which no JoyMoved event will be generated. \param window Window object \param threshold New threshold, in the range [0, 100] void sfWindow_setJoystickThreshold(sfWindow* window, float threshold);

func (Window) SetKeyRepeatEnabled

func (self Window) 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. \param window Window object \param enabled sfTrue to enable, sfFalse to disable void sfWindow_setKeyRepeatEnabled(sfWindow* window, sfBool enabled);

func (Window) SetMouseCursorVisible

func (self Window) SetMouseCursorVisible(visible bool)

Show or hide the mouse cursor \param window Window object \param visible sfTrue to show, sfFalse to hide void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible);

func (Window) SetPosition

func (self Window) SetPosition(x, y int)

Change the position of a window on screen This function only works for top-level windows (i.e. it will be ignored for windows created from the handle of a child window/control). \param window Window object \param position New position of the window, in pixels void sfWindow_setPosition(sfWindow* window, sfVector2i position); TODO evalutate which is better [ multiple return | vector type ]

func (Window) SetSize

func (self Window) SetSize(x, y uint)

TODO WHY THIS NO WORK. Change the size of the rendering region of a window \param window Window object \param size New size, in pixels void sfWindow_setSize(sfWindow* window, sfVector2u size);

func (Window) SetTitle

func (self Window) SetTitle(title string)

Change the title of a window \param window Window object \param title New title void sfWindow_setTitle(sfWindow* window, const char* title);

func (Window) SetVerticalSyncEnabled

func (self Window) SetVerticalSyncEnabled(enabled bool)

Enable or disable vertical synchronization Activating vertical synchronization will limit the number of frames displayed to the refresh rate of the monitor. This can avoid some visual artifacts, and limit the framerate to a good value (but not constant across different computers). \param window Window object \param enabled sfTrue to enable v-sync, sfFalse to deactivate void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled);

func (Window) SetVisible

func (self Window) SetVisible(visible bool)

Show or hide a window \param window Window object \param visible sfTrue to show the window, sfFalse to hide it void sfWindow_setVisible(sfWindow* window, sfBool visible);

func (Window) Settings

func (self Window) Settings() ContextSettings

Get the settings of the OpenGL context of a window Note that these settings may be different from what was passed to the sfWindow_create function, if one or more settings were not supported. In this case, SFML chose the closest match. \param window Window object \return Structure containing the OpenGL context settings sfContextSettings sfWindow_getSettings(const sfWindow* window);

type WindowHandle

type WindowHandle struct {
	Cref C.sfWindowHandle
}

Directories

Path Synopsis
util
cgo

Jump to

Keyboard shortcuts

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