bindbc-raylib 0.9.1

Dynamic and static bindings to raylib


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

bindbc-raylib

This project provides both static (WIP) and dynamic bindings to the raylib a simple and easy-to-use library to enjoy videogames programming and raygui a simple and easy-to-use immediate-mode-gui library. See Wiki for more information.

Versioning

bindbc-raylib is being semantically versioned. Roughly described, major version changes will always represent backwards incompatible changes, minor version changes will always represent new features and will be backwards compatible, and patch ('tiny') version changes will always be bug fixes.

Compile raylib source code

You can just compile raylib or also include support for raygui.

Usage

Add bindbc-raylib to your project

Add the package as a dependency in your dub.json or dub.sdl package description:

dub.json

"dependencies": {
    "bindbc-raylib": "~>0.1.0"
}

dub.sdl

dependency "bindbc-raylib" version="~>0.1.0"

Set raylib versions

In order to use raylib version 3.0.0:

dub.json

"versions": [ "RAYLIB_300" ],

dub.sdl

versions "RAYLIB_300"

Loading raylib

The loadRaylib function is used to load all supported raylib functions. The return value of loadRaylib can be used to determine which version of raylib actually loaded.

import bindbc.raylib;
import loader = bindbc.loader.sharedlib;

void main(string[] args) {
   RaylibSupport retVal = loadRaylib();
   // raylibSupport is an enum with current raylib version
   if (retVal != raylibSupport) {
      // error
   } else {
      // successful
   }
}

Examples

You can find original raylib examples ported to D inside examples directory.

A simple example:

import std.stdio;
import bindbc.raylib;

void main(string[] args) {
   RaylibSupport retVal = loadRaylib();
   if (retVal != raylibSupport) {
      writeln("ERROR: ", retVal);
   } else {
      writeln("VERSION: ", retVal);
      writeln("loaded : ", loadedRaylibVersion);

      enum SCREEN_WIDTH = 800;
      enum SCREEN_HEIGHT = 450;

      // Initialization
      InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - basic window");

      SetTargetFPS(60); // Set our game to run at 60 frames-per-second

      // Main game loop
      while (!WindowShouldClose()) {
         // Draw
         BeginDrawing();
         ClearBackground(GOLD);
         DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
         EndDrawing();
      }
      CloseWindow();
   }
}

Dependencies

Authors:
  • Orfeo Da ViĆ 
Dependencies:
none
Versions:
0.9.1 2021-Oct-15
0.9.0 2020-Nov-04
0.8.0 2020-Oct-31
0.7.0 2020-Sep-11
0.6.0 2020-Aug-06
Show all 11 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 4 downloads this month

  • 127 downloads total

Score:
1.1
Short URL:
bindbc-raylib.dub.pm