Skip to content

About

A raylib toolkits

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raylib_toolkits.h

Information

  • A raylib toolkits with many useful functions.

Requirements

  • C stardard: C99+.
  • raylib projects: 5.5+.

Installation

  • Put raylib_toolkits.h into your projects and include like this:
#define RAYLIB_TOOLKITS_IMPLEMENTATION
#include "raylib_toolkits.h"

// Your code...
  • Then, compile it with gcc compiler:

Windows:

gcc your_project_file.c -o your_project_executable_file.exe -I/path/to/raylib/include -L/path/to/raylib/lib \
-lraylib \
-lopengl32 \
-lwinmm \
-lgdi32

Linux:

gcc your_project_file.c -o your_project_executable_file.exe -I/path/to/raylib/include -L/path/to/raylib/lib \
-lraylib \
-lGL \
-lm \
-lpthread \
-ldl \
-lrt \
-lX11

macOS:

gcc your_project_file.c -o your_project_executable_file.exe -I/path/to/raylib/include -L/path/to/raylib/lib \
-lraylib \
-framework CoreVideo \
-framework IOKit \
-framework Cocoa \
-framework GLUT \
-framework OpenGL

Example of a rotation cube

#define RAYLIB_TOOLKITS_IMPLEMENTATION
#include "raylib_toolkits.h"

int main(void)
{
    InitWindow(800, 600, "Window");
    SetTargetFPS(60);

    Camera3D camera = {0};
    camera.position = (Vector3){5.0f, 5.0f, 5.0f};
    camera.fovy = 60.0f;
    camera.projection = CAMERA_PERSPECTIVE;
    camera.target = (Vector3){0.0f, 0.0f, 0.0f};
    camera.up = (Vector3){0.0f, 1.0f, 0.0f};

    float angle = 0.0f;
    Vector3 axis = (Vector3){1, 1, 0};

    while (!WindowShouldClose())
    {   
        float dt = GetFrameTime();
        angle += 10.0f * dt;

        BeginDrawing();
            ClearBackground(RAYWHITE);

            BeginMode3D(camera);

                rk_DrawCubeProV((Vector3){0.0f, 1.0f, 0.0f}, (Vector3){2.0f, 2.0f, 2.0f}, axis, angle, RED);
                rk_DrawCubeWiresProV((Vector3){0.0f, 1.0f, 0.0f}, (Vector3){2.0f, 2.0f, 2.0f}, axis, angle, MAROON);

                DrawGrid(10, 1.0f);

            EndMode3D();

            DrawText("This is a rotation cube", 10, 10, 20, BLACK);

        EndDrawing();
    }

    CloseWindow();

    return 0;
}

License

  • This project is under the MIT license.

About

A raylib toolkits

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages