Commit Graph

308 Commits

Author SHA1 Message Date
nick black
5e27499194 add notcurses-keyplot #430 2020-04-03 05:51:02 -04:00
nick black
d541cda306 independent variable 2020-04-03 05:51:02 -04:00
nick black
4afda7a625 float some geometry concepts 2020-04-03 05:51:02 -04:00
nick black
5aedb3491d ncplot_plane(), ncplot_destroy() 2020-04-03 05:51:02 -04:00
nick black
f29a5a7bd9 declare ncplot_create() 2020-04-03 05:51:02 -04:00
nick black
a45d888601
All fill-type functions return cells changed
Fill-type functions used to return 0 for success, and -1
on failure. They now return the number of cells written
on success, similarly to ncvisual_render(). Resolves #427.
2020-03-29 05:26:56 -04:00
nick black
8651486ad7
Don't say DirectColor when TrueColor is meant 2020-03-27 12:58:30 -04:00
nick black
a77774f4dc
notcurses_at_yx(): value-result u32+u64, not cell
Resolves #410. notcurses_at_yx() accepted a cell*, but the
gcluster of this cell was always set to 0. The EGC is instead
a heap-allocated copy, returned as the primary return value.
This is due to the absence of an egcpool to bind against.
Existing callers can be converted thus:

* instead of passing cell 'c', pass &(c)->attrword, &(c)->channels
* either initialize 'c' with CELL_TRIVIAL_INITIALIZER, or set its
   gcluster field to 0 following the call

I've updated all calls from tests/demos, updated the docs, and
updated the C++ and Python wrappers.
2020-03-27 03:49:13 -04:00
nick black
73b61f6a69 Add bound planes (#71) plus docs/tests
Add ncplane_bound(3). This allows a new plane N to be created in the
*bound* state relative to another ncplane B. If B moves, N moves the
same amount. If N is moved, the coordinates are taken relative to B
as opposed to the standard plane. If B is destroyed, N is destroyed.
Each plane can have many planes bound to it, but can only be bound to
a single plane. Add ncplane_reparent(3). This allows a plane to be
detached from any plane to which it is bound, and optionally rebound
to a new plane. The standard plane cannot be reparented.
Documentation and unit tests have been added for both.
2020-03-27 03:13:30 -04:00
nick black
91f907a184
gradient_sized (C++): fix parameter name 2020-03-26 18:19:01 -04:00
Nick Black
f9c54761f5
Basic mandelbrot for normal demo #145 (#424)
normal: working mandelbrot, very basic #145
2020-03-25 07:19:56 -04:00
Nick Black
de9158bd7b
More tetris work for book #421 (#423)
* tetris: use NES gravities
* tetris: use NES grav multiplier of 50ms
* tetris: implement move down #421
* README: mention notcurses-tetris #421
* tetris: use double box for boundary #421
* tetris: extract background.h
* tetris: break up into chunks suitable for book
* tetris: do the rotations
2020-03-25 04:06:38 -04:00
nick black
ae1421db15
ncvisual_render() API change/documentation #422
ncvisual_render() now returns the number of cells emitted
rather than just 0/-1. -1 is still returned on failure.
Rather than 0 for length meaning "all possible length", it
now means 0, and -1 means "all possible length". All demos,
tests, and PoCs have been updated. #422
2020-03-24 18:43:10 -04:00
Marek Habersack
73b13e0fd5 [C++] There can be only one stdplane
Fixes: https://github.com/dankamongmen/notcurses/issues/409

Standard planes can be duplicated but the copy must not be treated as a
standard plane. There can be only one :)

Make it so.
2020-03-24 16:33:58 -04:00
nick black
8113ce72c1 fix dumb error in ncplane_below() description 2020-03-23 12:46:35 -04:00
Nick Black
2b7b384e91
Most of notcurses-tetris, mergedown fixes (#420)
* ncplane_mergedown() fix for small planes #417
* tetris game needed for the book
2020-03-23 01:12:09 -04:00
Marek Habersack
ad93c03851 [C++] API sync
Added:

  * Plane: mergedown (`ncplane_mergedown`)
2020-03-22 17:40:47 -04:00
Nick Black
52bdbc6724
ncplane_translate() accept NULL dest as standard plane #408 (#411)
* tetris man page
* tetris basic skeleton
* tetris: Ticker()
* README: fix up some obsolete terminology
* tetris: draw the game board
* tetris: add NewPiece()
* tetris: draw tetriminos
* tetris: check for stuck piece, move it down
* Accept NULL dst in ncplane_translate() #408
2020-03-22 17:33:08 -04:00
nick black
7e71ad8e11 implement ncplane_mergedown() #361 2020-03-21 05:09:31 -04:00
nick black
38f4255dc0 Define ncplane_mergedown() #361
ncplane_mergedown() is similar to the "Merge down" operation
in the GIMP. It writes to the destination plane the result
of rendering the source and destination frames per se.
2020-03-21 05:09:31 -04:00
nick black
8312b88e3c NotCurses::stop(): match original semantics 2020-03-15 01:21:55 -04:00
nick black
66bb614ab3 NotCurses::stop(): propogate out notcurses_stop() return value 2020-03-15 01:19:04 -04:00
Marek Habersack
3e78dd7d1f [C++] API sync
New classes:

   * MultiSelector (`ncmultiselector_*`)

Added:

   * Direct: cursor_{enable,disable}
   * Plane: high_gradient (`ncplane_highgradient`)
   * Plane: high_gradient_sized (`ncplane_highgradient_sized`)
   * Plane: rotate_cw (`ncplane_rotate_cw`)
   * Plane: rotate_ccw (`ncplane_rotate_ccw`)

Updated:

   * NotCurses: added all the margin initializers to the default options
2020-03-14 21:49:32 -04:00
nick black
ba90c70a47
ncplane_cursor_yx() takes const first argument 2020-03-14 21:15:37 -04:00
nick black
1b4333861a
add ncdirect_{en,dis}able_cursor() #402 2020-03-13 09:52:00 -04:00
Nick Black
c056a0a026
Subregion renders #293 (#404)
Add four new fields to notcurses_options: margin_{tblr}, which requests margins to the top, right, bottom, and left. Render only within those margins, leaving the screen otherwise untouched (well, cleared if using the alternate screen). #293
2020-03-13 05:07:33 -04:00
nick black
be089747a7 ncmultiselector_selected() #322 2020-03-09 15:31:16 -04:00
nick black
638be8feb7 multiselector options/items #322 2020-03-09 15:31:16 -04:00
nick black
a46393b035 ncmultiselect: get space rigged up #322 2020-03-09 15:31:16 -04:00
nick black
4abe078eae ncmultiselector #322 2020-03-09 15:31:16 -04:00
nick black
635d6e5751 ncmultiselect demo 2020-03-09 15:31:16 -04:00
nick black
6060248968 ncmultiselector_options structure #322 2020-03-09 15:31:16 -04:00
nick black
eead4c1414
notcurses_highgradient() added #398 2020-03-08 04:05:55 -04:00
Nick Black
4e58747709
ncplane_rotate_cw() and ncplane_rotate_ccw() (#396)
Introduce limited plane rotation capability. We currently support clockwise and counterclockwise rotation of planes. Square and rectangular geometries are both supported, but there must be an even number of columns. The atomic unit of rotation is a 2x1 "square" (this assumes .5 cell aspect ratio). We can only rotate those glyphs which have rotated equivalents, and not even all of those. We currently handle only:

* null glyph
* space
* upper half block
* lower half block
* full block

I've added unit tests as well. This functionality is used by our Tetris example in the book
2020-03-07 18:36:49 -05:00
nick black
333f7c1192
define ncplane_rotate_cw/ccw() 2020-03-05 18:07:20 -05:00
nick black
3498956370
ncplane_mouseevent_p()->ncplane_translate_abs()
ncplane_mouseevent_p() is retired--it was poorly named, and
ncplane_translate_abs() does what it does, plus more, plus
more generally (it works on any y, x, not necessarily an
ncinput). update c++ wrappers #394.
2020-03-03 00:59:44 -05:00
nick black
bb579d0d05
notcurses_directmode()->ncdirect_init() 2020-03-02 20:19:16 -05:00
nick black
c6f27f1bee
notcurses_resize() update docs #367 2020-02-29 23:05:51 -05:00
nick black
c87a9ed5dd
Gradients: set alpha, better prechecks #389
Gradients can't use palette-indexed color, so don't allow it
in either the foreground or background of any channels. All
channels must have the same alpha setting, which will be matched
in the gradient. #389
2020-02-29 16:35:57 -05:00
Marek Habersack
3467a0adef [C++] API sync
Added:

  * NCKey: `ScrollUp`, `ScrollDown` and `Return`
  * Plane: is_mouse_event (`ncplane_mouseevent_p`)
2020-02-27 11:48:36 -05:00
nick black
87cac84db2
remove obsolete FIXME 2020-02-25 02:36:51 -05:00
nick black
a09bdc4ade
Add seqnum field to ncinput #374 2020-02-24 18:11:39 -05:00
nick black
ddd33fea31
ncdirect_move() doc, readme, python, c++ #382 2020-02-24 16:56:51 -05:00
nick black
a626178b16
ncdirect: cursor movement / geom detection #382 2020-02-24 16:30:51 -05:00
nick black
40428fd05e
Cell: non-OPAQUE always sets non-default bit 2020-02-23 12:11:28 -05:00
nick black
bdd0917ea4
selector: transparent where we aren't 2020-02-23 09:38:58 -05:00
nick black
bf60c51b3d
nckey: aliases NCKEY_ENTER, SCROLL_* 2020-02-23 04:00:52 -05:00
Marek Habersack
945c3a5f4f [C++] API sync
Added:
 * Cell: get_addrword (`cell.attrword`)
 * Cell: get_channels (`cell.channels`)
 * NotCurses: get_stdplane overloads (`notcurses_stddim_yx`)
 * Plane: putc (support for `ncplane_putsimple_stainable`,
   `ncplane_putegc_stainable`, `ncplane_putwegc_stainable`)
 * Plane: format (`ncplane_format`)
 * Plane: stain (`ncplane_stain`)
 * Plane: translate (`ncplane_translate`)
2020-02-23 02:57:01 -05:00
Nick Black
745e742a12
Fix gradient engine #368 (#372)
Simplify and correct the gradient engine, resolving all test breakage.
2020-02-22 21:00:03 -05:00
nick black
5e38da9ea3
implement ncplane_stain() #347 2020-02-21 07:00:53 -05:00