outlines thickness
There is no browser build of this example yet.
Is it the same as C?
- Desktop:verified The Zig version renders a final frame that is byte-identical to the C example.
- Browser:verified In headless Chrome, the Zig version gives a final frame byte-identical to the C example built for the web.
//! raylib [shapes] example - outlines thickness
//!
//! Zig-API translation of examples/shapes/shapes_outlines_thickness.c (raylib 6.2).
//! Example licensed under an unmodified zlib/libpng license.
//! Copyright (c) 2026 Ramon Santamaria (@raysan5)
const rl = @import("raylib");
const gui = @import("raygui");
pub fn main() void {
// Initialization
const screen_width = 800;
const screen_height = 450;
rl.initWindow(screen_width, screen_height, "raylib [shapes] example - outlines thickness");
defer rl.closeWindow(); // Close window and OpenGL context
var thick: f32 = 5.0;
rl.setTargetFPS(60);
// Main game loop
while (!rl.windowShouldClose()) { // Detect window close button or ESC key
// Draw
rl.beginDrawing();
defer rl.endDrawing();
rl.clearBackground(.ray_white);
_ = gui.sliderBar(.{ .x = 290, .y = 50, .width = 220, .height = 24 }, "Thickness", rl.textFormat("{d:.2}", .{thick}), &thick, -30.0, 30.0);
rl.drawRectangle(35, 180, 220, 220, .light_gray);
rl.drawRectangleLinesEx(.{ .x = 35, .y = 180, .width = 220, .height = 220 }, thick, .blue);
rl.drawText("DrawRectangleLinesEx()", 35, 160, 10, .black);
rl.drawRectangleRounded(.{ .x = 290, .y = 180, .width = 220, .height = 220 }, 0.2, 9, .light_gray);
rl.drawRectangleRoundedLinesEx(.{ .x = 290, .y = 180, .width = 220, .height = 220 }, 0.2, 9, thick, .blue);
rl.drawText("DrawRectangleRoundedLinesEx()", 290, 160, 10, .black);
rl.drawCircle(655, 290, 110, .light_gray);
rl.drawCircleLinesEx(.{ .x = 655, .y = 290 }, 110, thick, .blue);
rl.drawText("DrawCircleLinesEx()", 545, 160, 10, .black);
}
}/*******************************************************************************************
*
* raylib [shapes] example - outlines thickness
*
* Example complexity rating: [★☆☆☆] 1/4
*
* Example originally created with raylib 6.1, last time updated with raylib 6.1
*
* Example contributed by Matthew Roush (@MatthewRoush) and reviewed by Ramon Santamaria (@raysan5)
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2026 Matthew Roush (@MatthewRoush)
*
********************************************************************************************/
#include "raylib.h"
#define RAYGUI_IMPLEMENTATION
#include "raygui.h" // Required for GUI controls
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - outlines thickness");
float thick = 5.0f;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update variables / Implement example logic at this point
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
GuiSliderBar((Rectangle){ 290, 50, 220, 24 }, "Thickness", TextFormat("%.2f", thick), &thick, -30.0f, 30.0f);
DrawRectangle(35, 180, 220, 220, LIGHTGRAY);
DrawRectangleLinesEx((Rectangle){ 35, 180, 220, 220 }, thick, BLUE);
DrawText("DrawRectangleLinesEx()", 35, 160, 10, BLACK);
DrawRectangleRounded((Rectangle){ 290, 180, 220, 220 }, 0.2f, 9, LIGHTGRAY);
DrawRectangleRoundedLinesEx((Rectangle){ 290, 180, 220, 220 }, 0.2f, 9, thick, BLUE);
DrawText("DrawRectangleRoundedLinesEx()", 290, 160, 10, BLACK);
DrawCircle(655, 290, 110, LIGHTGRAY);
DrawCircleLinesEx((Vector2){ 655, 290 }, 110, thick, BLUE);
DrawText("DrawCircleLinesEx()", 545, 160, 10, BLACK);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}From raylib 6.2. The original on GitHub.