updated naming

This commit is contained in:
2026-07-17 12:06:22 +02:00
parent 8ff0e89bb1
commit ccd216591a
5 changed files with 80 additions and 94 deletions
+23 -23
View File
@@ -19,24 +19,24 @@
centralize into event sender and subscriber
*/
void myupdatedisplay(const timer &timer_input) {
void myupdatedisplay(const Timer &timer_input) {
int x_offset = COLS / 4;
mvprintw(timer_input.triggercounter, timer_input.triggercounter + x_offset,
mvprintw(timer_input.trigger_counter, timer_input.trigger_counter + x_offset,
"test: █");
}
std::vector<int> mynumbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::vector<int> myothernumbers = {4, 9, 8, 6, 2, 1, 10, 3, 5, 7};
std::vector<int> my_numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::vector<int> my_other_numbers = {4, 9, 8, 6, 2, 1, 10, 3, 5, 7};
void displaynumbers(int startx, int starty, std::vector<int> &input_numbers, cchar_t &input_char) {
void displaynumbers(int start_x, int start_y, std::vector<int> &input_numbers, cchar_t &input_char) {
for (size_t i = 0; i < input_numbers.size(); i++) {
/**
I make a horizontal line of i chars, which are supposed to represent mynumbers
above that, I want a line of bars.
_all_ bars stretch from LINES-1 to LINES-1-numbervalue
**/
mvprintw(LINES -1 - starty, i + startx, "%d,", input_numbers[i]);
mvwvline_set(stdscr, LINES-1-input_numbers[i]-starty, i+startx, &input_char, input_numbers[i]);
mvprintw(LINES -1 - start_y, i + start_x, "%d,", input_numbers[i]);
mvwvline_set(stdscr, LINES-1-input_numbers[i]-start_y, i+start_x, &input_char, input_numbers[i]);
}
}
@@ -58,27 +58,27 @@ int main() {
cchar_t my_c_char = {.attr= A_NORMAL, .chars={L''}, .ext_color = 0};
//create actions, then put them in timers, then put them into the timermanager
auto myaction = std::make_unique<swapaction>(mynumbers);
auto clocktimer =
std::make_unique<timer>("secondsprinter", 1, 10, std::move(myaction));
auto myothersort = std::make_unique<sortaction>(myothernumbers);
auto sorttimer =
std::make_unique<timer>("sorttimer", 0.5, std::move(myothersort));
timermanager mytimermanager;
mytimermanager.addtimer(std::move(clocktimer));
mytimermanager.addtimer(std::move(sorttimer));
auto my_action = std::make_unique<SwapAction>(my_numbers);
auto clock_timer =
std::make_unique<Timer>("secondsprinter", 1, 10, std::move(my_action));
auto my_other_sort = std::make_unique<SortAction>(my_other_numbers);
auto sort_timer =
std::make_unique<Timer>("sorttimer", 0.5, std::move(my_other_sort));
TimerManager my_timer_manager;
my_timer_manager.addtimer(std::move(clock_timer));
my_timer_manager.addtimer(std::move(sort_timer));
while (true) {
erase();
mytimermanager.updatetimers();
displaynumbers(0,0,mynumbers, my_c_char);
displaynumbers(10, 10, myothernumbers, my_c_char);
my_timer_manager.updatetimers();
displaynumbers(0,0,my_numbers, my_c_char);
displaynumbers(10, 10, my_other_numbers, my_c_char);
refresh();
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}