From 6e4ab5b91771e516b3fb80f5692f31a23001d72c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 9 Apr 2009 15:26:51 +0000 Subject: add frontend selection and fix finalisation support svn path=/trunk/libnsfb/; revision=7072 --- include/frontend.h | 9 +++++++-- include/libnsfb.h | 24 ++++++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/frontend.h b/include/frontend.h index ee76632..5590543 100644 --- a/include/frontend.h +++ b/include/frontend.h @@ -1,4 +1,6 @@ -#include "libnsfb.h" /* exported interface */ +/* libnsfb framebuffer frontend support */ + +#include "libnsfb.h" #include "nsfb.h" /* frontend default options */ @@ -25,7 +27,6 @@ typedef struct nsfb_frontend_rtns_s { void _nsfb_register_frontend(const enum nsfb_frontend_e type, const nsfb_frontend_rtns_t *rtns, const char *name); -nsfb_frontend_rtns_t *nsfb_frontend_get_rtns(enum nsfb_frontend_e type); /* macro which adds a builtin command with no argument limits */ #define NSFB_FRONTEND_DEF(__name, __type, __rtns) \ @@ -33,3 +34,7 @@ nsfb_frontend_rtns_t *nsfb_frontend_get_rtns(enum nsfb_frontend_e type); void __name##_register_frontend(void) { \ _nsfb_register_frontend(__type, __rtns, #__name); \ } + +/* Obtain routines for a frontend */ +nsfb_frontend_rtns_t *nsfb_frontend_get_rtns(enum nsfb_frontend_e type); + diff --git a/include/libnsfb.h b/include/libnsfb.h index 0af8ab3..0869614 100644 --- a/include/libnsfb.h +++ b/include/libnsfb.h @@ -7,7 +7,7 @@ typedef struct nsfb_cursor_s nsfb_cursor_t; typedef struct nsfb_s nsfb_t; typedef uint32_t nsfb_colour_t; -/* bounding box */ +/** bounding box for plotting operations */ typedef struct nsfb_bbox_s { int x0; int y0; @@ -17,8 +17,8 @@ typedef struct nsfb_bbox_s { /** The type of frontend for a framebuffer context. */ enum nsfb_frontend_e { - NSFB_FRONTEND_NONE = 0, /* Empty frontend. */ - NSFB_FRONTEND_SDL, + NSFB_FRONTEND_NONE = 0, /**< Empty frontend. */ + NSFB_FRONTEND_SDL, /**< SDL frontend */ NSFB_FRONTEND_LINUX, NSFB_FRONTEND_VNC, NSFB_FRONTEND_ABLE, @@ -33,12 +33,28 @@ enum nsfb_frontend_e { */ nsfb_t *nsfb_init(enum nsfb_frontend_e frontend); +/** Finalise nsfb. + * + * This shuts down and releases all resources associated with an nsfb context. + * + * @param nsfb The context returned from ::nsfb_init tofinalise + */ +int nsfb_finalise(nsfb_t *nsfb); + /** Initialise selected frontend. * - * @param nsfb The context frturned from ::nsfb_init + * @param nsfb The context returned from ::nsfb_init */ int nsfb_init_frontend(nsfb_t *nsfb); +/** Select frontend type from a name. + * + * @param name The name to select a frontend. + * @return The frontend type or NSFB_FRONTEND_NONE if frontend with specified + * name was not available + */ +enum nsfb_frontend_e nsfb_frontend_from_name(const char *name); + /** Process input from a frontend. */ int nsfb_input(nsfb_t *nsfb); -- cgit v1.2.3