feat(title): fons title_bg.gif i outline 4-dir off-white als textos taronges
This commit is contained in:
1 parent
e7a024bcdb
commit
9233bd8d75
4 files changed
+35
-11
No files matched your search
@@ -48,9 +48,10 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
TitleScene::TitleScene(std::shared_ptr<Text> display_font, std::shared_ptr<Text> condensed_font, std::shared_ptr<Surface> mini_logo, SceneFactory next_factory)
|
||||
TitleScene::TitleScene(std::shared_ptr<Text> display_font, std::shared_ptr<Text> condensed_font, std::shared_ptr<Surface> background, std::shared_ptr<Surface> mini_logo, SceneFactory next_factory)
|
||||
: display_font_(std::move(display_font)),
|
||||
condensed_font_(std::move(condensed_font)),
|
||||
background_(std::move(background)),
|
||||
mini_logo_(std::move(mini_logo)),
|
||||
next_factory_(std::move(next_factory)),
|
||||
timer_ms_(UiConfig::get().titleDurationMs()) {
|
||||
@@ -85,24 +86,38 @@ void TitleScene::render() {
|
||||
const auto& ui_config = UiConfig::get();
|
||||
const auto& palette = Resource::Cache::get().getPalette("ui");
|
||||
|
||||
Screen::get().fillRect(0, 0, GameCanvas::WIDTH, GameCanvas::HEIGHT, palette[ui_config.titleBgColor()]);
|
||||
// Fons: la imatge si està disponible (cobreix tot el canvas amb la
|
||||
// seua paleta nadiua); en cas contrari, color pla de la paleta UI
|
||||
// com a fallback defensiu.
|
||||
if (background_) {
|
||||
background_->render(0, 0);
|
||||
} else {
|
||||
Screen::get().fillRect(0, 0, GameCanvas::WIDTH, GameCanvas::HEIGHT, palette[ui_config.titleBgColor()]);
|
||||
}
|
||||
|
||||
const Uint8 TEXT_COLOR = ui_config.titleTextColor();
|
||||
const Uint8 OUTLINE_COLOR = ui_config.titleCopyrightColor();
|
||||
constexpr Uint8 OUTLINE_DIST = 1;
|
||||
constexpr Uint8 STROKE4 = Text::CENTER_FLAG | Text::COLOR_FLAG | Text::STROKE4_FLAG;
|
||||
|
||||
if (display_font_) {
|
||||
const int TITLE_Y = (GameCanvas::HEIGHT * TITLE_Y_PERCENT) / 100;
|
||||
display_font_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG,
|
||||
display_font_->writeDX(STROKE4,
|
||||
GameCanvas::CENTER_X,
|
||||
TITLE_Y,
|
||||
TITLE_LINE_1,
|
||||
display_font_->getDefaultKerning(),
|
||||
TEXT_COLOR);
|
||||
display_font_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG,
|
||||
TEXT_COLOR,
|
||||
OUTLINE_DIST,
|
||||
OUTLINE_COLOR);
|
||||
display_font_->writeDX(STROKE4,
|
||||
GameCanvas::CENTER_X,
|
||||
TITLE_Y + titleLineGap(*display_font_),
|
||||
TITLE_LINE_2,
|
||||
display_font_->getDefaultKerning(),
|
||||
TEXT_COLOR);
|
||||
TEXT_COLOR,
|
||||
OUTLINE_DIST,
|
||||
OUTLINE_COLOR);
|
||||
}
|
||||
|
||||
if (condensed_font_) {
|
||||
@@ -115,12 +130,14 @@ void TitleScene::render() {
|
||||
|
||||
if (VISIBLE) {
|
||||
const int PROMPT_Y = (GameCanvas::HEIGHT * PROMPT_Y_PERCENT) / 100;
|
||||
condensed_font_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG,
|
||||
condensed_font_->writeDX(STROKE4,
|
||||
GameCanvas::CENTER_X,
|
||||
PROMPT_Y,
|
||||
Locale::get().text("title.press_start"),
|
||||
condensed_font_->getDefaultKerning() - 1,
|
||||
TEXT_COLOR);
|
||||
TEXT_COLOR,
|
||||
OUTLINE_DIST,
|
||||
OUTLINE_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class TitleScene : public Scene {
|
||||
public:
|
||||
using SceneFactory = std::function<std::unique_ptr<Scene>()>;
|
||||
|
||||
TitleScene(std::shared_ptr<Text> display_font, std::shared_ptr<Text> condensed_font, std::shared_ptr<Surface> mini_logo, SceneFactory next_factory);
|
||||
TitleScene(std::shared_ptr<Text> display_font, std::shared_ptr<Text> condensed_font, std::shared_ptr<Surface> background, std::shared_ptr<Surface> mini_logo, SceneFactory next_factory);
|
||||
~TitleScene() override;
|
||||
|
||||
void update(int delta_ms) override;
|
||||
@@ -25,6 +25,7 @@ class TitleScene : public Scene {
|
||||
private:
|
||||
std::shared_ptr<Text> display_font_;
|
||||
std::shared_ptr<Text> condensed_font_;
|
||||
std::shared_ptr<Surface> background_;
|
||||
std::shared_ptr<Surface> mini_logo_;
|
||||
SceneFactory next_factory_;
|
||||
int timer_ms_;
|
||||
|
||||
Reference in new issue
Block a user