2222import com .badlogic .gdx .Preferences ;
2323import com .badlogic .gdx .backends .lwjgl3 .Lwjgl3Graphics ;
2424import 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 ;
3025import com .badlogic .gdx .graphics .g2d .TextureAtlas ;
31- import com .badlogic .gdx .graphics .g2d .TextureRegion ;
32- import com .badlogic .gdx .graphics .glutils .ShaderProgram ;
3326import com .badlogic .gdx .scenes .scene2d .ui .Skin ;
3427import com .badlogic .gdx .utils .ObjectMap ;
3528import 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