|Number of watchers on Github||37|
|Number of open issues||1|
|Average time to close an issue||7 days|
|Average time to merge a PR||about 1 hour|
|Open pull requests||0+|
|Closed pull requests||0+|
|Last commit||almost 4 years ago|
|Repo Created||over 5 years ago|
|Repo Last Updated||about 2 years ago|
|Organization / Author||oprypin|
|Do you use nim-csfml? Leave a review!|
|View nim-csfml activity|
|View on github|
|Fresh, new opensource launches 🚀🚀🚀|
Trendy new open source projects in your inbox! View examples
This library consists of class wrappers implemented as
ptr object. Because Nim does not allow attaching pointers to the garbage collector, I decided to use destructors hoping that would be a reasonable way to implement automatic disposal of objects. However, this feature is based on lexical scoping, which (as I later realized) makes things problematic: the disposal behavior is more like normal
objects rather than
ref objects, and sometimes unpredictable.
It is recommended to disable destructors (pass
-d:csfmlNoDestructors to the compiler) and dispose of the
ptr objects manually by calling
destroy. Standard memory management caveats apply: destroying objects that are still used will break things, forgetting to destroy is a memory leak.
There is no good way to fix this under the current state of the language, short of reimplementing everything with additional wrapper classes which also add a lot of overhead.
This library is not under active development, but detailed bug reports will be given proper attention.
The API attempts to be very similar to SFML's, but some general changes are present:
sf::SomeType x(param)), use a corresponding procedure (there are 2 variations):
var x = newSomeType(param), which means it is a
var x = someType(param), which means it is an
object(in CSFML it corresponds to a simple
(Int|Float)Rectshould be created using special
loadFromFile, that are used for initialization, are also represented as constructor procs described above.
x.someProperty = v.
enumnames were taken from CSFML, but changed to remove their common prefix to resemble SFML's values.
enums are all
enums are just represented as a list of constants, because they are not really enumerations.
enumvalues as bitmasks. You can combine them using the
or) operator defined for
BitMaskU32in the util module.
sf::Stringor strange conversions):
cfloatwill be present everywhere, so explicit conversions to/from Nim's normal types may be required.
unsigned intis mapped as
cint, etc., so you don't have to bother with unsigned conversions. This shouldn't cause problems, but it might.
sfBoolwhich is defined as
int, is mapped to the
IntBooltype with conversions to Nim's
See examples to learn more.
The files src/csfml_*_gen.nim are automatically generated from CSFML's header files. They provide the base CSFML API. The files csfml_*.nim build upon them, adding compatibility with SFML API.
csfml.nim automatically imports system, window and graphics; audio should be imported separately; network is not implemented.
nim-csfml's version number (
x.y corresponds to the supported CSFML version;
z is for the project's own point releases.
nim-csfml supports CSFML 2.3; there are older releases, down to CSFML 2.1. It has been tested on Linux 64-bit and Windows 7 with MinGW 32-bit.
This library can be installed using
nimble install csfml.
nimrod-sfml was a great source of knowledge.
Some data types changed.