{"id":15286166,"url":"https://github.com/sanko/alien-csfml","last_synced_at":"2025-03-23T21:22:04.064Z","repository":{"id":61682367,"uuid":"552665590","full_name":"sanko/alien-csfml","owner":"sanko","description":"Build and provide access to the official binding of SFML for the C language","archived":false,"fork":false,"pushed_at":"2022-10-22T03:09:56.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T01:13:45.627Z","etag":null,"topics":["alien","bindings","ffi","gamedev","perl","sfml"],"latest_commit_sha":null,"homepage":"https://metacpan.org/dist/Alien-CSFML","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanko.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["sanko"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-10-17T03:13:16.000Z","updated_at":"2022-10-19T15:25:18.000Z","dependencies_parsed_at":"2022-10-20T04:30:22.273Z","dependency_job_id":null,"html_url":"https://github.com/sanko/alien-csfml","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2Falien-csfml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2Falien-csfml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2Falien-csfml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2Falien-csfml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanko","download_url":"https://codeload.github.com/sanko/alien-csfml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245169889,"owners_count":20571973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alien","bindings","ffi","gamedev","perl","sfml"],"created_at":"2024-09-30T15:10:49.122Z","updated_at":"2025-03-23T21:22:04.042Z","avatar_url":"https://github.com/sanko.png","language":"Perl","funding_links":["https://github.com/sponsors/sanko"],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/sanko/alien-csfml/actions/workflows/linux.yaml/badge.svg)](https://github.com/sanko/alien-csfml/actions) [![Actions Status](https://github.com/sanko/alien-csfml/actions/workflows/windows.yaml/badge.svg)](https://github.com/sanko/alien-csfml/actions) [![Actions Status](https://github.com/sanko/alien-csfml/actions/workflows/osx.yaml/badge.svg)](https://github.com/sanko/alien-csfml/actions) [![Actions Status](https://github.com/sanko/alien-csfml/actions/workflows/freebsd.yaml/badge.svg)](https://github.com/sanko/alien-csfml/actions) [![MetaCPAN Release](https://badge.fury.io/pl/Alien-CSFML.svg)](https://metacpan.org/release/Alien-CSFML)\n# NAME\n\nAlien::CSFML - Build and provide access to the official binding of SFML for the\nC language\n\n# Description\n\nThis distribution builds and installs CSFML; the official binding of SFML for\nthe C language. Its API is as close as possible to the C++ API (but in C style,\nof course), which makes it a perfect tool for building SFML bindings for other\nlanguages that don't directly support C++ libraries.\n\n# Synopsis\n\n    use Alien::CSFML;\n    use ExtUtils::CBuilder;\n    my $SF  = Alien::CSFML-\u003enew( 'C++' =\u003e 1 );\n    my $CC  = ExtUtils::CBuilder-\u003enew( quiet =\u003e 0 );\n    my $SRC = 'hello_world.cxx';\n    open( my $FH, '\u003e', $SRC ) || die '...';\n    syswrite( $FH, \u003c\u003c'')      || die '...'; close $FH;\n    #include \u003cSFML/Graphics.hpp\u003e\n    int main() {\n        sf::RenderWindow window(sf::VideoMode(200, 200), \"SFML works!\");\n        sf::CircleShape shape(100.f);\n        shape.setFillColor(sf::Color::Green);\n        while (window.isOpen()) {\n            sf::Event event;\n            while (window.pollEvent(event)) {\n                if (event.type == sf::Event::Closed)\n                    window.close();\n            }\n            window.clear();\n            window.draw(shape);\n            window.display();\n        }\n        return 0;\n    }\n\n    my $OBJ = $CC-\u003ecompile( 'C++' =\u003e 1, source =\u003e $SRC, include_dirs =\u003e [ $SF-\u003einclude_dirs ] );\n    my $EXE = $CC-\u003elink_executable(\n        objects            =\u003e $OBJ,\n        extra_linker_flags =\u003e ' -lstdc++ ' . $SF-\u003eldflags(qw[graphics system window])\n    );\n    print system(\n        (\n            $^O eq 'MSWin32' ? '' :\n                'LD_LIBRARY_PATH=' . join( ':', '.', $SF-\u003elibrary_path(1) ) . ' '\n        ) .\n            './' . $EXE\n    ) ? 'Aww...' : 'Yay!';\n    END { unlink grep defined, $SRC, $OBJ, $EXE; }\n\n# Constructor\n\n    my $AS = Alien::CSFML-\u003enew( );\n\nPer-object configuration options are set in the constructor and include:\n\n- `C++`\n\n    Specifies that the source file is a C++ source file and sets appropriate\n    compile and linker flags.\n\n# Methods\n\nAfter creating a new [Alien::CSFML](https://metacpan.org/pod/Alien%3A%3ACSFML) object, use the following\nmethods to gather information:\n\n## `include_dirs`\n\n    my @include_dirs = $AS-\u003einclude_dirs( );\n\nReturns a list of the locations of the headers installed during the build\nprocess and those required for compilation.\n\n## `library_path`\n\n    my $lib_path = $AS-\u003elibrary_path( );\n\nReturns the location of the private libraries we made and installed during the\nbuild process.\n\n## `cflags`\n\n    my $cflags = $AS-\u003ecflags( );\n\nReturns additional C compiler flags to be used.\n\n## `cxxflags`\n\n    my $cxxflags = $AS-\u003ecxxflags( );\n\nReturns additional flags to be used to when compiling C++.\n\n## `ldflags`\n\n    my $ldflags = $AS-\u003eldflags( );\n\nReturns additional linker flags to be used.\n\n    my $ldflags = $AS-\u003eldflags(qw[audio window system]);\n\nBy default, all modules are linked but you may request certain modules\nindividually with the following values:\n\n- `audio` - hardware-accelerated spatialised audio playback and recording\n- `graphics` - hardware acceleration of 2D graphics including sprites, polygons and text rendering\n- `network` - TCP and UDP network sockets, data encapsulation facilities, HTTP and FTP classes\n- `system` - vector and Unicode string classes, portable threading and timer facilities\n- `window` - window and input device management including support for joysticks, OpenGL context management\n\nDependencies are also automatically returned for each module type.\n\n# Installation\n\nThe distribution is based on [Module::Build::Tiny](https://metacpan.org/pod/Module%3A%3ABuild%3A%3ATiny), so use\nthe following procedure:\n\n    \u003e perl Build.PL\n    \u003e ./Build\n    \u003e ./Build test\n    \u003e ./Build install\n\n## Dependencies\n\nOn Windows and macOS, all the required dependencies are provided alongside SFML\nso you won't have to download/install anything else. Building will work out of\nthe box.\n\nOn Linux however, nothing is provided. SFML relies on you to install all of its\ndependencies on your own. Here is a list of what you need to install before\nbuilding SFML:\n\n- freetype\n- x11\n- xrandr\n- udev\n- opengl\n- flac\n- ogg\n- vorbis\n- vorbisenc\n- vorbisfile\n- openal\n- pthread\n\nThe exact name of the packages may vary from distribution to distribution. Once\nthose packages are installed, don't forget to install their development headers\nas well.\n\nOn a Debian based system, you'd try something like:\n\n     sudo apt-get update\n     sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev\n\nOn FreeBSD, I tossed this into my Github Action and it works out alright:\n\n    env ASSUME_ALWAYS_YES=YES pkg install -y git cmake-core ninja xorgproto libX11 libXrandr\n    env ASSUME_ALWAYS_YES=YES pkg install -y flac libogg libvorbis freetype2 openal-soft libglvnd\n    env ASSUME_ALWAYS_YES=YES pkg install -y libXcursor\n\n# See Also\n\n[Alien::SFML](https://metacpan.org/pod/Alien%3A%3ASFML)\n\n[https://www.sfml-dev.org/learn.php](https://www.sfml-dev.org/learn.php)\n\n# Author\n\nSanko Robinson \u003csanko@cpan.org\u003e - http://sankorobinson.com/\n\nCPAN ID: SANKO\n\n# License and Legal\n\nCopyright (C) 2022 by Sanko Robinson \u003csanko@cpan.org\u003e\n\nThis program is free software; you can redistribute it and/or modify it under\nthe terms of The Artistic License 2.0. See the `LICENSE` file included with\nthis distribution or http://www.perlfoundation.org/artistic\\_license\\_2\\_0.  For\nclarification, see http://www.perlfoundation.org/artistic\\_2\\_0\\_notes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanko%2Falien-csfml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanko%2Falien-csfml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanko%2Falien-csfml/lists"}