Open, close and reopen a window
ASPL 0.7.0 · Current release
Native only. Press Enter twice in the terminal running the program. The title changes, the first window closes and a fresh window opens. Success returns 0.
On this page
Prepare the native host
Native only, published ASPL 0.7.0. Press Enter twice in the terminal running the program. The title changes, the first window closes and a fresh window opens. Success returns 0.
Native installation · Drawing and input guide · API reference.
No source modules or data assets are required.
The page language is independent of source vocabulary. Download only supplied variants, with original filenames. Mixed-only programs are labelled in both locales; no source translation is generated.
Mixed source
Execution: Native only · ASPL 0.7.0
- Native ASPL 0.7.0 on x86_64 Linux with glibc 2.34 or later.
- Running needs a reachable Wayland/EGL or X11/GLX display and OpenGL 3.3 core; no system Raylib or C compiler is required. Checking and building need no display.
Input lines: ["",""]
No English source variant is supplied. Showing Mixed source as written; the source was not translated.
// Run with: aspl run docs/examples/raylib-window.mixed.aspl
// Press Enter twice to observe title replacement and a fresh window.
import core::raylib;
استورد أساسي::رايليب.
fn start_main() -> i64 {
let flags = raylib::اضبط_أعلام_الإعداد(raylib::FLAG_WINDOW_RESIZABLE);
if not flags::ok { print(flags::error::message); return 1; }
let opened = رايليب::InitWindow(640, 360, "ASPL / نافذة رايليب");
if not opened::ok { print(opened::error::message); return 2; }
if not raylib::هل_النافذة_جاهزة() { return 3; }
let titled = raylib::SetWindowTitle("ASPL title / عنوان جديد");
if not titled::ok { print(titled::error::message); return 4; }
print("Window ready. Press Enter to close and reopen. / اضغط إدخال لإعادة الفتح.\n");
let first = read_line();
let closed = رايليب::أغلق_النافذة();
if not closed::ok { print(closed::error::message); return 5; }
if raylib::IsWindowReady() { return 6; }
let reopened = raylib::هيئ_نافذة(640, 360, "ASPL reopened / نافذة جديدة");
if not reopened::ok { print(reopened::error::message); return 7; }
print("Window reopened. Press Enter to finish. / اضغط إدخال للإنهاء.\n");
let second = read_line();
let finished = raylib::CloseWindow();
if not finished::ok { print(finished::error::message); return 8; }
return 0;
}
Follow the Linux instructions to run this example. Download the source to keep a copy.
Download raylib-window.mixed.asplExpected outcomes
{
"native": {
"check": 0,
"status": 0,
"output": "Window ready. Press Enter to close and reopen. / اضغط إدخال لإعادة الفتح.\nWindow reopened. Press Enter to finish. / اضغط إدخال للإنهاء.\n",
"behavior": {
"en": "Press Enter twice in the terminal running the program. The title changes, the first window closes and a fresh window opens. Success returns 0.",
"ar": "اضغط إدخال مرتين في الطرفية التي تشغّل البرنامج. يتغير العنوان وتغلق النافذة الأولى ثم تفتح نافذة جديدة. يعيد النجاح 0."
}
}
}Commands and outcomes
Run from the directory containing the downloaded docs/ tree. Keep the generated .THIRD-PARTY-NOTICES companion when distributing the ELF program. Checking and building do not open a window. Running needs the stated graphics facilities.
mixed:
aspl check docs/examples/raylib-window.mixed.aspl
aspl run docs/examples/raylib-window.mixed.aspl
aspl build -o raylib-window-mixed-program docs/examples/raylib-window.mixed.aspl
./raylib-window-mixed-program