From fba74adb742db07c364d445fc225a916e3224520 Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Sat, 4 Jul 2020 01:18:08 -0700 Subject: [PATCH] Added i18n factory method to create instances with resolved string id --- core/src/com/riiablo/widget/LabelButton.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/com/riiablo/widget/LabelButton.java b/core/src/com/riiablo/widget/LabelButton.java index 764003f2..a319d120 100644 --- a/core/src/com/riiablo/widget/LabelButton.java +++ b/core/src/com/riiablo/widget/LabelButton.java @@ -3,6 +3,7 @@ package com.riiablo.widget; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; + import com.riiablo.Riiablo; import com.riiablo.graphics.PaletteIndexedBatch; @@ -24,11 +25,24 @@ public class LabelButton extends Label { init(); } + public LabelButton(String text, BitmapFont font, Color color) { + super(text, font, color); + init(); + } + public LabelButton(BitmapFont font) { super(font); init(); } + public static LabelButton i18n(String id, BitmapFont font) { + return new LabelButton(Riiablo.string.lookup(id), font); + } + + public static LabelButton i18n(String id, BitmapFont font, Color color) { + return new LabelButton(Riiablo.string.lookup(id), font, color); + } + private void init() { addListener(clickListener = new ClickListener()); }