ASCII-GFX  2.0
gridarea.h
Go to the documentation of this file.
1 // NCurses side-scrolling grid-font area
2 // (c) 2020 by Stefan Roettger
3 
4 #pragma once
5 
6 #include "gfx.h"
7 
16 void set_grid_size(int sx, int sy);
17 
19 int get_grid_width();
20 
22 int get_grid_height();
23 
26 void set_grid_window_size(int sx, int sy);
27 
29 void set_grid_wraparound(bool yes = true);
30 
32 void clear_grid(int ch = ' ');
33 
35 void clear_extra(int ch = -1);
36 
38 void set_grid_border(int ch);
39 
41 int get_grid(int x, int y);
42 
44 int get_last(int x, int y);
45 
47 int get_same(int x, int y);
48 
50 int get_extra(int x, int y);
51 
53 void set_grid(int x, int y, int ch);
54 
56 void set_last(int x, int y, int ch);
57 
59 void set_same(int x, int y, int ch);
60 
62 void set_extra(int x, int y, int ch);
63 
65 bool check_grid(int ch);
66 
68 int count_grid(int ch);
69 
71 void replace_grid(int ch, int replace);
72 
75 int *get_grid_area(int x, int y,
76  int sx, int sy);
77 
80 void set_grid_area(int x, int y,
81  int sx, int sy,
82  const int *data);
83 
86 void set_grid_text(int x, int y,
87  const char *text);
88 
90 void render_grid_line(int x1, int y1, int x2, int y2, int ch);
91 
93 void render_grid_frame(int x1, int y1, int x2, int y2, int ch);
94 
96 void flood_fill_grid(int x, int y, int ch);
97 
99 void inverse_flood_fill_grid(int x, int y, int ch);
100 
102 void place_random(int ch, int num, int exclude);
103 
105 void set_grid_animation(int ch, int num, const int *data);
106 
108 void set_grid_animation_string(int ch, const char *str);
109 
111 void position_grid_window(int x, int y);
112 
114 void center_grid_window(int x, int y);
115 
117 void redraw_grid_window(int x, int y);
118 
120 void scroll_grid_window(int x, int y, int deltax = 0, int deltay = 0, bool stop = true);
121 
123 void release_grid();
set_grid_size
void set_grid_size(int sx, int sy)
create a scrollable grid area
Definition: gridarea.cpp:32
get_last
int get_last(int x, int y)
get the last cell character at grid position (x, y)
Definition: gridarea.cpp:153
set_grid_border
void set_grid_border(int ch)
set the border of the scrollable grid area
Definition: gridarea.cpp:108
scroll_grid_window
void scroll_grid_window(int x, int y, int deltax=0, int deltay=0, bool stop=true)
scroll the displayed grid window to center grid position (x, y)
Definition: gridarea.cpp:568
get_grid_height
int get_grid_height()
get the height of the scrollable grid area
Definition: gridarea.cpp:69
get_same
int get_same(int x, int y)
get the same cell character at grid position (x, y)
Definition: gridarea.cpp:169
release_grid
void release_grid()
release allocated memory
Definition: gridarea.cpp:582
check_grid
bool check_grid(int ch)
check grid cell area for presence of character ch
Definition: gridarea.cpp:284
place_random
void place_random(int ch, int num, int exclude)
place random characters
Definition: gridarea.cpp:495
redraw_grid_window
void redraw_grid_window(int x, int y)
redraw the displayed grid window at center grid position (x, y)
Definition: gridarea.cpp:554
set_extra
void set_extra(int x, int y, int ch)
set the extra grid cell at grid position (x, y) to character ch
Definition: gridarea.cpp:262
get_grid_area
int * get_grid_area(int x, int y, int sx, int sy)
get the grid cell area at top-left position (x, y) with size (sx, sy)
Definition: gridarea.cpp:317
set_grid_window_size
void set_grid_window_size(int sx, int sy)
set the size of the displayed grid window
Definition: gridarea.cpp:75
gfx.h
replace
void replace(const Mat3 &m)
replace current transformation with a given transformation matrix
Definition: math2d.cpp:35
set_grid_animation_string
void set_grid_animation_string(int ch, const char *str)
set character animation string
Definition: gridarea.cpp:633
set_grid_text
void set_grid_text(int x, int y, const char *text)
set the grid cells at top-left grid position (x, y) to a text string
Definition: gridarea.cpp:354
render_grid_frame
void render_grid_frame(int x1, int y1, int x2, int y2, int ch)
render a grid frame from position (x1, y1) to (x2, y2)
Definition: gridarea.cpp:454
render_grid_line
void render_grid_line(int x1, int y1, int x2, int y2, int ch)
render a grid line from position (x1, y1) to (x2, y2)
Definition: gridarea.cpp:377
set_same
void set_same(int x, int y, int ch)
set the same cell at grid position (x, y) to character ch
Definition: gridarea.cpp:244
center_grid_window
void center_grid_window(int x, int y)
scroll the displayed grid window to center position (x, y)
Definition: gridarea.cpp:546
count_grid
int count_grid(int ch)
count character ch in grid cell area
Definition: gridarea.cpp:295
set_grid_animation
void set_grid_animation(int ch, int num, const int *data)
set character animation
Definition: gridarea.cpp:614
set_last
void set_last(int x, int y, int ch)
set the last cell at grid position (x, y) to character ch
Definition: gridarea.cpp:227
inverse_flood_fill_grid
void inverse_flood_fill_grid(int x, int y, int ch)
flood-fill everything but a grid cell area starting at position (x, y)
Definition: gridarea.cpp:476
clear_grid
void clear_grid(int ch=' ')
clear the scrollable grid area
Definition: gridarea.cpp:89
replace_grid
void replace_grid(int ch, int replace)
replace character ch in grid cell area
Definition: gridarea.cpp:308
clear_extra
void clear_extra(int ch=-1)
clear the scrollable extra grid area
Definition: gridarea.cpp:100
set_grid
void set_grid(int x, int y, int ch)
set the grid cell at grid position (x, y) to character ch
Definition: gridarea.cpp:210
set_grid_wraparound
void set_grid_wraparound(bool yes=true)
is the grid wrapping around or not?
Definition: gridarea.cpp:83
flood_fill_grid
void flood_fill_grid(int x, int y, int ch)
flood-fill a grid cell area starting at position (x, y)
Definition: gridarea.cpp:463
set_grid_area
void set_grid_area(int x, int y, int sx, int sy, const int *data)
set a grid cell area at top-left position (x, y) with size (sx, sy)
Definition: gridarea.cpp:337
get_grid_width
int get_grid_width()
get the width of the scrollable grid area
Definition: gridarea.cpp:63
get_grid
int get_grid(int x, int y)
get the grid cell character at grid position (x, y)
Definition: gridarea.cpp:137
get_extra
int get_extra(int x, int y)
get the extra grid cell character at grid position (x, y)
Definition: gridarea.cpp:188
position_grid_window
void position_grid_window(int x, int y)
position the displayed grid window at center position (x, y)
Definition: gridarea.cpp:538