import core::raylib; استورد أساسي::رايليب. fn start_main() -> i64 { // Layout and measurement need no display. Text stays in logical order. let loaded_font = raylib::GetFontDefault(); if not loaded_font::ok { print(loaded_font::error::message); return 1; } let options = raylib::TextOptions { font_size: 32.0, direction: raylib::TEXT_DIRECTION_AUTO, has_width: true, width: 430.0, alignment: raylib::TEXT_ALIGNMENT_START, line_spacing: 4.0 }; let prepared = رايليب::أنشئ_تخطيط_نص(loaded_font::value, "سلام ASPL 123\nبَِّ Hello", options); if not prepared::ok { print(prepared::error::message); return 2; } let layout = prepared::value; let measured = raylib::MeasureTextLayout(layout); if not measured::ok { print(measured::error::message); return 3; } let audio = رايليب::هيئ_جهاز_الصوت(); if not audio::ok { print(audio::error::message); return 4; } let loaded_music = raylib::LoadMusicStream("docs/examples/assets/raylib-tone.ogg"); if not loaded_music::ok { print(loaded_music::error::message); return 5; } let music = loaded_music::value; if not raylib::SetMusicLooping(music, true)::ok or not raylib::PlayMusicStream(music)::ok { return 6; } let opened = raylib::InitWindow(500, 300, "Shaped text / نص مشكل"); if not opened::ok { print(opened::error::message); return 7; } if not raylib::SetTargetFPS(60)::ok { return 8; } var frame: i32 = 0; while frame < 60 { let closing = raylib::WindowShouldClose(); if not closing::ok { return 9; } if closing::value { return 0; } // Streaming advances only when the application calls UpdateMusicStream. if not raylib::UpdateMusicStream(music)::ok { return 10; } if not raylib::BeginDrawing()::ok or not raylib::ClearBackground(raylib::RAYWHITE)::ok { return 11; } let size = measured::value::size; let ink = measured::value::ink; let box = raylib::Rectangle { x: 30.0, y: 30.0, width: size::x, height: size::y }; if not raylib::DrawRectangleLinesEx(box, 1.0, raylib::GRAY)::ok { return 12; } let ink_box = raylib::Rectangle { x: 30.0 + ink::x, y: 30.0 + ink::y, width: ink::width, height: ink::height }; if not raylib::DrawRectangleLinesEx(ink_box, 1.0, raylib::RED)::ok { return 13; } if not رايليب::ارسم_تخطيط_النص(layout, raylib::Vector2 { x: 30.0, y: 30.0 }, raylib::BLACK)::ok { return 14; } if not raylib::EndDrawing()::ok { return 15; } frame = frame + 1; } if not raylib::UnloadMusicStream(music)::ok or not raylib::CloseAudioDevice()::ok { return 16; } if not raylib::CloseWindow()::ok or not raylib::UnloadTextLayout(layout)::ok { return 17; } print("shaped text and explicit music updates complete\n"); return 0; }