ASCII-GFX  2.0
Classes | Functions | Variables
gridarea.cpp File Reference
#include "gridarea.h"
#include "scrollarea.h"
#include "gridfont.h"

Classes

struct  AnimType
 

Functions

void init_anims ()
 
void release_anims ()
 
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)
 is the grid wrapping around or not? More...
 
void clear_grid (int ch)
 clear the scrollable grid area More...
 
void clear_extra (int ch)
 clear the scrollable extra grid area More...
 
void set_grid_border (int ch)
 set the border of the scrollable grid area More...
 
void wrap (int &x, int &y)
 
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...
 
int get_anim (int x, int y)
 
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...
 
void set_anim (int x, int y, int ch)
 
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 update_grid_window ()
 
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, int deltay, bool stop)
 scroll the displayed grid window to center grid position (x, y) More...
 
void release_grid ()
 release allocated memory 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...
 

Variables

static int gridx = 0
 
static int gridy = 0
 
static int fontx = 0
 
static int fonty = 0
 
static int * grid = NULL
 
static int * last = NULL
 
static int * extra = NULL
 
static int * anim = NULL
 
static const int ga_num = 256
 
static AnimTypega_anims = NULL
 
static bool wraparound = false
 

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)

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_anim()

int get_anim ( int  x,
int  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)

◆ init_anims()

void init_anims ( )

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

void release_anims ( )

◆ 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,
int  deltay,
bool  stop 
)

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

◆ set_anim()

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

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

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

◆ update_grid_window()

void update_grid_window ( )

◆ wrap()

void wrap ( int &  x,
int &  y 
)
inline

Variable Documentation

◆ anim

int* anim = NULL
static

◆ extra

int* extra = NULL
static

◆ fontx

int fontx = 0
static

◆ fonty

int fonty = 0
static

◆ ga_anims

AnimType* ga_anims = NULL
static

◆ ga_num

const int ga_num = 256
static

◆ grid

int* grid = NULL
static

◆ gridx

int gridx = 0
static

◆ gridy

int gridy = 0
static

◆ last

int* last = NULL
static

◆ wraparound

bool wraparound = false
static