-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display: Added table content drawing
- Loading branch information
Petr Laštovička
committed
Apr 27, 2022
1 parent
1892f9f
commit fbd3917
Showing
11 changed files
with
108 additions
and
39 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 |
---|---|---|
@@ -1,8 +1,45 @@ | ||
#include "app.hpp" | ||
#include "table/cell.hpp" | ||
|
||
namespace cz::lastaapps::vimxel { | ||
int App::run(vector<string> args) { | ||
display::Display().draw(); | ||
return 0; | ||
} | ||
} | ||
int App::run(vector<string> args) { | ||
initNCurses(); | ||
try { | ||
shared_ptr<table::Table> table = loadTable(); | ||
display::Display display(table->createCellContract()); | ||
display.draw(); | ||
} catch(...) { | ||
destroyNCurses(); | ||
return 1; | ||
} | ||
destroyNCurses(); | ||
return 0; | ||
} | ||
|
||
shared_ptr<table::Table> App::loadTable() { | ||
auto table = shared_ptr<table::Table>(new table::Table); | ||
for (int i = 0; i < 42; i++) | ||
for (int j = 0; j < 69; j++) | ||
table->updateCell(Coordinates(i, j), TextCell(to_string(i + 1) + ", " + to_string(j + 1))); | ||
return table; | ||
} | ||
|
||
void App::initNCurses() { | ||
initscr(); | ||
// Ctr+C gets ignored | ||
// raw(); | ||
// Ctr+C works as normal | ||
cbreak(); | ||
// pressed characters wouldn't be printed | ||
noecho(); | ||
// arrows, F keys and others enabled | ||
keypad(stdscr, TRUE); | ||
// hide cursor | ||
curs_set(false); | ||
} | ||
|
||
void App::destroyNCurses() { | ||
endwin(); | ||
} | ||
|
||
} // namespace cz::lastaapps::vimxel |
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
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
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
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
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