{"id":18847847,"url":"https://github.com/interkosmos/fortran-raylib","last_synced_at":"2025-04-14T08:10:49.960Z","repository":{"id":187794551,"uuid":"677575717","full_name":"interkosmos/fortran-raylib","owner":"interkosmos","description":"Fortran 2018 interface bindings to raylib 5.5","archived":false,"fork":false,"pushed_at":"2025-03-20T11:52:44.000Z","size":2644,"stargazers_count":27,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T21:46:45.736Z","etag":null,"topics":["fortran","fortran-2018","fortran-package-manager","game-dev","opengl","raylib"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interkosmos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-12T00:15:25.000Z","updated_at":"2025-03-20T11:52:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"f844a1fe-6c19-4c62-ac85-dae801d4de09","html_url":"https://github.com/interkosmos/fortran-raylib","commit_stats":null,"previous_names":["interkosmos/fortran-raylib"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-raylib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-raylib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-raylib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-raylib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interkosmos","download_url":"https://codeload.github.com/interkosmos/fortran-raylib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248843867,"owners_count":21170492,"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":["fortran","fortran-2018","fortran-package-manager","game-dev","opengl","raylib"],"created_at":"2024-11-08T03:09:51.644Z","updated_at":"2025-04-14T08:10:49.946Z","avatar_url":"https://github.com/interkosmos.png","language":"Fortran","readme":"# fortran-raylib\n\nA work-in-progress collection of interface bindings to\n[raylib](https://www.raylib.com/) 5.5, for 2-D and 3-D game programming in\nFortran 2018. The library has been tested with GNU Fortran 14 and Flang 20.\n\n## Build Instructions\n\nInstall the raylib package suitable for your operating system, or build from\n[source](https://github.com/raysan5/raylib/releases/tag/5.5):\n\n```\n$ cd raylib-5.5/\n$ mkdir build \u0026\u0026 cd build/\n$ cmake ..\n$ make PLATFORM=PLATFORM_DESKTOP\n$ make install\n```\nSelect platform `PLATFORM_DESKTOP_SDL` for the SDL 2.0 back-end:\n\n```\n$ make PLATFORM=PLATFORM_DESKTOP_SDL\n```\n\n### Make\n\nBuild the *fortran-raylib* library with GNU Fortran by executing the provided\nMakefile:\n\n```\n$ git clone --depth 1 https://github.com/interkosmos/fortran-raylib\n$ cd fortran-raylib/\n$ make\n```\n\nOr, to compile with Flang:\n\n```\n$ make FC=flang20\n```\n\nPass argument `RAYLIB` to override the raylib library to link. For example, if\nthe static library `libraylib.a` is in the same directory:\n\n```\n$ make RAYLIB=libraylib.a\n```\n\nYou may have to set the libraries to link manually (argument `LDLIBS`),\ndepending on your operating system.\n\n\n### Fortran Package Manager\n\nBuilding the library and all examples with *fpm*:\n\n```\n$ fpm build --profile release\n```\n\nAlternatively, you can add *fortran-raylib* as a dependency to the `fpm.toml` of\nyour project:\n\n```toml\n[dependencies]\nfortran-raylib = { git = \"https://github.com/interkosmos/fortran-raylib.git\" }\n```\n\n### Linking\n\nLink your Fortran application against `libfortran-raylib.a`, `-lraylib`, and\nadditional platform-dependent libraries:\n\n| System          | Linker Libraries                                                                                         |\n|-----------------|----------------------------------------------------------------------------------------------------------|\n| FreeBSD         | `-lraylib -lglfw -lGL -lpthread -lm`                                                                     |\n| Linux           | `-lraylib -lGL -lm -lpthread -ldl -lrt -lX11`                                                            |\n| Linux (Wayland) | `-lraylib -lGL -lm -lpthread -ldl -lrt -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon`      |\n| macOS           | `-lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo` |\n| Raspberry Pi    | `-lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -latomic`                            |\n| Windows         | `-lraylib -lopengl32 -lgdi32 -lwinmm`                                                                    |\n\n## Example\n\nThe following example program opens a window and draws some text.\n\n```fortran\n! example.f90\nprogram main\n    use, intrinsic :: iso_c_binding, only: c_null_char\n    use :: raylib\n    implicit none (type, external)\n\n    integer, parameter :: SCREEN_WIDTH  = 800\n    integer, parameter :: SCREEN_HEIGHT = 450\n\n    call init_window(SCREEN_WIDTH, SCREEN_HEIGHT, 'Fortran + raylib' // c_null_char)\n    call set_target_fps(60)\n\n    do while (.not. window_should_close())\n        call begin_drawing()\n            call clear_background(RAYWHITE)\n            call draw_text('Hello, World!' // c_null_char, 190, 200, 20, LIGHTGRAY)\n        call end_drawing()\n    end do\n\n    call close_window()\nend program main\n```\n\nCompile and link the example program:\n\n```\n$ gfortran -L/usr/local/lib -o example example.f90 libfortran-raylib.a -lraylib -lGL -lpthread -lm\n$ ./example\n```\n\nDepending on the build flags chosen for *raylib*, you may have to link with\n`-lglfw` additionally.\n\n## Further Examples\n\nMore examples can be found in `examples/`:\n\n* **bunny** is a bunny benchmark.\n* **camera** renders a cube in 3-D.\n* **camera3d** renders a 3-D scene, with keyboard and mouse controls.\n* **castle** renders a 3-D model loaded from file.\n* **collision** shows 2-D collision detection.\n* **cubes** renders waving cubes.\n* **explosion** renders sprites and plays sound.\n* **flags** shows window flags.\n* **geometric** renders basic geometric shapes.\n* **font** displays text using bitmap fonts.\n* **julia** renders animated Julia set (via GLSL shader).\n* **keys** demonstrates keyboard input.\n* **log** adds a custom logging routine.\n* **map** renders a height map.\n* **maze** renders a 3-D maze in first-person view.\n* **mesh** demonstrates mesh instancing.\n* **plane** shows pitch/yaw/roll of a 3-D model.\n* **shapes** renders basic shapes.\n* **ship** rotates a 3-D model loaded from file.\n* **window** opens a window with raylib.\n\nBuild all examples with:\n\n```\n$ make examples\n```\n\nTo link against a static raylib library, run:\n\n```\n$ make examples RAYLIB=libraylib.a\n```\n\n## Compatibility\n\nSome issues have to be regarded when calling raylib from Fortran:\n\n* Loading models in Wavefront OBJ format is broken since raylib 5.0\n  ([issue](https://github.com/raysan5/raylib/issues/3576)).\n* All procedure names and dummy arguments have been converted to snake case.\n* Make sure to properly null-terminate all character strings passed to raylib\n  with `c_null_char` from module `iso_c_binding` or simply `achar(0)`.\n* Some variadic C functions of raylib are not bound by the interface library,\n  like `TextFormat()`. In this particular case, just use the Fortran `write`\n  statement instead.\n* If a function returns `type(c_ptr)`, the result has to be converted to a\n  Fortran pointer with the intrinsic subroutine `c_f_pointer()` first. C char\n  pointers may be converted with utility subroutine `c_f_str_ptr()` from module\n  `raylib_util`, or the intrinsic `c_f_strpointer()` (Fortran 2023).\n\n## Licence\n\nISC\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-raylib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterkosmos%2Ffortran-raylib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-raylib/lists"}