v0.3.4: added rendered text to the about scene

This commit is contained in:
Evan Debenham 2016-01-22 23:25:31 -05:00 committed by Evan Debenham
parent 32c72af07e
commit b45d35dbf2

View File

@ -26,10 +26,11 @@ import android.net.Uri;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton; import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
import com.watabou.input.Touchscreen.Touch; import com.watabou.input.Touchscreen.Touch;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Camera; import com.watabou.noosa.Camera;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.RenderedTextMultiline;
import com.watabou.noosa.TouchArea; import com.watabou.noosa.TouchArea;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs; import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
@ -41,18 +42,15 @@ public class AboutScene extends PixelScene {
private static final String TTL_SHPX = "Shattered Pixel Dungeon"; private static final String TTL_SHPX = "Shattered Pixel Dungeon";
private static final String TXT_SHPX = private static final String TXT_SHPX =
"Design, Code, & Graphics: Evan\n\n" + "Design, Code, & Graphics: Evan";
"Shattered Pixel is Evan's online home, check it out:";
private static final String LNK_SHPX = "ShatteredPixel.com"; private static final String LNK_SHPX = "ShatteredPixel.com";
private static final String TTL_WATA = "Pixel Dungeon";
private static final String TTL_WATA = "Original Pixel Dungeon";
private static final String TXT_WATA = private static final String TXT_WATA =
"Code & Graphics: Watabou\n" + "Code & Graphics: Watabou\n" +
"Music: Cube_Code\n\n" + "Music: Cube_Code";
"Visit Watabou for more info:";
private static final String LNK_WATA = "pixeldungeon.watabou.ru"; private static final String LNK_WATA = "pixeldungeon.watabou.ru";
@ -71,33 +69,27 @@ public class AboutScene extends PixelScene {
new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20; new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20;
BitmapTextMultiline shpxtitle = createMultiline( TTL_SHPX, 8 ); RenderedText shpxtitle = renderText( TTL_SHPX, 8 );
shpxtitle.maxWidth = (int) Math.min( colWidth, 120 );
shpxtitle.measure();
shpxtitle.hardlight( Window.SHPX_COLOR ); shpxtitle.hardlight( Window.SHPX_COLOR );
add( shpxtitle ); add( shpxtitle );
shpxtitle.x = (colWidth - shpxtitle.width()) / 2; shpxtitle.x = (colWidth - shpxtitle.width()) / 2;
shpxtitle.y = shpx.y + shpx.height + 5; shpxtitle.y = shpx.y + shpx.height + 5;
BitmapTextMultiline shpxtext = createMultiline( TXT_SHPX, 8 ); RenderedTextMultiline shpxtext = renderMultiline( TXT_SHPX, 8 );
shpxtext.maxWidth = shpxtitle.maxWidth; shpxtext.maxWidth((int)Math.min(colWidth, 120));
shpxtext.measure();
add( shpxtext ); add( shpxtext );
shpxtext.x = (colWidth - shpxtext.width()) / 2; shpxtext.setPos((colWidth - shpxtext.width()) / 2, shpxtitle.y + shpxtitle.height() + 12);
shpxtext.y = shpxtitle.y + shpxtitle.height() + 12;
BitmapTextMultiline shpxlink = createMultiline( LNK_SHPX, 8 ); RenderedTextMultiline shpxlink = renderMultiline( LNK_SHPX, 8 );
shpxlink.maxWidth = shpxtitle.maxWidth; shpxlink.maxWidth(shpxtext.maxWidth());
shpxlink.measure();
shpxlink.hardlight( Window.SHPX_COLOR ); shpxlink.hardlight( Window.SHPX_COLOR );
add( shpxlink ); add( shpxlink );
shpxlink.x = shpxtext.x; shpxlink.setPos((colWidth - shpxlink.width()) / 2, shpxtext.bottom() + 6);
shpxlink.y = shpxtext.y + shpxtext.height();
TouchArea shpxhotArea = new TouchArea( shpxlink ) { TouchArea shpxhotArea = new TouchArea( shpxlink.left(), shpxlink.top(), shpxlink.width(), shpxlink.height() ) {
@Override @Override
protected void onClick( Touch touch ) { protected void onClick( Touch touch ) {
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://" + LNK_SHPX ) ); Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://" + LNK_SHPX ) );
@ -110,38 +102,32 @@ public class AboutScene extends PixelScene {
wata.x = wataOffset + (colWidth - wata.width()) / 2; wata.x = wataOffset + (colWidth - wata.width()) / 2;
wata.y = ShatteredPixelDungeon.landscape() ? wata.y = ShatteredPixelDungeon.landscape() ?
colTop: colTop:
shpxlink.y + wata.height + 20; shpxlink.top() + wata.height + 20;
add( wata ); add( wata );
new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20; new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20;
BitmapTextMultiline wataTitle = createMultiline( TTL_WATA, 8 ); RenderedText wataTitle = renderText( TTL_WATA, 8 );
wataTitle.maxWidth = (int) Math.min( colWidth, 120 );
wataTitle.measure();
wataTitle.hardlight(Window.TITLE_COLOR); wataTitle.hardlight(Window.TITLE_COLOR);
add( wataTitle ); add( wataTitle );
wataTitle.x = wataOffset + (colWidth - wataTitle.width()) / 2; wataTitle.x = wataOffset + (colWidth - wataTitle.width()) / 2;
wataTitle.y = wata.y + wata.height + 11; wataTitle.y = wata.y + wata.height + 11;
BitmapTextMultiline wataText = createMultiline( TXT_WATA, 8 ); RenderedTextMultiline wataText = renderMultiline( TXT_WATA, 8 );
wataText.maxWidth = wataTitle.maxWidth; wataText.maxWidth((int)Math.min(colWidth, 120));
wataText.measure();
add( wataText ); add( wataText );
wataText.setPos(wataOffset + (colWidth - wataText.width()) / 2, wataTitle.y + wataTitle.height() + 12);
wataText.x = wataOffset + (colWidth - wataText.width()) / 2; RenderedTextMultiline wataLink = renderMultiline( LNK_WATA, 8 );
wataText.y = wataTitle.y + wataTitle.height() + 12; wataLink.maxWidth((int)Math.min(colWidth, 120));
BitmapTextMultiline wataLink = createMultiline( LNK_WATA, 8 );
wataLink.maxWidth = wataTitle.maxWidth;
wataLink.measure();
wataLink.hardlight(Window.TITLE_COLOR); wataLink.hardlight(Window.TITLE_COLOR);
add(wataLink); add(wataLink);
wataLink.x = wataText.x; wataLink.setPos(wataOffset + (colWidth - wataLink.width()) / 2 , wataText.bottom() + 6);
wataLink.y = wataText.y + wataText.height();
TouchArea hotArea = new TouchArea( wataLink ) { TouchArea hotArea = new TouchArea( wataLink.left(), wataLink.top(), wataLink.width(), wataLink.height() ) {
@Override @Override
protected void onClick( Touch touch ) { protected void onClick( Touch touch ) {
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://" + LNK_WATA ) ); Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://" + LNK_WATA ) );