Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* Adator. prog.
  + feladatsor
  + quick link

Teaching

* Prog. for Data Sci.
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* 2025/26/1
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

Getting started with raylib under D

Set Up

I tried it under Linux. Create a project folder and enter it. The folder is empty.

Create the files dub.json and main.d with the following simple content:

$ cat dub.json
{
    "name": "main",
    "targetType": "executable",
    "sourceFiles": [
        "main.d"
    ]
}

$ cat main.d
#!/usr/bin/env rdmd

import std.stdio;

void main()
{
    writeln("D Lang");
}

Then:

# install the D binding
$ dub add raylib-d

# install the compiled and linkable raylib library (written in C)
$ dub run raylib-d:install
...
Automatically add these directives to your dub.json file? [Y/n] Y

Finally, issue the following command:

$ dub

and the project should compile and run successfully.

Raylib Demo

Modify main.d:

(1) Raylib demo with D
import raylib;

import std.stdio;

void main()
{
    InitWindow(800, 600, "Raylib + D Lang.");
    while (!WindowShouldClose())
    {
        BeginDrawing();
        ClearBackground(Color(50, 50, 50));
        DrawText("Hello from D!", 10, 10, 50, Color(255, 255, 255));
        EndDrawing();
    }
    CloseWindow();
}

Compile and run:

$ dub

Done. Good luck!

Screenshot

Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2025 September 07, 17:00