Skip to content

Commit f7d741a

Browse files
committed
Revert "Test for new fonts, 16 sampling, maybe killer for performance, lets see how it goes. DFF for zooming fonts."
This reverts commit 3740018.
1 parent 3740018 commit f7d741a

File tree

6 files changed

+7
-264
lines changed

6 files changed

+7
-264
lines changed

editor/assets/skin/roboto-dff.fnt

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

editor/assets/skin/roboto-dff.png

-30 KB
Binary file not shown.

editor/assets/skin/uiskin.atlas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
uiskin.png
33
size: 2048,1024
44
format: RGBA8888
5-
filter: Linear,Linear
5+
filter: Nearest,Nearest
66
repeat: none
77
background-fill
88
rotate: false

editor/assets/skin/uiskin.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
2+
com.badlogic.gdx.graphics.g2d.BitmapFont: {
3+
default-font: { file: skin/default-font.fnt },
4+
small-font: { file: skin/small-font.fnt }
5+
},
36
com.badlogic.gdx.graphics.Color: {
47
black: {a: 1, b: 0, g: 0, r: 0 }
58
white: {a: 1, b: 1, g: 1, r: 1 }
@@ -265,4 +268,4 @@
265268
com.kotcrab.vis.ui.util.adapter.SimpleListAdapter$SimpleListAdapterStyle: {
266269
default: {background: window-bg, selection: list-selection }
267270
}
268-
}
271+
}

editor/src/com/rockbite/tools/talos/TalosLauncher.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public static void main (String[] arg) {
2525
config.setWindowedMode(1200, 700);
2626
config.setTitle("Talos");
2727

28-
config.setBackBufferConfig(8, 8, 8, 8, 16, 0, 16);
29-
3028
TalosMain talos = new TalosMain();
3129

3230
new Lwjgl3Application(talos, config);

editor/src/com/rockbite/tools/talos/TalosMain.java

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@
2222
import com.badlogic.gdx.Preferences;
2323
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics;
2424
import com.badlogic.gdx.graphics.GL20;
25-
import com.badlogic.gdx.graphics.Texture;
26-
import com.badlogic.gdx.graphics.g2d.Batch;
27-
import com.badlogic.gdx.graphics.g2d.BitmapFont;
28-
import com.badlogic.gdx.graphics.g2d.BitmapFontCache;
29-
import com.badlogic.gdx.graphics.g2d.DistanceFieldFont;
3025
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
31-
import com.badlogic.gdx.graphics.g2d.TextureRegion;
32-
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
3326
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
3427
import com.badlogic.gdx.utils.ObjectMap;
3528
import com.kotcrab.vis.ui.VisUI;
@@ -141,27 +134,9 @@ public void run () {
141134
preferences = Gdx.app.getPreferences("talos-preferences");
142135

143136
TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("skin/uiskin.atlas"));
144-
skin = new Skin();
137+
skin = new Skin(Gdx.files.internal("skin/uiskin.json"));
145138
skin.addRegions(atlas);
146139

147-
Texture fontTexture = new Texture(Gdx.files.internal("skin/roboto-dff.png"), true);
148-
fontTexture.setFilter(Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.Linear);
149-
DistanceFieldFont distanceFieldFont = new DistanceFieldFont(Gdx.files.internal("skin/roboto-dff.fnt"), new TextureRegion(fontTexture)) {
150-
151-
@Override
152-
public BitmapFontCache newFontCache () {
153-
return new CustomCache(this, this.usesIntegerPositions());
154-
}
155-
};
156-
distanceFieldFont.setDistanceFieldSmoothing(10);
157-
distanceFieldFont.setUseIntegerPositions(true);
158-
159-
skin.add("default-font", distanceFieldFont, BitmapFont.class);
160-
skin.add("small-font", distanceFieldFont, BitmapFont.class);
161-
162-
skin.load(Gdx.files.internal("skin/uiskin.json"));
163-
164-
165140
VisUI.load(skin);
166141

167142
uiStage = new UIStage(skin);
@@ -183,40 +158,6 @@ public BitmapFontCache newFontCache () {
183158
TalosMain.Instance().ProjectController().newProject(ProjectController.TLS);
184159
}
185160

186-
187-
static private class CustomCache extends BitmapFontCache {
188-
189-
private final ShaderProgram distanceFieldShader;
190-
191-
public CustomCache (DistanceFieldFont font, boolean integer) {
192-
super(font, integer);
193-
distanceFieldShader = DistanceFieldFont.createDistanceFieldShader();
194-
}
195-
196-
private float getSmoothingFactor () {
197-
final DistanceFieldFont font = (DistanceFieldFont)super.getFont();
198-
return font.getDistanceFieldSmoothing() * font.getScaleX();
199-
}
200-
201-
@Override
202-
public void draw (Batch spriteBatch) {
203-
final ShaderProgram cache = spriteBatch.getShader();
204-
spriteBatch.setShader(distanceFieldShader);
205-
spriteBatch.getShader().setUniformf("u_smoothing", getSmoothingFactor());
206-
super.draw(spriteBatch);
207-
spriteBatch.setShader(cache);
208-
}
209-
210-
@Override
211-
public void draw (Batch spriteBatch, int start, int end) {
212-
final ShaderProgram cache = spriteBatch.getShader();
213-
spriteBatch.setShader(distanceFieldShader);
214-
spriteBatch.getShader().setUniformf("u_smoothing", getSmoothingFactor());
215-
super.draw(spriteBatch, start, end);
216-
spriteBatch.setShader(cache);
217-
}
218-
}
219-
220161
public void disableNodeStage() {
221162
currentWorkplaceStage = null;
222163
inputMultiplexer.removeProcessor(nodeStage.getStage());

0 commit comments

Comments
 (0)