Textui reform (warning: long and full of C)
Collapse
X
-
edit: Yeah, I decided to do it this way.
https://postimg.org/image/8iea5hvm1/Leave a comment:
-
Did a big, boring refactor of the frontend and merged curses stuff into textui2. Hopefully it works... Anyway, now textui2 is even with master.
The next step is restoring debugging stuff.Leave a comment:
-
OK, I did that. One term for one handler, no options. That also allowed to remove ~300 lines from the frontend and made it less mind-boggling.
I guess the next thing to do is to fix various bugs and update textui2 to angband's master. It's 43 commits behind and 649 commits ahead
edit: now I don't like that terms are displayed as numbers in the GUI (top of the screen). I was thinking about using a two-letter abbreviations for them, like that:
That looks pretty cryptic, but no more cryptic than numbers, IMO, and there are tooltips for them... opinions?
I also wanted to try to display them as roman numerals instead of arabic, unfortunately, int_to_roman() is a static function
edit: Yeah, I decided to do it this way.
edit: Decided to revert it and use hexadecimal numbers instead. Angband's players are nerds anywayLast edited by t4nk; August 29, 2016, 15:02.Leave a comment:
-
-
(I mean, there are options for choosing font, transparency, etc, but this is GUI options, not game options that live in '=' menu).
edit: this is how the gui menu looks like:
That will stay as it is.Last edited by t4nk; August 26, 2016, 11:03.Leave a comment:
-
Is this the point where you could put the options for each terminal window type into an edit file?Leave a comment:
-
OK, here my plan:
There should be a file "list-angband-terms.h" with contents like this:
Code:ATERM(CAVE, "Main", 1, 1) ... ATERM(PLAYER_BASIC, "Display player (basic)", 72, 24) ATERM(PLAYER_EXTRA, "Display player (extra)", 80, 24)
Code:/** * \file ui2-term-wrapper.c * \brief Handles everything related to permanent subwindows of Angband */ static struct { int index; char *name; int min_rows; int min_cols; struct angband_term aterm; } aterms[] = { #define ATERM(a, b, c, d) {.index = ATERM_##a, .name = b, .min_rows = c, .min_cols = d}, #include "list-angband-terms.h" #undef ATERM };
Hardcoding sizes like that might seem bad, but note that over time they can be unhardcoded in a backwards compatible manner, just by setting min_cols and min_rows to 1 (since the smallest term that can be created is 1x1). We'll also lose the possibility to create two identical terms (e.g., two terms for messages), which I think is no great loss.
The upside is that frontends could be significantly simplified. They would create terms like that:
Code:int min_width; int min_height; aterm_get_min_size(ATERM_PLAYER_EXTRA, &min_width, &min_height); struct term_create_info info = { .width = min_width, .height = min_height, /* other things */ }; term t = Term_create(&info); aterm_init(ATERM_PLAYER_EXTRA, t);
Another upside is that it will be easy to bring back options for subwindows (in the '=' menu).
I'll think about it more, while I'm playing the Sangband compOpinions welcome. BTW, I don't like the name "angband_term", better names are especially welcome
Maybe "struct term_wrapper"?
Last edited by t4nk; August 26, 2016, 08:09.Leave a comment:
-
Beyond a certain size, I'd truncate the information to be shown to the size of the window, leaving the on screen material at the minimum size. There's a certain point where you can't see anything worth a damn anyway.
That's assuming that the size where they crash isn't quite large of course.) requires 80x24 characters. "Display player (basic)" needs 72x24... it would probably be better to enforce minimum size if people want to use those.
Leave a comment:
-
Beyond a certain size, I'd truncate the information to be shown to the size of the window, leaving the on screen material at the minimum size. There's a certain point where you can't see anything worth a damn anyway.
That's assuming that the size where they crash isn't quite large of course.Leave a comment:
-
Making decent progress:
Now, the problem is that additional subwindows make the game crash immediately when they're too small. That's because the new Term package doesn't tolerate printing off screen. An easy way around it is to make Term less strict... the proper way is to make additional terms adaptable, or at least print an error message ("Subwindow is too small!") when the user makes it too small...
I think I'll take a short break. Of course, when I say "I'll take a break" I usually don't take any breaksBut I'll try anyway and in the meantime will think what to do with small terms...
Leave a comment:
-
This thing I'm especially proud of:
That was already a feature of old SDL2 frontend, but I had to do it "by hand". Now do_cmd_view_map() is smarter and asks the frontend for desirable map size (full map, in this case). And it still knows how to scale the map Angband-style, if necessary.Last edited by t4nk; August 22, 2016, 18:20.Leave a comment:
-
I did the seconds pass over ui2-* files. At this point all the major systems of ui work (except for debugging stuff), and the game is playable.
There are certainly many bugs left, the frontend is not fully operational yet (no tiles, no additional subwindows) and the ui could use some optimizations (perhaps even diff-based optimizations, a la ui-term.c), but I think it's a major milestone. All in all, I was surprised by how well it went. I expected it to take a lot longer.Leave a comment:
-
I did the seconds pass over ui2-* files. At this point all the major systems of ui work (except for debugging stuff), and the game is playable.
There are certainly many bugs left, the frontend is not fully operational yet (no tiles, no additional subwindows) and the ui could use some optimizations (perhaps even diff-based optimizations, a la ui-term.c), but I think it's a major milestone. All in all, I was surprised by how well it went. I expected it to take a lot longer.Leave a comment:
-
Under the new term stack model, I could see a case being made for each new term window being given a titlebar with the promptI did consider that (when thinking about tile picker). A term could perhaps have a header and a footer (similar to how menus have them). Those could be text, while the middle of the term could be tiles, or text with different font... it's a bit annoying to do, but not too much, so maybe
As it is, various menus and textblocks do tend to gravitate towards the prompt area:
(BTW! What's the deal with using double spaces between sentences in various descriptions? Another old school thing, I guess...)Leave a comment:
Leave a comment: