Skip to content

Commit 8b4e99f

Browse files
committed
Bubble positioning parameter on ui.json
1 parent 4c41666 commit 8b4e99f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

blade-engine/src/com/bladecoder/engine/ui/TextManagerUI.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ public void draw(Batch batch, float alpha) {
191191
if (style.talkBubble != null) {
192192
float scale = DPIUtils.getTouchMinSize() * style.bubbleSize / 4 / style.talkBubble.getMinHeight();
193193

194-
float bubbleX = unprojectTmp.x - style.talkBubble.getMinWidth() * scale / 2;
194+
float bubbleX = unprojectTmp.x - style.talkBubble.getMinWidth() * scale / 2 + style.bubbledx;
195195
// check screen exit
196196
bubbleX = Math.max(bubbleX, getX() + PADDING - style.talkBubble.getMinWidth() * scale / 2);
197197
bubbleX = Math.min(bubbleX, getX() + getWidth() - PADDING - style.talkBubble.getMinWidth() * scale / 2);
198-
float bubbleY = getY() - style.talkBubble.getMinHeight() * scale + 2;
198+
float bubbleY = getY() - style.talkBubble.getMinHeight() * scale + style.bubbledy;
199199

200200
style.talkBubble.draw(batch, bubbleX, bubbleY, style.talkBubble.getMinWidth() * scale,
201201
style.talkBubble.getMinHeight() * scale);
@@ -253,6 +253,8 @@ static public class TextManagerUIStyle {
253253
public Color defaultColor;
254254
public float subtitlePosPercent = 0.90f;
255255
public float bubbleSize = 1f;
256+
public float bubbledx = 0;
257+
public float bubbledy = 0;
256258
public int maxCharWidth = 80;
257259
public int maxTalkCharWidth = 35;
258260

@@ -267,6 +269,8 @@ public TextManagerUIStyle(TextManagerUIStyle style) {
267269
defaultColor = style.defaultColor;
268270
subtitlePosPercent = style.subtitlePosPercent;
269271
bubbleSize = style.bubbleSize;
272+
bubbledx = style.bubbledx;
273+
bubbledy = style.bubbledy;
270274
maxCharWidth = style.maxCharWidth;
271275
maxTalkCharWidth = style.maxTalkCharWidth;
272276
}

0 commit comments

Comments
 (0)