v0.3.1: added fine-grained brightness controls

This commit is contained in:
Evan Debenham 2015-06-26 16:23:56 -04:00
parent 906fe27ea8
commit 8947eabaf0
3 changed files with 14 additions and 17 deletions

View File

@ -289,15 +289,15 @@ public class ShatteredPixelDungeon extends Game {
return Preferences.INSTANCE.getBoolean( Preferences.KEY_SOUND_FX, true );
}
public static void brightness( boolean value ) {
public static void brightness( int value ) {
Preferences.INSTANCE.put( Preferences.KEY_BRIGHTNESS, value );
if (scene() instanceof GameScene) {
((GameScene)scene()).brightness( value );
}
}
public static boolean brightness() {
return Preferences.INSTANCE.getBoolean( Preferences.KEY_BRIGHTNESS, false );
public static int brightness() {
return Preferences.INSTANCE.getInt( Preferences.KEY_BRIGHTNESS, 0 );
}
public static void lastClass( int value ) {

View File

@ -437,17 +437,12 @@ public class GameScene extends PixelScene {
}
}
public void brightness( boolean value ) {
public void brightness( int value ) {
water.rm = water.gm = water.bm =
tiles.rm = tiles.gm = tiles.bm =
value ? 1.5f : 1.0f;
if (value) {
fog.am = +2f;
fog.aa = -1f;
} else {
fog.am = +1f;
fog.aa = 0f;
}
1.0f + (value/4f);
fog.am = 1f + (value/2f);
fog.aa = 0f - (value/2f);
}
private void addHeapSprite( Heap heap ) {

View File

@ -44,7 +44,7 @@ public class WndSettings extends Window {
private static final String TXT_SOUND = "Sound FX";
private static final String TXT_BRIGHTNESS = "Brightness";
private static final String TXT_BRIGHTNESS = "Brightness: %s";
private static final String TXT_QUICKSLOT = "QuickSlots: %s";
@ -156,16 +156,18 @@ public class WndSettings extends Window {
resize( WIDTH, (int)btnOrientation.bottom() );
} else {
CheckBox btnBrightness = new CheckBox( TXT_BRIGHTNESS ) {
RedButton btnBrightness = new RedButton( Utils.format(TXT_BRIGHTNESS, ShatteredPixelDungeon.brightness()) ) {
@Override
protected void onClick() {
super.onClick();
ShatteredPixelDungeon.brightness(checked());
int brightness = ShatteredPixelDungeon.brightness()+1;
if (brightness == 5) brightness = -2;
ShatteredPixelDungeon.brightness(brightness);
this.text(Utils.format(TXT_BRIGHTNESS, brightness));
}
};
btnBrightness.setRect(0, btnSound.bottom() + GAP, WIDTH, BTN_HEIGHT);
btnBrightness.checked(ShatteredPixelDungeon.brightness());
add(btnBrightness);
RedButton btnQuickSlot = new RedButton( Utils.format(TXT_QUICKSLOT, ShatteredPixelDungeon.quickSlots()) ) {