Switch to a autotools build system and format
This commit is contained in:
12
libpetri-guile/Makefile.am
Normal file
12
libpetri-guile/Makefile.am
Normal file
@@ -0,0 +1,12 @@
|
||||
SUFFIXES = .x
|
||||
|
||||
extensiondir = $(GUILE_EXTENSION)
|
||||
extension_LTLIBRARIES = libpetri-guile.la
|
||||
|
||||
libpetri_guile_la_SOURCES = petri.c
|
||||
libpetri_guile_la_CFLAGS = `pkg-config --cflags guile-3.0 agar`
|
||||
libpetri_guile_la_LDFLAGS = `pkg-config --libs guile-3.0 agar`
|
||||
BUILT_SOURCES = petri.x
|
||||
|
||||
petri.x: petri.c
|
||||
guile-snarf -o $@ $< $(libpetri_guile_la_CFLAGS)
|
||||
58
libpetri-guile/petri.c
Normal file
58
libpetri-guile/petri.c
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <agar/core.h>
|
||||
#include <agar/gui.h>
|
||||
#include <libguile.h>
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user