C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
pad_demo.c File Reference
#include <notcurses/notcurses.h>
#include <unistd.h>
Include dependency graph for pad_demo.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE   1
#define _XOPEN_SOURCE_EXTENDED   1

Functions

int main (void)

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE   1

Definition at line 2 of file pad_demo.c.

◆ _XOPEN_SOURCE_EXTENDED

#define _XOPEN_SOURCE_EXTENDED   1

Definition at line 1 of file pad_demo.c.

Function Documentation

◆ main()

int main ( void )

Definition at line 7 of file pad_demo.c.

7 {
8 // 1. Initialize Notcurses
9 struct notcurses_options opts = {
10 .flags = NCOPTION_SUPPRESS_BANNERS,
11 };
12 struct notcurses *nc = notcurses_init(&opts, NULL);
13 if (!nc)
14 return 1;
15
16 struct ncplane *stdn = notcurses_stdplane(nc);
17 unsigned term_y, term_x;
18 ncplane_dim_yx(stdn, &term_y, &term_x);
19
20 struct ncplane_options plane_opts = {
21 .y = 0,
22 .x = 0,
23 .rows = 100,
24 .cols = 200,
25 };
26 struct ncplane *pad = ncplane_create(stdn, &plane_opts);
27
28 uint64_t channels = 0;
29 ncplane_set_fchannel(pad, 0x002244);
30 ncplane_set_bchannel(pad, 0x000000);
31 ncplane_set_base(pad, " ", 0, channels);
32
33 for (int y = 0; y < 100; y += 5) {
34 for (int x = 0; x < 200; x += 20) {
35 ncplane_printf_yx(pad, y, x, "[Row %d, Col %d]", y, x);
36 }
37 }
38
39 for (int i = 0; i <= 40; i++) {
40 ncplane_move_yx(pad, -i, -(i * 2));
41 notcurses_render(nc);
42 usleep(100000); // 100ms delay
43 }
44
45 notcurses_stop(nc);
46 return 0;
47}
uint64_t channels
Definition nckeys.c:42
NotCurses * nc
Definition nckeys.c:45