Closed abenkovskii closed 9 years ago
probably best done as an addition to lib_term as that does circles and lines already
HOWTO.md:
- Try to break things up into smaller files. A person trying to load them onto their installation may be > trying to save space and want to only install those things they need.
What do you think?
humm yep fair enough boxes are probably useful more often than the rest of that lib. I was thinking of adding just a small function that used the line drawing already in lib_term but for boxes that are square to the terminal there is probably a bit of overhead with that. (would let you draw boxes at an angle tough.
How I imagine it:
function draw_box(top, left, w, h)
function draw_wide_box(top, h)
What do you think about the second function? Do we need it or only one function is fine?
the second one probably not so much but but one that you fed a %width and %height to might be useful.
also i was thinking of a style argument so that it could be used to print different boxes (eg for indicating focus of selection) style 0
set to print " "
around the edges would be a good way to remove the box without having to clear its contents too.
I'd rather take 3 additional arguments (border_h, border_v, angle) than implementing a limited number of styles.
that works too. how would you feel about the args (list(y0,h,x0,w),list(horizontal,vertical,corner)
that way it is possible to detect what is has been passed so that draw_box(list(1,5),list("#"))
could be used for a full width box where all the borders were #
? or is that overcomplicating it?
Maybe some function from this can be useful: https://github.com/akrasuski1/akrOS/blob/master/lib_window.ks (there are some redundant functions, but you can pick whatever you need)
In particular, draw_any_outline
does almost the exact thing you need - only the corner is hardcoded as plus sign, but that's trivial to change.
@TDW89 In python there are keyword arguments exactly for this purpose. I think taking lists of different size is too complicated. We can make wrapper functions instead.
Yes, I agree with @abenkovskii - wrapper functions seem to be way to go in this case.
I'm going to post a PR adding this soon.
I hate code duplication and we have the same code for printing cool-looking window in lib_number_dialog and in lib_menu