#include #include #include SCM_DEFINE(init, "init", 2, 0, 0, (SCM name, SCM flags), "Initialize Agar's core functionality") { AG_InitCore(scm_to_locale_string(name), scm_to_uint(flags)); return scm_from_uint(AG_InitGraphics(NULL)); } SCM_DEFINE(get_error, "get-error", 0, 0, 0, (), "Return the last error message") { const char *err = AG_GetError(); return scm_from_locale_string(err); } SCM_DEFINE(quit, "quit", 0, 0, 0, (), "Shutdown Petri") { AG_Destroy(); AG_Quit(); return SCM_UNDEFINED; } SCM_DEFINE(event_loop, "event-loop", 0, 0, 0, (), "") { AG_EventLoop(); return SCM_UNDEFINED; } SCM_DEFINE(window_new, "_window-new", 0, 0, 0, (), "Create a new base level container") { return scm_from_pointer(AG_WindowNew(AG_WINDOW_MAIN), AG_ObjectDestroy); } SCM_DEFINE(window_show, "window-show", 1, 0, 0, (SCM win), "Display a window") { AG_WindowShow(scm_to_pointer(win)); return SCM_UNDEFINED; } SCM_DEFINE(label_new, "_label-new", 2, 0, 0, (SCM parent, SCM text), "Create a new label with text") { return scm_from_pointer(AG_LabelNew(scm_to_pointer(parent), 0, scm_to_locale_string(text)), AG_ObjectDestroy); } void init_petri() { #ifndef SCM_MAGIC_SNARFER #include "petri.x" #endif }