Skip to content

Commit 596e0be

Browse files
committed
updated to libgdx 1.5.6
1 parent b332db9 commit 596e0be

File tree

20 files changed

+152
-341
lines changed

20 files changed

+152
-341
lines changed

adventure-composer/src/main/java/com/bladecoder/engineeditor/Editor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
3131
import com.badlogic.gdx.scenes.scene2d.ui.SplitPane;
3232
import com.badlogic.gdx.scenes.scene2d.ui.Table;
33-
import com.badlogic.gdx.scenes.scene2d.utils.Align;
33+
import com.badlogic.gdx.utils.Align;
3434
import com.badlogic.gdx.utils.Scaling;
3535
import com.badlogic.gdx.utils.viewport.ScreenViewport;
3636
import com.bladecoder.engineeditor.model.Project;
@@ -71,7 +71,7 @@ public void create() {
7171
Ctx.assetManager = new EditorAssetManager();
7272

7373
scnEditor = new ScnEditor(skin);
74-
skin.getFont("default-font").setMarkupEnabled(true);
74+
skin.getFont("default-font").getData().markupEnabled = true;
7575

7676
/*** STAGE SETUP ***/
7777
stage = new Stage(new ScreenViewport());

adventure-composer/src/main/java/com/bladecoder/engineeditor/scneditor/ScnWidget.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.badlogic.gdx.graphics.Color;
2828
import com.badlogic.gdx.graphics.g2d.Batch;
2929
import com.badlogic.gdx.graphics.g2d.BitmapFont;
30-
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
30+
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
3131
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
3232
import com.badlogic.gdx.math.Polygon;
3333
import com.badlogic.gdx.math.Rectangle;
@@ -89,6 +89,8 @@ public class ScnWidget extends Widget {
8989

9090
private boolean showWalkZone;
9191

92+
private final GlyphLayout textLayout = new GlyphLayout();
93+
9294
/**
9395
* The NOTIFY_PROJECT_LOADED listener is called from other thread.
9496
* This flag is to recreate the scene in the OpenGL thread.
@@ -328,12 +330,13 @@ public void draw(Batch batch, float parentAlpha) {
328330
screenToWorldCoords(coords);
329331
String str = MessageFormat.format("({0}, {1})", (int) coords.x,
330332
(int) coords.y);
331-
332-
TextBounds bounds2 = defaultFont.getBounds(str);
333+
334+
textLayout.setText(defaultFont, str);
335+
333336
RectangleRenderer.draw((SpriteBatch) batch, 0f, getY()
334-
+ getHeight() - bounds2.height - 15, bounds2.width + 10,
335-
bounds2.height + 10, BLACK_TRANSPARENT);
336-
defaultFont.draw(batch, str, 5, getHeight() + getY() - 10);
337+
+ getHeight() - textLayout.height - 15, textLayout.width + 10,
338+
textLayout.height + 10, BLACK_TRANSPARENT);
339+
defaultFont.draw(batch, textLayout, 5, getHeight() + getY() - 10);
337340

338341
batch.setColor(tmp);
339342

@@ -371,9 +374,11 @@ public void draw(Batch batch, float parentAlpha) {
371374
} else {
372375
s = "THERE ARE NO SCENES IN THIS CHAPTER YET";
373376
}
377+
378+
textLayout.setText(bigFont, s);
374379

375-
bigFont.draw(batch, s,
376-
(getWidth() - bigFont.getBounds(s).width) / 2, getHeight()
380+
bigFont.draw(batch, textLayout,
381+
(getWidth() - textLayout.width) / 2, getHeight()
377382
/ 2 + bigFont.getLineHeight() * 3);
378383

379384
}
@@ -393,31 +398,33 @@ private void drawFakeDepthMarkers(SpriteBatch batch) {
393398
worldToScreenCoords(tmp2V2);
394399

395400
String s = "100%";
396-
TextBounds tb = defaultFont.getBounds(s);
397401

398-
float posx = tmp2V2.x - tb.width - 20;
402+
textLayout.setText(defaultFont, s);
403+
404+
float posx = tmp2V2.x - textLayout.width - 20;
399405

400406
RectangleRenderer.draw((SpriteBatch) batch, posx, tmp2V2.y,
401-
tb.width + margin * 2, tb.height + margin * 2, Color.BLACK);
407+
textLayout.width + margin * 2, textLayout.height + margin * 2, Color.BLACK);
402408
RectangleRenderer.draw((SpriteBatch) batch, tmp2V2.x-20, tmp2V2.y,
403409
20 , 2, Color.BLACK);
404410

405-
defaultFont.draw(batch, s, posx + margin, tmp2V2.y + tb.height + margin);
411+
defaultFont.draw(batch, textLayout, posx + margin, tmp2V2.y + textLayout.height + margin);
406412

407413
tmp2V2.x = 0;
408414
tmp2V2.y = d.x ;
409415
worldToScreenCoords(tmp2V2);
410416
s="0%";
411-
tb = defaultFont.getBounds(s);
412417

413-
posx = tmp2V2.x - tb.width - 20;
418+
textLayout.setText(defaultFont, s);
419+
420+
posx = tmp2V2.x - textLayout.width - 20;
414421

415422
RectangleRenderer.draw((SpriteBatch) batch, posx, tmp2V2.y,
416-
tb.width + margin * 2, tb.height + margin * 2, Color.BLACK);
423+
textLayout.width + margin * 2, textLayout.height + margin * 2, Color.BLACK);
417424
RectangleRenderer.draw((SpriteBatch) batch, tmp2V2.x-20, tmp2V2.y,
418425
20 , 2, Color.BLACK);
419426

420-
defaultFont.draw(batch, s, posx + margin, tmp2V2.y + tb.height + margin);
427+
defaultFont.draw(batch, textLayout, posx + margin, tmp2V2.y + textLayout.height + margin);
421428

422429
}
423430

adventure-composer/src/main/java/com/bladecoder/engineeditor/ui/components/CustomList.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import com.badlogic.gdx.graphics.Color;
1919
import com.badlogic.gdx.graphics.g2d.Batch;
2020
import com.badlogic.gdx.graphics.g2d.BitmapFont;
21+
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
2122
import com.badlogic.gdx.graphics.g2d.TextureRegion;
22-
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
2323
import com.badlogic.gdx.math.Rectangle;
2424
import com.badlogic.gdx.scenes.scene2d.InputEvent;
2525
import com.badlogic.gdx.scenes.scene2d.InputListener;
@@ -123,15 +123,22 @@ public void layout() {
123123
final Drawable selectedDrawable = style.selection;
124124

125125
cellRenderer.layout(style);
126+
127+
128+
GlyphLayout textLayout = new GlyphLayout();
126129

127130
prefWidth = 0;
128131
for (int i = 0; i < items.size; i++) {
129-
TextBounds bounds = font.getBounds(cellRenderer.getCellTitle(items.get(i)));
130-
prefWidth = Math.max(bounds.width, prefWidth);
132+
133+
textLayout.setText(font, cellRenderer.getCellTitle(items.get(i)));
134+
135+
prefWidth = Math.max(textLayout.width, prefWidth);
131136

132137
if(cellRenderer.hasSubtitle()) {
133-
bounds = font.getBounds(cellRenderer.getCellSubTitle(items.get(i)));
134-
prefWidth = Math.max(bounds.width, prefWidth);
138+
139+
textLayout.setText(font, cellRenderer.getCellSubTitle(items.get(i)));
140+
141+
prefWidth = Math.max(textLayout.width, prefWidth);
135142
}
136143

137144
if(cellRenderer.hasImage()) {

adventure-composer/src/main/java/com/bladecoder/engineeditor/ui/components/EditDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void setInfoWidget(Actor c) {
108108
}
109109

110110
public void setTitle(String title) {
111-
super.setTitle(title);
111+
getTitleLabel().setText(title);
112112
}
113113

114114
public boolean isCancel() {

adventure-composer/src/main/java/com/bladecoder/engineeditor/ui/components/EditTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public EditTree(Skin skin) {
5252
ScrollPane scrollPane = new ScrollPane(tree, skin);
5353
container = new Container<ScrollPane>(scrollPane);
5454
container.fill();
55-
container.prefHeight(100);
55+
container.prefHeight(1000);
5656

5757
toolbar = new EditToolbar(skin);
5858
// debug();

adventure-composer/src/main/java/com/bladecoder/engineeditor/ui/components/ElementList.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public int compare(Element o1, Element o2) {
9595
}
9696

9797
toolbar.disableCreate(parent == null);
98+
// container.prefHeight(list.getItemHeight() * (list.getItems().size > 3?list.getItems().size:3));
9899
list.invalidateHierarchy();
99100
}
100101

adventure-composer/src/main/java/com/bladecoder/engineeditor/ui/components/HeaderPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
import com.badlogic.gdx.scenes.scene2d.ui.Label;
2424
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
2525
import com.badlogic.gdx.scenes.scene2d.ui.Table;
26-
import com.badlogic.gdx.scenes.scene2d.utils.Align;
2726
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
2827
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
28+
import com.badlogic.gdx.utils.Align;
2929
import com.badlogic.gdx.utils.Scaling;
3030
import com.bladecoder.engineeditor.Ctx;
3131

adventure-composer/src/main/java/com/bladecoder/engineeditor/utils/Message.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.fadeOut;
1919
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.sequence;
2020

21-
import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
21+
import com.badlogic.gdx.graphics.Color;
22+
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
2223
import com.badlogic.gdx.math.Interpolation;
2324
import com.badlogic.gdx.scenes.scene2d.Actor;
2425
import com.badlogic.gdx.scenes.scene2d.Stage;
2526
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
2627
import com.badlogic.gdx.scenes.scene2d.ui.Label;
2728
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
28-
import com.badlogic.gdx.scenes.scene2d.utils.Align;
29+
import com.badlogic.gdx.utils.Align;
2930

3031
public class Message extends Label {
3132
static public float fadeDuration = 0.4f;
@@ -63,9 +64,11 @@ private void add(Stage stage, String text) {
6364

6465
setText(text);
6566

66-
TextBounds bounds2 = getStyle().font.getWrappedBounds(text, stage.getWidth() * .8f);
67+
GlyphLayout textLayout = new GlyphLayout();
6768

68-
setSize(bounds2.width + bounds2.height, bounds2.height + bounds2.height * 2);
69+
textLayout.setText(getStyle().font, text, Color.BLACK, stage.getWidth() * .8f, Align.center, true);
70+
71+
setSize(textLayout.width + textLayout.height, textLayout.height + textLayout.height * 2);
6972

7073
stage.addActor(this);
7174
setPosition(Math.round((stage.getWidth() - getWidth()) / 2), Math.round((stage.getHeight() - getHeight()) / 2));

adventure-composer/src/main/resources/versions.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version=0.7.2
2-
libgdxVersion=1.5.5
2+
libgdxVersion=1.5.6
33
roboVMVersion=1.0.0
44
roboVMGradlePluginVersion=1.0.0
55
buildToolsVersion=20.0.0

blade-engine/src/com/bladecoder/engine/shading/CelShader.java

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)