raylib: remove rl namespace

This will allow us to use rlImGUI
This commit is contained in:
2026-02-26 15:28:53 +01:00
parent dd29dc4f73
commit c2cc6e22e9
3 changed files with 44 additions and 47 deletions

View File

@@ -15,54 +15,52 @@
#include <fstream>
#include <iostream>
#include <nlohmann/json.hpp>
namespace rl {
#include <imgui.h>
#include "raylib.h"
} // namespace rl
int main(int ac, char **av) {
rl::InitWindow(1920, 1080, &av[0][2]);
InitWindow(1920, 1080, &av[0][2]);
// Initializing a camera
rl::Camera camera = {0};
camera.position = (rl::Vector3){1.0f, 10.0f, 1.0f};
camera.target = (rl::Vector3){0.0f, 10.0f, 0.0f};
camera.up = (rl::Vector3){0.0f, 1.0f, 0.0f};
Camera camera = {0};
camera.position = (Vector3){1.0f, 10.0f, 1.0f};
camera.target = (Vector3){0.0f, 10.0f, 0.0f};
camera.up = (Vector3){0.0f, 1.0f, 0.0f};
camera.fovy = 90.0f;
camera.projection = rl::CAMERA_PERSPECTIVE;
camera.projection = CAMERA_PERSPECTIVE;
{ // model lifetime scope
auto can_model = Ley::Model::create("can.obj", "can_unwrapped_text.png");
auto crow_model = Ley::Model::create("crow.obj", "crow_tex.png");
auto can_model = Ley::cModel::create("can.obj", "can_unwrapped_text.png");
auto crow_model = Ley::cModel::create("crow.obj", "crow_tex.png");
// rl::Model pos
// Model pos
can_model.setPosition({0.0f, 0.0f, 0.0f});
crow_model.setPosition({-0.5f, 3.8f, 0.0f});
rl::BoundingBox box = rl::GetModelBoundingBox(can_model.getModel());
BoundingBox box = GetModelBoundingBox(can_model.getModel());
rl::DisableCursor();
DisableCursor();
while (!rl::WindowShouldClose()) {
while (!WindowShouldClose()) {
// Update
UpdateCamera(&camera, rl::CAMERA_FREE);
UpdateCamera(&camera, CAMERA_FREE);
// Draw
rl::BeginDrawing();
ClearBackground(rl::GRAY);
BeginDrawing();
ClearBackground(GRAY);
BeginMode3D(camera);
can_model.Draw(rl::WHITE);
crow_model.Draw(rl::WHITE);
can_model.Draw(WHITE);
crow_model.Draw(WHITE);
rl::DrawGrid(20, 10.0f); // Draw a grid
DrawGrid(20, 10.0f); // Draw a grid
rl::EndMode3D();
EndMode3D();
rl::DrawFPS(10, 10);
rl::EndDrawing();
DrawFPS(10, 10);
EndDrawing();
}
} // Unload model
rl::CloseWindow();
CloseWindow();
return 0;
}