-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improving Contributions.md file * Adding technical docs
- Loading branch information
1 parent
3e2f8be
commit 8764fbe
Showing
2 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This file contains the abstract working of the codebase | ||
|
||
## Structure | ||
|
||
### Font class: | ||
|
||
It is the parent of all font classes (amongus,drpepper,etc) all other font classes inherit attributes and methods from this class , the virtual functions are overridden in the child classes and are triggered on runtime using runtime polymorphism. | ||
|
||
##### Attributes and Methods: | ||
|
||
###### Private: | ||
|
||
`vector<vector<char>> letters;` | ||
2D vector to store the characters in each of the font | ||
This vector is what is actually printed on the screen | ||
|
||
`unsigned int def_rows;` | ||
Total number of rows in the font | ||
`unsigned int def_cols;` | ||
Total number of columns in the font | ||
`unsigned int char_rows;` | ||
The row size of each character in the font | ||
`unsigned int char_cols;` | ||
The column size of each character in the font | ||
`unsigned int curr_col;` | ||
The current position of the column in the font, | ||
Keeping track of this helps us insert new characters into the letters vector | ||
|
||
###### Protected: | ||
`char **getCharGrid(unsigned int rows = 0, unsigned int cols = 0)` | ||
return a 2D character grid of size `rows` and `cols` with each `char=' '`, which can be overwritten later, basically helps in creating new memory space for characters | ||
|
||
###### Public: | ||
|
||
`Fonts::Fonts(int def_rows, int def_cols)` | ||
|
||
This constructor initializes the rows and columns of the font | ||
and fills the vector `this.letter` with spaces | ||
|
||
`void printvector()` | ||
|
||
This function dumps the 2D vector `this.letter` on the screen | ||
|
||
`void pushchar(**character)` | ||
|
||
This function pushes a character into the 2D vector `this.letter` at the current column `curr_col` position | ||
|
||
**All Virtual functions:** | ||
These are to be overwriten in the child classes as each letter will be different in each font, each function is supposed to return a 2D character grid of the respective character | ||
virtual functions include: | ||
`virtual char **a()` to `virtual char **z()` | ||
`virtual char **A()` to `virtual char **Z()` | ||
`virtual char **Zero()` to `virtual char **Nine()` | ||
`virtual char **space()` |