Put the whole look into one project theme
themes/main_theme.tres is the project theme. It holds Godot's default look for every control type the game uses, plus named styles for the game's own look (popups, the background, spacers, list rows, title and text sizes, highlights) and a palette for the popup dimming. Scenes and scripts name these styles instead of setting colours, sizes or style boxes, and the five old theme files are gone. themes/README.md explains the styles and how to make a new theme. The screenshot tour now uses the real character pictures, so the layout baseline is taken again. Screenshots are pixel-identical to before, and test_theme.gd checks that the look stays in the theme.
This commit was merged in pull request #36.
This commit is contained in:
1 parent
a7bf38c5f9
commit
8b71723a34
39 files changed
+3283
-1869
No files matched your search
@@ -6,22 +6,29 @@ func _background(list_row: ListRow) -> Color:
|
||||
return (list_row.get_theme_stylebox("panel") as StyleBoxFlat).bg_color
|
||||
|
||||
|
||||
## Adds [param list_row] to the tree, where it gets its look from the project theme.
|
||||
func _shown(list_row: ListRow) -> ListRow:
|
||||
add_child(auto_free(list_row))
|
||||
return list_row
|
||||
|
||||
|
||||
func test_row_shows_text() -> void:
|
||||
var list_row: ListRow = auto_free(ListRow.create("Chrono Trigger", 0, 20))
|
||||
var list_row: ListRow = auto_free(ListRow.create("Chrono Trigger", 0, &"TextLarge"))
|
||||
|
||||
assert_str(list_row.text).is_equal("Chrono Trigger")
|
||||
|
||||
|
||||
func test_neighbouring_rows_have_different_backgrounds() -> void:
|
||||
var first: ListRow = auto_free(ListRow.create("Chrono Trigger", 0, 20))
|
||||
var second: ListRow = auto_free(ListRow.create("Chrono Cross", 1, 20))
|
||||
var third: ListRow = auto_free(ListRow.create("Xenogears", 2, 20))
|
||||
var first: ListRow = _shown(ListRow.create("Chrono Trigger", 0, &"TextLarge"))
|
||||
var second: ListRow = _shown(ListRow.create("Chrono Cross", 1, &"TextLarge"))
|
||||
var third: ListRow = _shown(ListRow.create("Xenogears", 2, &"TextLarge"))
|
||||
|
||||
assert_that(_background(first)).is_not_equal(_background(second))
|
||||
assert_that(_background(first)).is_equal(_background(third))
|
||||
|
||||
|
||||
func test_long_text_wraps() -> void:
|
||||
var list_row: ListRow = auto_free(ListRow.create("Castlevania: Symphony of the Night", 0, 20))
|
||||
var list_row: ListRow = auto_free(
|
||||
ListRow.create("Castlevania: Symphony of the Night", 0, &"TextLarge"))
|
||||
|
||||
assert_int(list_row.label.autowrap_mode).is_equal(TextServer.AUTOWRAP_WORD_SMART)
|
||||
Reference in new issue
Block a user