v0.7.5b: removed bitmaptextmultiline and various unused related code
This commit is contained in:
@@ -33,7 +33,6 @@ import com.watabou.glwrap.Blending;
|
||||
import com.watabou.input.PointerEvent;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.BitmapText.Font;
|
||||
import com.watabou.noosa.BitmapTextMultiline;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.ColorBlock;
|
||||
import com.watabou.noosa.Game;
|
||||
@@ -64,11 +63,8 @@ public class PixelScene extends Scene {
|
||||
|
||||
public static Camera uiCamera;
|
||||
|
||||
//stylized pixel font
|
||||
//stylized 3x5 bitmapped pixel font. Only latin characters supported.
|
||||
public static BitmapText.Font pixelFont;
|
||||
//These represent various mipmaps of the same font
|
||||
public static BitmapText.Font font1x;
|
||||
public static BitmapText.Font font2x;
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
@@ -116,23 +112,7 @@ public class PixelScene extends Scene {
|
||||
BitmapCache.get( Assets.PIXELFONT), 0x00000000, BitmapText.Font.LATIN_FULL );
|
||||
pixelFont.baseLine = 6;
|
||||
pixelFont.tracking = -1;
|
||||
|
||||
//Fonts disabled to save memory (~1mb of texture data just sitting there unused)
|
||||
//uncomment if you wish to enable these again.
|
||||
|
||||
// 9x15 (18)
|
||||
/*font1x = Font.colorMarked(
|
||||
BitmapCache.get( Assets.FONT1X), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
|
||||
font1x.baseLine = 17;
|
||||
font1x.tracking = -2;
|
||||
font1x.texture.filter(Texture.LINEAR, Texture.LINEAR);
|
||||
|
||||
//font1x double scaled
|
||||
font2x = Font.colorMarked(
|
||||
BitmapCache.get( Assets.FONT2X), 44, 0x00000000, BitmapText.Font.LATIN_FULL );
|
||||
font2x.baseLine = 38;
|
||||
font2x.tracking = -4;
|
||||
font2x.texture.filter(Texture.LINEAR, Texture.NEAREST);*/
|
||||
}
|
||||
|
||||
//set up the texture size which rendered text will use for any new glyphs.
|
||||
@@ -187,63 +167,6 @@ public class PixelScene extends Scene {
|
||||
PointerEvent.clearListeners();
|
||||
}
|
||||
|
||||
public static BitmapText.Font font;
|
||||
public static float scale;
|
||||
|
||||
public static void chooseFont( float size ) {
|
||||
chooseFont( size, defaultZoom );
|
||||
}
|
||||
|
||||
public static void chooseFont( float size, float zoom ) {
|
||||
|
||||
float pt = size * zoom;
|
||||
|
||||
if (pt >= 25) {
|
||||
|
||||
font = font2x;
|
||||
scale = pt / 38f;
|
||||
|
||||
} else if (pt >= 12) {
|
||||
|
||||
font = font1x;
|
||||
scale = pt / 19f;
|
||||
|
||||
} else {
|
||||
font = pixelFont;
|
||||
scale = 1f;
|
||||
}
|
||||
|
||||
scale /= zoom;
|
||||
}
|
||||
|
||||
public static BitmapText createText( float size ) {
|
||||
return createText( null, size );
|
||||
}
|
||||
|
||||
public static BitmapText createText( String text, float size ) {
|
||||
|
||||
chooseFont( size );
|
||||
|
||||
BitmapText result = new BitmapText( text, font );
|
||||
result.scale.set( scale );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static BitmapTextMultiline createMultiline( float size ) {
|
||||
return createMultiline( null, size );
|
||||
}
|
||||
|
||||
public static BitmapTextMultiline createMultiline( String text, float size ) {
|
||||
|
||||
chooseFont( size );
|
||||
|
||||
BitmapTextMultiline result = new BitmapTextMultiline( text, font );
|
||||
result.scale.set( scale );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static RenderedTextBlock renderTextBlock(int size ){
|
||||
return renderTextBlock("", size);
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2019 Evan Debenham
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.watabou.noosa.BitmapTextMultiline;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.watabou.utils.Highlighter;
|
||||
|
||||
public class HighlightedText extends Component {
|
||||
|
||||
protected BitmapTextMultiline normal;
|
||||
protected BitmapTextMultiline highlighted;
|
||||
|
||||
protected int nColor = 0xFFFFFF;
|
||||
protected int hColor = 0xFFFF44;
|
||||
|
||||
public HighlightedText( float size ) {
|
||||
normal = PixelScene.createMultiline( size );
|
||||
add( normal );
|
||||
|
||||
highlighted = PixelScene.createMultiline( size );
|
||||
add( highlighted );
|
||||
|
||||
setColor( 0xFFFFFF, 0xFFFF44 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void layout() {
|
||||
normal.x = highlighted.x = x;
|
||||
normal.y = highlighted.y = y;
|
||||
}
|
||||
|
||||
public void text( String value, int maxWidth ) {
|
||||
Highlighter hl = new Highlighter( value );
|
||||
|
||||
normal.text( hl.text );
|
||||
normal.maxWidth = maxWidth;
|
||||
normal.measure();
|
||||
|
||||
if (hl.isHighlighted()) {
|
||||
normal.mask = hl.inverted();
|
||||
|
||||
highlighted.text( hl.text );
|
||||
highlighted.maxWidth = maxWidth;
|
||||
highlighted.measure();
|
||||
|
||||
highlighted.mask = hl.mask;
|
||||
highlighted.visible = true;
|
||||
} else {
|
||||
highlighted.visible = false;
|
||||
}
|
||||
|
||||
width = normal.width();
|
||||
height = normal.height();
|
||||
}
|
||||
|
||||
public void setColor( int n, int h ) {
|
||||
normal.hardlight( n );
|
||||
highlighted.hardlight( h );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user