Okay, now to talk about the next big change to Ren'Py, which I want to hash out in public before implementing it in the code. This will probably be the highlight of the next release, and I think important as we move forward. What I plan to do is to:
- Modify the style hierarchy.
- Define what themes and layouts are.
- Implement backwards compatible themes and layouts.
- Create at least 1 new theme.
- Create at least 1 new layout.
Let me first begin by reaffirming my commitment to backwards compatibility. If a game has config.script_versions set to (6, 5, 0) or less, a backwards compatibility mode will kick in that makes Ren'Py 100% identical with today's version. I will also include a way of enabling this backwards compatibility mode, so that people with games in development will not have to re-theme their games.
Note, however, that new features may not be supported in the backwards compatibility mode.
The style hierarchy is the list of which style inherits from which. While not terribly broken right now, there are a few changes I'd like to make. A big one is that I'd like to be sure that all labels inherit from a base label class. I'd also like to make this like button, where you have
kind_label and
kind_label_text.
The reason for this is that I'd like labels to be a special type of window, with text contained inside the window. Making labels a type of window (but note, not inheriting from the window or frame styles) will give us a lot more control over label styles. We can easily add margins to each label, or add background/foreground images.
I'd also like the style hierarchy to have a few well-defined roots that everything inherits from. Right now, I'm looking at:
style.frame - Frames (out-of-game windows containing buttons/etc of the other styles).
style.button/style.button_text - Average buttons, generally used for navigation or other activities requiring buttons.
style.small_button/style.small_button_text - A smaller-than-average button, also used for navigation. While style.button may have a minimum width, this should be made as small as possible.
style.radio_button/style.radio_button_text - These should be used for groups of related buttons that do not cause navigation to occur. For example, groups of preferences should be radio_buttons.
style.check_button/style.check_button_text - This should be used for a single button that may be selected or not. (For example, and alternate view of preferences.)
style.large_button - The style of a large button that may contain arbitrary information (such as a file picker entry.
style.label/style.label_text - These are labels indicating where the user is.
style.bar/style.vbar - These are bars/sliders that indicate values and optionally allow the user to change their value. (horizontal and vertical)
style.scrollbar/style.vscrollbar - These are bars/sliders that allow the user to scroll around. (horizontal and vertical)
style.prompt/style.prompt_text - The style of text that prompts the user to do something. This is treated as a big label, but doesn't inherit from label because we may want to render it differently.
style.text - The style of other text displayed by the interface. (This might be used inside the style inspector, for example.)
A quick count of this shows that this makes up 18 styles, with about half of them being the different variants of button and button_text. (In the current roundrect design, many of these variants are identical, or at least are trivial variations of one another.)
So the question is now: what is a theme, and what is a layout? Right now, the two are fairly conflated, which makes answering that question hard. In 6.6, we'll be breaking them apart.
A theme is responsible for controlling the look of the various displayables. It does this by setting appropriate values for those 18 styles given above. Themes should generally leave styles other than these 18 alone. Themes are responsible for setting the minimum size of the various styled displayables, and the look, and that's about it.
Layouts control how these styled displayables are placed into the main and game menus. Layout functions are responsible for the organization of the various screens, as well as the maximum size and spacing of displayables.
There will probably be several kinds of layout functions, classified by what they do. For example, a main_menu layout function will be responsible for supplying a main menu. A navigation layout function will be responsible for supplying the game menu navigation box. A load_save layout function supplies the load save screen, a preferences function supplies the preferences screen and so on.
You'll be able to mix and match the various functions to customize how your menus look. Some variants I'm considering are a load/save screen with a big preview image, and check-button based preferences. To implement this, one might write:
Code:
init -1 python:
config.screen_width = 800
config.screen_height = 600
layout.classic_main_menu()
layout.classic_navigation()
layout.big_preview_loadsave()
layout.checkbox_preferences()
theme.roundrect()
The layout calls needs to be placed before the theme call. If one of the kinds of layout functions is not called, the classic variant will be called when the theme is specified. So the above code could be written as:
Code:
init -1 python:
config.screen_width = 800
config.screen_height = 600
layout.big_preview_loadsave()
layout.checkbox_preferences()
theme.roundrect()
If we wanted to simply use the classic layouts everywhere, you could just write:
Code:
init -1 python:
config.screen_width = 800
config.screen_height = 600
theme.roundrect()
which is exactly what we have today.
Of course, people will be able to contribute their own themes and layout functions, provided they conform to certain standards. And (depending on the layouts used) you will still be able to style the displayables.
Anyway, I'm curious what people think of these plans.
_________________
Another Old-Fashioned Bishoujo Gamer
Supporting creators since 2004; Code > Drama
(When was the last time you backed up your game?)
"It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face in marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming" - Theodore Roosevelt