ASCII-GFX  2.0
Functions
gridarea.h File Reference
#include "gfx.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void set_grid_size (int sx, int sy)
 create a scrollable grid area More...
 
int get_grid_width ()
 get the width of the scrollable grid area More...
 
int get_grid_height ()
 get the height of the scrollable grid area More...
 
void set_grid_window_size (int sx, int sy)
 set the size of the displayed grid window More...
 
void set_grid_wraparound (bool yes=true)
 is the grid wrapping around or not? More...
 
void clear_grid (int ch=' ')
 clear the scrollable grid area More...
 
void clear_extra (int ch=-1)
 clear the scrollable extra grid area More...
 
void set_grid_border (int ch)
 set the border of the scrollable grid area More...
 
int get_grid (int x, int y)
 get the grid cell character at grid position (x, y) More...
 
int get_last (int x, int y)
 get the last cell character at grid position (x, y) More...
 
int get_same (int x, int y)
 get the same cell character at grid position (x, y) More...
 
int get_extra (int x, int y)
 get the extra grid cell character at grid position (x, y) More...
 
void set_grid (int x, int y, int ch)
 set the grid cell at grid position (x, y) to character ch More...
 
void set_last (int x, int y, int ch)
 set the last cell at grid position (x, y) to character ch More...
 
void set_same (int x, int y, int ch)
 set the same cell at grid position (x, y) to character ch More...
 
void set_extra (int x, int y, int ch)
 set the extra grid cell at grid position (x, y) to character ch More...
 
bool check_grid (int ch)
 check grid cell area for presence of character ch More...
 
int count_grid (int ch)
 count character ch in grid cell area More...
 
void replace_grid (int ch, int replace)
 replace character ch in grid cell area More...
 
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) More...
 
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) More...
 
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 More...
 
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) More...
 
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) More...
 
void flood_fill_grid (int x, int y, int ch)
 flood-fill a grid cell area starting at position (x, y) More...
 
void inverse_flood_fill_grid (int x, int y, int ch)
 flood-fill everything but a grid cell area starting at position (x, y) More...
 
void place_random (int ch, int num, int exclude)
 place random characters More...
 
void set_grid_animation (int ch, int num, const int *data)
 set character animation More...
 
void set_grid_animation_string (int ch, const char *str)
 set character animation string More...
 
void position_grid_window (int x, int y)
 position the displayed grid window at center position (x, y) More...
 
void center_grid_window (int x, int y)
 scroll the displayed grid window to center position (x, y) More...
 
void redraw_grid_window (int x, int y)
 redraw the displayed grid window at center grid position (x, y) More...
 
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) More...
 
void release_grid ()
 release allocated memory More...
 

Function Documentation

◆ center_grid_window()

void center_grid_window ( int  x,
int  y 
)

scroll the displayed grid window to center position (x, y)

◆ check_grid()

bool check_grid ( int  ch)

check grid cell area for presence of character ch

◆ clear_extra()

void clear_extra ( int  ch = -1)

clear the scrollable extra grid area

◆ clear_grid()

void clear_grid ( int  ch = ' ')

clear the scrollable grid area

◆ count_grid()

int count_grid ( int  ch)

count character ch in grid cell area

◆ flood_fill_grid()

void flood_fill_grid ( int  x,
int  y,
int  ch 
)

flood-fill a grid cell area starting at position (x, y)

◆ get_extra()

int get_extra ( int  x,
int  y 
)

get the extra grid cell character at grid position (x, y)

◆ get_grid()

int get_grid ( int  x,
int  y 
)

get the grid cell character at grid position (x, y)

◆ 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)

  • returns a newly allocated array of respective size

◆ get_grid_height()

int get_grid_height ( )

get the height of the scrollable grid area

◆ get_grid_width()

int get_grid_width ( )

get the width of the scrollable grid area

◆ get_last()

int get_last ( int  x,
int  y 
)

get the last cell character at grid position (x, y)

◆ get_same()

int get_same ( int  x,
int  y 
)

get the same cell character at grid position (x, y)

◆ 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)

◆ place_random()

void place_random ( int  ch,
int  num,
int  exclude 
)

place random characters

◆ position_grid_window()

void position_grid_window ( int  x,
int  y 
)

position the displayed grid window at center position (x, y)

◆ redraw_grid_window()

void redraw_grid_window ( int  x,
int  y 
)

redraw the displayed grid window at center grid position (x, y)

◆ release_grid()

void release_grid ( )

release allocated memory

◆ 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)

◆ 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)

◆ replace_grid()

void replace_grid ( int  ch,
int  replace 
)

replace character ch in grid cell area

◆ 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)

◆ set_extra()

void set_extra ( int  x,
int  y,
int  ch 
)

set the extra grid cell at grid position (x, y) to character ch

◆ set_grid()

void set_grid ( int  x,
int  y,
int  ch 
)

set the grid cell at grid position (x, y) to character ch

◆ set_grid_animation()

void set_grid_animation ( int  ch,
int  num,
const int *  data 
)

set character animation

◆ set_grid_animation_string()

void set_grid_animation_string ( int  ch,
const char *  str 
)

set character animation string

◆ 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)

  • the data is made up from consecutive lines of characters

◆ set_grid_border()

void set_grid_border ( int  ch)

set the border of the scrollable grid area

◆ set_grid_size()

void set_grid_size ( int  sx,
int  sy 
)

create a scrollable grid area

  • with sx columns and sy rows
  • the grid area contains a single grid char per cell
    • a grid char consists of a grid of 5x3 ASCII characters by default
  • after grid area creation we need to
    • define the screen window size via set_grid_window_size
    • define the contents of the grid area via set_grid, flood_fill_grid etc.
    • and finally render the grid via redraw_grid_window or scroll_grid_window

◆ 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

  • the grid area is made up from consecutive text lines separated by \n

◆ set_grid_window_size()

void set_grid_window_size ( int  sx,
int  sy 
)

set the size of the displayed grid window

  • the size is defined in terms of grid chars

◆ set_grid_wraparound()

void set_grid_wraparound ( bool  yes = true)

is the grid wrapping around or not?

◆ set_last()

void set_last ( int  x,
int  y,
int  ch 
)

set the last cell at grid position (x, y) to character ch

◆ set_same()

void set_same ( int  x,
int  y,
int  ch 
)

set the same cell at grid position (x, y) to character ch