Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
43
Task/Hello-world-Graphical/Jsish/hello-world-graphical.jsish
Normal file
43
Task/Hello-world-Graphical/Jsish/hello-world-graphical.jsish
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
extension JsiAgarGUI = { // libAgar GUI from Jsi
|
||||
/*
|
||||
Alert popup, via libAgar and Jsish CData
|
||||
tectonics:
|
||||
jsish -c JsiAgar.jsc
|
||||
gcc `jsish -c -cflags true JsiAgar.so` `agar-config --cflags --libs`
|
||||
jsish -e 'require("JsiAgar"); JsiAgar.alert("Goodbye, World!");'
|
||||
*/
|
||||
#include <agar/core.h>
|
||||
#include <agar/gui.h>
|
||||
|
||||
/* Terminate on close */
|
||||
void windDown(AG_Event *event) {
|
||||
AG_Terminate(0);
|
||||
}
|
||||
|
||||
function alert(msg:string):void { // Display a JsiAgar windowed message
|
||||
/* Native C code block (in a JSI function wrapper) */
|
||||
AG_Window *win;
|
||||
AG_Box *box;
|
||||
|
||||
Jsi_RC rc = JSI_OK;
|
||||
|
||||
if (AG_InitCore(NULL, 0) == -1 || AG_InitGraphics(0) == -1) return (JSI_ERROR);
|
||||
AG_BindStdGlobalKeys();
|
||||
|
||||
win = AG_WindowNew(0);
|
||||
|
||||
box = AG_BoxNew(win, AG_BOX_VERT, 0);
|
||||
AG_LabelNewS(box, AG_LABEL_HFILL, msg);
|
||||
AG_ButtonNewFn(box, AG_BUTTON_HFILL, "Ok", AGWINDETACH(win), "%p", win);
|
||||
|
||||
AG_SetEvent(win, "window-detached", windDown, NULL);
|
||||
AG_WindowShow(win);
|
||||
|
||||
AG_EventLoop();
|
||||
|
||||
AG_DestroyGraphics();
|
||||
AG_Destroy();
|
||||
|
||||
return rc;
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue