| 1234567891011121314151617181920212223242526272829303132333435 |
- MODULE hello_window ;
- (*
- m2SDL3 example: open a window for ~2 seconds, then quit.
- Build: make examples or see Makefile.
- Run: ./build/examples/hello_window
- SDL3: CreateWindow takes (title, w, h, flags) - no x/y - and
- init returns BOOLEAN.
- *)
- FROM SDL3 IMPORT SDL_Init, SDL_Quit, SDL_Delay, SDLInitVideo;
- FROM SDL3Video IMPORT SDL_CreateWindow, SDL_DestroyWindow, WindowHidden;
- FROM SYSTEM IMPORT ADDRESS;
- FROM libc IMPORT printf;
- VAR win: ADDRESS;
- BEGIN
- IF NOT SDL_Init(SDLInitVideo) THEN
- printf("SDL_Init failed\n");
- HALT(1)
- END;
- win := SDL_CreateWindow("Hello from GNU Modula-2 + SDL3",
- 640, 480, 0);
- IF win = NIL THEN
- printf("CreateWindow failed\n");
- SDL_Quit;
- HALT(1)
- END;
- printf("window open for 2s...\n");
- SDL_Delay(2000);
- SDL_DestroyWindow(win);
- SDL_Quit;
- printf("bye\n")
- END hello_window.
|