Skip to content

Commit 4a19517

Browse files
committed
update versions + new sonatype central
1 parent c0247ae commit 4a19517

7 files changed

Lines changed: 191 additions & 125 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
androidAPILevel=35
2-
androidGradlePluginVersion=8.6.1
3-
bladeInkVersion=1.2.0
4-
libgdxVersion=1.13.1-SNAPSHOT
5-
roboVMVersion=2.3.21
2+
androidGradlePluginVersion=8.11.1
3+
bladeInkVersion=1.2.1
4+
libgdxVersion=1.13.6-SNAPSHOT
5+
roboVMVersion=2.3.23
66
version=4.4.0-SNAPSHOT

blade-engine/src/com/bladecoder/engine/ink/InkManager.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,27 @@ public void newStory(final String name) throws Exception {
8484
loadThreaded(name, null);
8585
}
8686

87+
public void newStory(final String storyName, final String json) throws Exception {
88+
try {
89+
long initTime = System.currentTimeMillis();
90+
91+
story = new Story(json);
92+
93+
ExternalFunctions.bindExternalFunctions(w, story);
94+
95+
this.storyName = storyName;
96+
97+
loadI18NBundle();
98+
99+
EngineLogger.debug("INK STORY LOADING TIME (ms): " + (System.currentTimeMillis() - initTime));
100+
101+
} catch (Exception e) {
102+
EngineLogger.error("Cannot load Ink Story: " + storyName + " " + e.getMessage());
103+
story = null;
104+
this.storyName = null;
105+
}
106+
}
107+
87108
private void loadStory(String name) {
88109
try {
89110
FileHandle asset = EngineAssetManager.getInstance()

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

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@
2323
import com.badlogic.gdx.scenes.scene2d.InputEvent;
2424
import com.badlogic.gdx.scenes.scene2d.InputListener;
2525
import com.badlogic.gdx.scenes.scene2d.Stage;
26-
import com.badlogic.gdx.scenes.scene2d.ui.Button;
27-
import com.badlogic.gdx.scenes.scene2d.ui.Container;
28-
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
29-
import com.badlogic.gdx.scenes.scene2d.ui.Label;
30-
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
31-
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
32-
import com.badlogic.gdx.scenes.scene2d.ui.Table;
33-
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
34-
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
26+
import com.badlogic.gdx.scenes.scene2d.ui.*;
3527
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
3628
import com.badlogic.gdx.utils.Align;
3729
import com.badlogic.gdx.utils.viewport.ScreenViewport;
@@ -129,7 +121,7 @@ public void clicked(InputEvent event, float x, float y) {
129121
}
130122
});
131123

132-
Label title = new Label("DEBUG SCREEN", ui.getSkin(), "title");
124+
Label title = new Label("DEBUG", ui.getSkin(), "title");
133125

134126
Table header = new Table();
135127
header.padBottom(margin);
@@ -415,6 +407,57 @@ public void clicked(InputEvent event, float x, float y) {
415407
table.add();
416408
table.add(botGroup2);
417409

410+
// ------------- LOAD INK STORY FROM STRING
411+
TextArea externalInkString = new TextArea("", ui.getSkin());
412+
externalInkString.setPrefRows(2);
413+
TextButton externalInkStringButton = new TextButton("Load",ui.getSkin());
414+
externalInkStringButton.addListener(new ClickListener() {
415+
@Override
416+
public void clicked(InputEvent event, float x, float y) {
417+
try {
418+
ui.getWorld().getInkManager().newStory("test-story", externalInkString.getText());
419+
ui.setCurrentScreen(Screens.SCENE_SCREEN);
420+
} catch (Exception e) {
421+
EngineLogger.error("Error loading story: " + e.getMessage());
422+
}
423+
}
424+
});
425+
426+
externalInkStringButton.pad(2, 3, 2, 3);
427+
428+
table.row().pad(5).align(Align.left);
429+
table.add(new Label("External Story", ui.getSkin(), "debug"));
430+
table.add(externalInkString).expandX().fillX();
431+
table.add(externalInkStringButton);
432+
433+
// ------------- GO TO KNOT
434+
TextField knot = new TextField("", ui.getSkin());
435+
TextField flow = new TextField("", ui.getSkin());
436+
TextButton knotButton = new TextButton("Go", ui.getSkin());
437+
knotButton.addListener(new ClickListener() {
438+
@Override
439+
public void clicked(InputEvent event, float x, float y) {
440+
try {
441+
String flowName = flow.getText().isEmpty() ? null : flow.getText();
442+
443+
ui.getWorld().getInkManager().runPath(knot.getText(), null, flowName, null);
444+
ui.setCurrentScreen(Screens.SCENE_SCREEN);
445+
} catch (Exception e) {
446+
EngineLogger.error("Error going to knot/stich: " + e.getMessage());
447+
}
448+
}
449+
});
450+
451+
knotButton.pad(2, 3, 2, 3);
452+
453+
table.row().pad(5).align(Align.left);
454+
table.add(new Label("Go to knot/stich", ui.getSkin(), "debug"));
455+
table.add(knot).expandX().fillX();
456+
table.add(new Label("Flow", ui.getSkin(), "debug"));
457+
table.add(flow).expandX().fillX();
458+
table.add(knotButton);
459+
460+
418461
// ------------- VERSION LABEL NOT IN TABLE
419462
String versionString = Config.getInstance().getProperty(Config.TITLE_PROP, "title unspecified") + " v"
420463
+ Config.getInstance().getProperty(Config.VERSION_PROP, "unspecified") + "\n" + "Blade Engine: v"
Lines changed: 106 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,95 @@
11
package com.bladecoder.engine.util;
22

3+
import com.badlogic.gdx.Application;
34
import com.badlogic.gdx.Gdx;
45

56
public class DPIUtils {
6-
public final static float BASE_DPI = 160.0f;
7-
8-
/**
9-
* Current DPI
10-
*/
11-
public final static float DPI = BASE_DPI * getLogicalDensity();
12-
13-
/**
14-
* The Google recommendations are 48 dp -> 9mm for touchable elements
15-
*/
16-
public final static float TOUCH_MIN_SIZE = 48 * getLogicalDensity();
17-
18-
/**
19-
* The Google recommendations of space between UI objects is 8 dp
20-
*/
21-
public final static float UI_SPACE = 8 * getLogicalDensity();
22-
23-
/**
24-
* The Google recommendations of space from bottom or top is 16 dp
25-
*/
26-
public final static float MARGIN_SIZE = 16 * getLogicalDensity();
27-
28-
/**
29-
* The Google recommendations are 56 dp for action buttons
30-
*/
31-
public final static float BUTTON_SIZE = 56 * getLogicalDensity();
32-
33-
/**
34-
* The Google recommendations are 24 dp for icons inside action buttons
35-
*/
36-
public final static float ICON_SIZE = 24 * getLogicalDensity();
37-
38-
/**
39-
* The Google recommendations are 8 dp for space between ui elements
40-
*/
41-
public final static float SPACING = 8 * getLogicalDensity();
42-
43-
/**
44-
* The screen height in DP
45-
*/
46-
public final static float SCREEN_HEIGHT_DP = Gdx.graphics.getHeight() / getLogicalDensity();
47-
48-
public final static float NORMAL_MULTIPLIER = 1.0f; // 3-5"
49-
public final static float LARGE_MULTIPLIER = 1.5f; // 5-7"
50-
public final static float XLARGE_MULTIPLIER = 2f; // 8-10"
51-
public final static float XXLARGE_MULTIPLIER = 2.5f; // > 10"
52-
53-
public static final float getLogicalDensity() {
54-
return Gdx.graphics.getDensity() / Gdx.graphics.getBackBufferScale();
55-
}
56-
57-
/**
58-
* Calcs the button size based in screen size
59-
*
60-
* @return The recommended size in pixels
61-
*/
62-
public static float getPrefButtonSize() {
63-
return getSizeMultiplier() * BUTTON_SIZE;
64-
}
65-
66-
/**
67-
* Calcs the minimum size based in screen size
68-
*
69-
* @return The recommended size in pixels
70-
*/
71-
public static float getTouchMinSize() {
72-
return getSizeMultiplier() * TOUCH_MIN_SIZE;
73-
}
74-
75-
/**
76-
* Calcs the margin size based in screen size
77-
*
78-
* @return The recommended size in pixels
79-
*/
80-
public static float getMarginSize() {
81-
return getSizeMultiplier() * MARGIN_SIZE;
82-
}
83-
84-
/**
85-
* Calcs the space between ui elements based in screen size
86-
*
87-
* @return The recommended size in pixels
88-
*/
89-
public static float getSpacing() {
90-
return getSizeMultiplier() * SPACING;
91-
}
7+
public final static float BASE_DPI = 160.0f;
8+
9+
/**
10+
* Current DPI
11+
*/
12+
public final static float DPI = BASE_DPI * getLogicalDensity();
13+
14+
/**
15+
* The Google recommendations are 48 dp -> 9mm for touchable elements
16+
*/
17+
public final static float TOUCH_MIN_SIZE = 48 * getLogicalDensity();
18+
19+
/**
20+
* The Google recommendations of space between UI objects is 8 dp
21+
*/
22+
public final static float UI_SPACE = 8 * getLogicalDensity();
23+
24+
/**
25+
* The Google recommendations of space from bottom or top is 16 dp
26+
*/
27+
public final static float MARGIN_SIZE = 16 * getLogicalDensity();
28+
29+
/**
30+
* The Google recommendations are 56 dp for action buttons
31+
*/
32+
public final static float BUTTON_SIZE = 56 * getLogicalDensity();
33+
34+
/**
35+
* The Google recommendations are 24 dp for icons inside action buttons
36+
*/
37+
public final static float ICON_SIZE = 24 * getLogicalDensity();
38+
39+
/**
40+
* The Google recommendations are 8 dp for space between ui elements
41+
*/
42+
public final static float SPACING = 8 * getLogicalDensity();
43+
44+
/**
45+
* The screen height in DP
46+
*/
47+
public final static float SCREEN_HEIGHT_DP = Gdx.graphics.getHeight() / getLogicalDensity();
48+
49+
public final static float NORMAL_MULTIPLIER = 1.0f; // 3-5"
50+
public final static float LARGE_MULTIPLIER = 1.5f; // 5-7"
51+
public final static float XLARGE_MULTIPLIER = 2f; // 8-10"
52+
public final static float XXLARGE_MULTIPLIER = 2.5f; // > 10"
53+
54+
public static final float getLogicalDensity() {
55+
return Gdx.graphics.getDensity() / Gdx.graphics.getBackBufferScale();
56+
}
57+
58+
/**
59+
* Calcs the button size based in screen size
60+
*
61+
* @return The recommended size in pixels
62+
*/
63+
public static float getPrefButtonSize() {
64+
return getSizeMultiplier() * BUTTON_SIZE;
65+
}
66+
67+
/**
68+
* Calcs the minimum size based in screen size
69+
*
70+
* @return The recommended size in pixels
71+
*/
72+
public static float getTouchMinSize() {
73+
return getSizeMultiplier() * TOUCH_MIN_SIZE;
74+
}
75+
76+
/**
77+
* Calcs the margin size based in screen size
78+
*
79+
* @return The recommended size in pixels
80+
*/
81+
public static float getMarginSize() {
82+
return getSizeMultiplier() * MARGIN_SIZE;
83+
}
84+
85+
/**
86+
* Calcs the space between ui elements based in screen size
87+
*
88+
* @return The recommended size in pixels
89+
*/
90+
public static float getSpacing() {
91+
return getSizeMultiplier() * SPACING;
92+
}
9293

9394
// public static float getSizeMultiplier() {
9495
// float inches = pixelsToInches(Gdx.graphics.getWidth());
@@ -106,27 +107,29 @@ public static float getSpacing() {
106107
//
107108
// }
108109

109-
public static float getSizeMultiplier() {
110-
float inches = pixelsToInches(Gdx.graphics.getWidth());
111-
float s = inches / 6f;
110+
public static float getSizeMultiplier() {
111+
// FIX: In Wayland, the Gdx.graphics.getWidth() does not return the correct value in the first call.
112+
int width = Gdx.graphics.isFullscreen() && Gdx.app.getType() == Application.ApplicationType.Desktop ? Gdx.graphics.getDisplayMode().width : Gdx.graphics.getWidth();
113+
float inches = pixelsToInches(width);
114+
float s = inches / 6f;
112115

113-
return Math.max(1.0f, s);
116+
return Math.max(1.0f, s);
114117

115-
}
118+
}
116119

117-
public static int dpToPixels(int dp) {
118-
return (int) (dp * getLogicalDensity());
119-
}
120+
public static int dpToPixels(int dp) {
121+
return (int) (dp * getLogicalDensity());
122+
}
120123

121-
public static int pixelsToDP(int pixels) {
122-
return (int) (pixels / getLogicalDensity());
123-
}
124+
public static int pixelsToDP(int pixels) {
125+
return (int) (pixels / getLogicalDensity());
126+
}
124127

125-
public static float pixelsToInches(int pixels) {
126-
return pixels / DPI;
127-
}
128+
public static float pixelsToInches(int pixels) {
129+
return pixels / DPI;
130+
}
128131

129-
public static float ptToPixels(float pts) {
130-
return pts * 72 / DPI;
131-
}
132+
public static float ptToPixels(float pts) {
133+
return pts * 72 / DPI;
134+
}
132135
}

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ allprojects {
22
repositories {
33
mavenLocal()
44
mavenCentral()
5-
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
6-
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
5+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
76
}
87
}
98

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version=4.4.0-SNAPSHOT
2-
libgdxVersion=1.13.1
3-
roboVMVersion=2.3.22
2+
libgdxVersion=1.13.6-SNAPSHOT
3+
roboVMVersion=2.3.23
44
androidAPILevel=35
5-
androidGradlePluginVersion=8.6.1
6-
bladeInkVersion=1.2.0
7-
gdxControllersVersion=2.2.3
5+
androidGradlePluginVersion=8.11.1
6+
bladeInkVersion=1.2.1
7+
gdxControllersVersion=2.2.4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)