raylib-d how to program a simple moving circle.

Alain De Vos devosalain at ymail.com
Fri Nov 29 22:02:23 UTC 2024


On Friday, 29 November 2024 at 21:37:48 UTC, Alain De Vos wrote:
> I can do "dub add raylib-d" but i have no clue to program a 
> simple moving circle.

Following program has an import error

```

import std.stdio: writeln;

import raylib; //Error

void main() {
	validateRaylibBinding();
	
	// creating window
	//InitWindow(720, 640, "Dlang Raylib Window");

	// loading texture
	//Texture2D image = LoadTexture("car.png");
	// resizing the texture
	//image.width = image.height = 240;

	while(!WindowShouldClose()) {
		// process events

		// update

		// draw
		BeginDrawing(); 		// clear the screen
		ClearBackground(Colors.WHITE); 	// set background color to WHITE

		// draw "Hello, World!"
		DrawText("Hello, World!", 10, 10, 60, Colors.BLACK);

		// draw a square 50x50
		DrawRectangle(100, 100, 50, 50, Colors.BLACK);

		// draw a circle of radius = 100
		DrawCircle(100, 200, 50, Colors.BLACK);

		// draw the image
		//DrawTexture(image, 100, 400, Colors.WHITE);

		// display
		EndDrawing();
	}

	// free res
	//UnloadTexture(image);

	// close the window and quit
	CloseWindow();
}

```



More information about the Digitalmars-d-learn mailing list