tft create user tree

This commit is contained in:
vrd
2023-02-18 19:04:39 +02:00
parent 4e3816ae15
commit 16894e2983
13 changed files with 46 additions and 11 deletions
+48
View File
@@ -0,0 +1,48 @@
#pragma once
#include <utility>
#include <ncursesw/ncurses.h>
#include "common/basicTypes.h"
/* template <class Vec> */
/* Vec& operator+=(Vec& lhs, Vec&& rhs) // Combine 2 vectors */
/* { */
/* lhs.reserve(lhs.size() + rhs.size()); */
/* for(auto&& el: rhs) */
/* lhs.push_back( std::move(el) ); */
/* return lhs; */
/* } */
/* template <class Vec> */
/* Vec& operator+=(Vec& lhs, const Vec& rhs) // Combine 2 vectors */
/* { */
/* lhs.reserve(lhs.size() + rhs.size()); */
/* for(const auto& el: rhs) */
/* lhs.push_back(el); */
/* return lhs; */
/* } */
template <class Vec>
void remove(Vec& vec, size_t pos) /* Remove from vector by moving the last element in its place */
{
vec[pos] = vec[vec.size() - 1];
vec.pop_back();
}
inline I32 min(I32 a, I32 b)
{
return a <= b ? a : b;
}
inline I32 max(I32 a, I32 b)
{
return a >= b ? a : b;
}
/* wheather a pad with the given coordinates will be visible */
bool willBeVisible(I16 drawY, I16 drawX, U16 height, U16 width);
/* like pnoutrefresh but pminrow,col are calculated based on width,height and
top left coords, which can be negative (outside the screen) */
void drawpad(WINDOW* pad, I16 drawY, I16 drawX);