mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
add notcurses_version_components()
This commit is contained in:
parent
162f9910c2
commit
3ef1a3a07d
2
NEWS.md
2
NEWS.md
@ -2,6 +2,8 @@ This document attempts to list user-visible changes and any major internal
|
||||
rearrangements of Notcurses.
|
||||
|
||||
* 1.6.1 (not yet released)
|
||||
* Added `notcurses_version_components()` to get the numeric components of
|
||||
the loaded Notcurses version.
|
||||
* Added `notcurses_render_file()` to dump last rendered frame to a `FILE*`.
|
||||
* The `ncreel` widget has been overhauled to bring it in line with the
|
||||
others (`ncreel` began life in another project, predating Notcurses).
|
||||
|
@ -28,6 +28,8 @@ typedef struct notcurses_options {
|
||||
|
||||
**int notcurses_lex_margins(const char* op, notcurses_options* opts);**
|
||||
|
||||
**void notcurses_version_components(int* major, int* minor, int* patch, int* tweak);**
|
||||
|
||||
**struct notcurses* notcurses_init(const notcurses_options* opts, FILE* fp);**
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -27,6 +27,9 @@ extern "C" {
|
||||
|
||||
// Get a human-readable string describing the running notcurses version.
|
||||
API const char* notcurses_version(void);
|
||||
// Cannot be inline, as we want to get the versions of the actual notcurses
|
||||
// library we loaded, not what we compile against.
|
||||
API void notcurses_version_components(int* major, int* minor, int* patch, int* tweak);
|
||||
|
||||
struct notcurses; // notcurses state for a given terminal, composed of ncplanes
|
||||
struct ncplane; // a drawable notcurses surface, composed of cells
|
||||
|
@ -82,6 +82,7 @@ typedef struct notcurses_options {
|
||||
uint64_t flags;
|
||||
} notcurses_options;
|
||||
struct notcurses* notcurses_init(const notcurses_options*, FILE*);
|
||||
void notcurses_version_components(int* major, int* minor, int* patch, int* tweak);
|
||||
int notcurses_lex_margins(const char* op, notcurses_options* opts);
|
||||
int notcurses_stop(struct notcurses*);
|
||||
int notcurses_render(struct notcurses*);
|
||||
|
@ -101,7 +101,10 @@ int intro(struct notcurses* nc){
|
||||
}
|
||||
ncplane_styles_off(ncp, NCSTYLE_ITALIC);
|
||||
ncplane_set_fg_rgb(ncp, 0xff, 0xff, 0xff);
|
||||
if(ncplane_printf_aligned(ncp, rows - 10, NCALIGN_CENTER, "notcurses %s. press 'q' to quit.", notcurses_version()) < 0){
|
||||
int major, minor, patch, tweak;
|
||||
notcurses_version_components(&major, &minor, &patch, &tweak);
|
||||
if(ncplane_printf_aligned(ncp, rows - 10, NCALIGN_CENTER, "notcurses %d.%d.%d.%d. press 'q' to quit.",
|
||||
major, minor, patch, tweak) < 0){
|
||||
return -1;
|
||||
}
|
||||
ncplane_styles_off(ncp, NCSTYLE_BOLD);
|
||||
|
@ -572,7 +572,7 @@ int witherworm_demo(struct notcurses* nc){
|
||||
if(timespec_to_ns(&screenend) < timespec_to_ns(&cur)){
|
||||
break;
|
||||
}
|
||||
}while(key == 0);
|
||||
}while(key != NCKEY_RESIZE);
|
||||
free(wctx.worms);
|
||||
|
||||
ncplane_destroy(mess);
|
||||
@ -584,9 +584,6 @@ int witherworm_demo(struct notcurses* nc){
|
||||
DEMO_RENDER(nc);
|
||||
}
|
||||
}while(key == NCKEY_RESIZE);
|
||||
if(key == 'q'){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
ncplane_set_scrolling(n, false);
|
||||
return 0;
|
||||
|
@ -20,6 +20,13 @@
|
||||
|
||||
#define ESC "\x1b"
|
||||
|
||||
void notcurses_version_components(int* major, int* minor, int* patch, int* tweak){
|
||||
*major = atoi(notcurses_VERSION_MAJOR);
|
||||
*minor = atoi(notcurses_VERSION_MINOR);
|
||||
*patch = atoi(notcurses_VERSION_PATCH);
|
||||
*tweak = atoi(notcurses_VERSION_TWEAK);
|
||||
}
|
||||
|
||||
// only one notcurses object can be the target of signal handlers, due to their
|
||||
// process-wide nature.
|
||||
static notcurses* _Atomic signal_nc = ATOMIC_VAR_INIT(NULL); // ugh
|
||||
|
@ -1,6 +1,7 @@
|
||||
#define notcurses_VERSION_MAJOR "@notcurses_VERSION_MAJOR@"
|
||||
#define notcurses_VERSION_MINOR "@notcurses_VERSION_MINOR@"
|
||||
#define notcurses_VERSION_PATCH "@notcurses_VERSION_PATCH@"
|
||||
#define notcurses_VERSION_TWEAK "@notcurses_VERSION_TWEAK@"
|
||||
#cmakedefine DFSG_BUILD
|
||||
#cmakedefine USE_QRCODEGEN
|
||||
// exclusive with USE_OIIO
|
||||
|
Loading…
x
Reference in New Issue
Block a user