Window creation/X11: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 2,210: | Line 2,210: | ||
<br> |
<br> |
||
As it's not currently possible for Wren-cli to access Xlib directly, we embed a Wren script in a C application to complete this task. |
As it's not currently possible for Wren-cli to access Xlib directly, we embed a Wren script in a C application to complete this task. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">/* Window_creation_X11.wren */ |
||
var KeyPressMask = 1 << 0 |
var KeyPressMask = 1 << 0 |
||
Line 2,276: | Line 2,276: | ||
<br> |
<br> |
||
We now embed this Wren script in the following C program, compile and run it. |
We now embed this Wren script in the following C program, compile and run it. |
||
<syntaxhighlight lang="c"> |
<syntaxhighlight lang="c">/* gcc Window_creation_X11.c -o Window_creation_X11 -lX11 -lwren -lm */ |
||
#include <stdio.h> |
|||
#include <stdlib.h> |
#include <stdlib.h> |
||
#include <string.h> |
#include <string.h> |
||
Line 2,477: | Line 2,479: | ||
WrenVM* vm = wrenNewVM(&config); |
WrenVM* vm = wrenNewVM(&config); |
||
const char* module = "main"; |
const char* module = "main"; |
||
const char* fileName = " |
const char* fileName = "Window_creation_X11.wren"; |
||
char *script = readFile(fileName); |
char *script = readFile(fileName); |
||
WrenInterpretResult result = wrenInterpret(vm, module, script); |
WrenInterpretResult result = wrenInterpret(vm, module, script); |