Skip to content

drhodes/go-sfml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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


About

Go bindings for SFML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published