v1.2.0: implemented full and mixed UI modes, in addition to mobile
This commit is contained in:
@@ -58,10 +58,6 @@ public class Scene extends Group {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean landscape(){
|
|
||||||
return Game.width > Game.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|||||||
@@ -182,7 +182,9 @@ windows.wndsettings$displaytab.visual_grid=Visual Grid
|
|||||||
windows.wndsettings$displaytab.off=Off
|
windows.wndsettings$displaytab.off=Off
|
||||||
windows.wndsettings$displaytab.high=High
|
windows.wndsettings$displaytab.high=High
|
||||||
windows.wndsettings$uitab.title=Interface Settings
|
windows.wndsettings$uitab.title=Interface Settings
|
||||||
windows.wndsettings$uitab.mode=Toolbar Mode:
|
windows.wndsettings$uitab.size=Interface Size
|
||||||
|
windows.wndsettings$uitab.mobile=Mobile
|
||||||
|
windows.wndsettings$uitab.full=Full
|
||||||
windows.wndsettings$uitab.split=Split
|
windows.wndsettings$uitab.split=Split
|
||||||
windows.wndsettings$uitab.group=Group
|
windows.wndsettings$uitab.group=Group
|
||||||
windows.wndsettings$uitab.center=Center
|
windows.wndsettings$uitab.center=Center
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
|||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.audio.Music;
|
import com.watabou.noosa.audio.Music;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
import com.watabou.utils.DeviceCompat;
|
||||||
import com.watabou.utils.GameSettings;
|
import com.watabou.utils.GameSettings;
|
||||||
import com.watabou.utils.Point;
|
import com.watabou.utils.Point;
|
||||||
|
|
||||||
@@ -126,11 +127,30 @@ public class SPDSettings extends GameSettings {
|
|||||||
|
|
||||||
//Interface
|
//Interface
|
||||||
|
|
||||||
|
public static final String KEY_UI_SIZE = "full_ui";
|
||||||
public static final String KEY_QUICKSLOTS = "quickslots";
|
public static final String KEY_QUICKSLOTS = "quickslots";
|
||||||
public static final String KEY_FLIPTOOLBAR = "flipped_ui";
|
public static final String KEY_FLIPTOOLBAR = "flipped_ui";
|
||||||
public static final String KEY_FLIPTAGS = "flip_tags";
|
public static final String KEY_FLIPTAGS = "flip_tags";
|
||||||
public static final String KEY_BARMODE = "toolbar_mode";
|
public static final String KEY_BARMODE = "toolbar_mode";
|
||||||
|
|
||||||
|
//0 = mobile, 1 = mixed (large without inventory in main UI), 2 = large
|
||||||
|
public static void interfaceSize( int value ){
|
||||||
|
put( KEY_UI_SIZE, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int interfaceSize(){
|
||||||
|
int size = getInt( KEY_UI_SIZE, DeviceCompat.isDesktop() ? 2 : 0 );
|
||||||
|
if (size > 0){
|
||||||
|
//force mobile UI if there is not enough space for full UI
|
||||||
|
float wMin = Game.width / PixelScene.MIN_WIDTH_FULL;
|
||||||
|
float hMin = Game.height / PixelScene.MIN_HEIGHT_FULL;
|
||||||
|
if (Math.min(wMin, hMin) < 2*Game.density){
|
||||||
|
size = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
public static void quickSlots( int value ){ put( KEY_QUICKSLOTS, value ); }
|
public static void quickSlots( int value ){ put( KEY_QUICKSLOTS, value ); }
|
||||||
|
|
||||||
public static int quickSlots(){ return getInt( KEY_QUICKSLOTS, 4, 0, 4); }
|
public static int quickSlots(){ return getInt( KEY_QUICKSLOTS, 4, 0, 4); }
|
||||||
@@ -337,8 +357,8 @@ public class SPDSettings extends GameSettings {
|
|||||||
|
|
||||||
public static Point windowResolution(){
|
public static Point windowResolution(){
|
||||||
return new Point(
|
return new Point(
|
||||||
getInt( KEY_WINDOW_WIDTH, 960, 480, Integer.MAX_VALUE ),
|
getInt( KEY_WINDOW_WIDTH, 800, 720, Integer.MAX_VALUE ),
|
||||||
getInt( KEY_WINDOW_HEIGHT, 640, 320, Integer.MAX_VALUE )
|
getInt( KEY_WINDOW_HEIGHT, 600, 400, Integer.MAX_VALUE )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.CharHealthIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CharHealthIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.InventoryPane;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.LootIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.LootIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.MenuPane;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.MenuPane;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||||
@@ -169,6 +170,9 @@ public class GameScene extends PixelScene {
|
|||||||
private Group overFogEffects;
|
private Group overFogEffects;
|
||||||
private Group healthIndicators;
|
private Group healthIndicators;
|
||||||
|
|
||||||
|
private InventoryPane inventory;
|
||||||
|
private static boolean invVisible = true;
|
||||||
|
|
||||||
private Toolbar toolbar;
|
private Toolbar toolbar;
|
||||||
private Toast prompt;
|
private Toast prompt;
|
||||||
|
|
||||||
@@ -349,14 +353,16 @@ public class GameScene extends PixelScene {
|
|||||||
|
|
||||||
add( cellSelector = new CellSelector( tiles ) );
|
add( cellSelector = new CellSelector( tiles ) );
|
||||||
|
|
||||||
|
int uiSize = SPDSettings.interfaceSize();
|
||||||
|
|
||||||
menu = new MenuPane();
|
menu = new MenuPane();
|
||||||
menu.camera = uiCamera;
|
menu.camera = uiCamera;
|
||||||
menu.setPos( uiCamera.width-50, 1);
|
menu.setPos( uiCamera.width-50, uiSize > 0 ? 0 : 1);
|
||||||
add(menu);
|
add(menu);
|
||||||
|
|
||||||
status = new StatusPane( false );
|
status = new StatusPane( SPDSettings.interfaceSize() > 0 );
|
||||||
status.camera = uiCamera;
|
status.camera = uiCamera;
|
||||||
status.setRect(0, 0, uiCamera.width, 0 );
|
status.setRect(0, uiSize > 0 ? uiCamera.height-39 : 0, uiCamera.width, 0 );
|
||||||
add(status);
|
add(status);
|
||||||
|
|
||||||
boss = new BossHealthBar();
|
boss = new BossHealthBar();
|
||||||
@@ -366,7 +372,17 @@ public class GameScene extends PixelScene {
|
|||||||
|
|
||||||
toolbar = new Toolbar();
|
toolbar = new Toolbar();
|
||||||
toolbar.camera = uiCamera;
|
toolbar.camera = uiCamera;
|
||||||
toolbar.setRect( 0,uiCamera.height - toolbar.height(), uiCamera.width, toolbar.height() );
|
|
||||||
|
if (uiSize == 2) {
|
||||||
|
inventory = new InventoryPane();
|
||||||
|
inventory.camera = uiCamera;
|
||||||
|
inventory.setPos(uiCamera.width - inventory.width(), uiCamera.height - inventory.height());
|
||||||
|
add(inventory);
|
||||||
|
|
||||||
|
toolbar.setRect( 0, uiCamera.height - toolbar.height() - inventory.height(), uiCamera.width, toolbar.height() );
|
||||||
|
} else {
|
||||||
|
toolbar.setRect( 0, uiCamera.height - toolbar.height(), uiCamera.width, toolbar.height() );
|
||||||
|
}
|
||||||
add( toolbar );
|
add( toolbar );
|
||||||
|
|
||||||
attack = new AttackIndicator();
|
attack = new AttackIndicator();
|
||||||
@@ -569,6 +585,7 @@ public class GameScene extends PixelScene {
|
|||||||
GameScene.flashForDocument(Document.GUIDE_DIEING);
|
GameScene.flashForDocument(Document.GUIDE_DIEING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!invVisible) toggleInvPane();
|
||||||
fadeIn();
|
fadeIn();
|
||||||
|
|
||||||
//re-show WndResurrect if needed
|
//re-show WndResurrect if needed
|
||||||
@@ -735,13 +752,17 @@ public class GameScene extends PixelScene {
|
|||||||
float tagWidth = Tag.SIZE + (tagsOnLeft ? insets.left : insets.right);
|
float tagWidth = Tag.SIZE + (tagsOnLeft ? insets.left : insets.right);
|
||||||
float tagLeft = tagsOnLeft ? 0 : uiCamera.width - tagWidth;
|
float tagLeft = tagsOnLeft ? 0 : uiCamera.width - tagWidth;
|
||||||
|
|
||||||
if (SPDSettings.flipTags()) {
|
float y = SPDSettings.interfaceSize() == 0 ? scene.toolbar.top()-2 : scene.status.top()-2;
|
||||||
scene.log.setRect(tagWidth, scene.toolbar.top()-2, uiCamera.width - tagWidth - insets.right, 0);
|
if (tagsOnLeft) {
|
||||||
|
scene.log.setRect(tagWidth, y, uiCamera.width - tagWidth - insets.right, 0);
|
||||||
} else {
|
} else {
|
||||||
scene.log.setRect(insets.left, scene.toolbar.top()-2, uiCamera.width - tagWidth - insets.left, 0);
|
scene.log.setRect(insets.left, y, uiCamera.width - tagWidth - insets.left, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float pos = scene.toolbar.top();
|
float pos = scene.toolbar.top();
|
||||||
|
if (tagsOnLeft && SPDSettings.interfaceSize() > 0){
|
||||||
|
pos = scene.status.top();
|
||||||
|
}
|
||||||
|
|
||||||
if (scene.tagAttack){
|
if (scene.tagAttack){
|
||||||
scene.attack.setRect( tagLeft, pos - Tag.SIZE, tagWidth, Tag.SIZE );
|
scene.attack.setRect( tagLeft, pos - Tag.SIZE, tagWidth, Tag.SIZE );
|
||||||
@@ -1043,6 +1064,19 @@ public class GameScene extends PixelScene {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void toggleInvPane(){
|
||||||
|
if (scene != null && scene.inventory != null){
|
||||||
|
if (scene.inventory.visible){
|
||||||
|
scene.inventory.visible = scene.inventory.active = invVisible = false;
|
||||||
|
scene.toolbar.setPos(scene.toolbar.left(), uiCamera.height-scene.toolbar.height());
|
||||||
|
} else {
|
||||||
|
scene.inventory.visible = scene.inventory.active = invVisible = true;
|
||||||
|
scene.toolbar.setPos(scene.toolbar.left(), scene.inventory.top()-scene.toolbar.height());
|
||||||
|
}
|
||||||
|
layoutTags();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateFog(){
|
public static void updateFog(){
|
||||||
if (scene != null) {
|
if (scene != null) {
|
||||||
scene.fog.updateFog();
|
scene.fog.updateFog();
|
||||||
|
|||||||
@@ -48,13 +48,20 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class PixelScene extends Scene {
|
public class PixelScene extends Scene {
|
||||||
|
|
||||||
// Minimum virtual display size for portrait orientation
|
// Minimum virtual display size for mobile portrait orientation
|
||||||
public static final float MIN_WIDTH_P = 135;
|
public static final float MIN_WIDTH_P = 135;
|
||||||
public static final float MIN_HEIGHT_P = 225;
|
public static final float MIN_HEIGHT_P = 225;
|
||||||
|
|
||||||
// Minimum virtual display size for landscape orientation
|
// Minimum virtual display size for mobile landscape orientation
|
||||||
public static final float MIN_WIDTH_L = 240;
|
public static final float MIN_WIDTH_L = 240;
|
||||||
public static final float MIN_HEIGHT_L = 160;
|
public static final float MIN_HEIGHT_L = 160;
|
||||||
|
|
||||||
|
// Minimum virtual display size for full desktop UI (landscape only)
|
||||||
|
//TODO maybe include another scale for mixed UI? might make it more accessible to mobile devices
|
||||||
|
// mixed UI has similar requirements to mobile landscape tbh... Maybe just merge them?
|
||||||
|
// mixed UI can possible be used on mobile portrait for tablets though.. Does that happen often?
|
||||||
|
public static final float MIN_WIDTH_FULL = 360;
|
||||||
|
public static final float MIN_HEIGHT_FULL = 200;
|
||||||
|
|
||||||
public static int defaultZoom = 0;
|
public static int defaultZoom = 0;
|
||||||
public static int maxDefaultZoom = 0;
|
public static int maxDefaultZoom = 0;
|
||||||
@@ -82,13 +89,21 @@ public class PixelScene extends Scene {
|
|||||||
TextureCache.clear();
|
TextureCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
float minWidth, minHeight;
|
float minWidth, minHeight, scaleFactor;
|
||||||
if (landscape()) {
|
if (SPDSettings.interfaceSize() > 0){
|
||||||
|
minWidth = MIN_WIDTH_FULL;
|
||||||
|
minHeight = MIN_HEIGHT_FULL;
|
||||||
|
//TODO not perfect in all cases, especially for big monitors
|
||||||
|
// Perhaps look at max zoom and increase if default is less than half of max?
|
||||||
|
scaleFactor = 3.75f;
|
||||||
|
} else if (landscape()) {
|
||||||
minWidth = MIN_WIDTH_L;
|
minWidth = MIN_WIDTH_L;
|
||||||
minHeight = MIN_HEIGHT_L;
|
minHeight = MIN_HEIGHT_L;
|
||||||
|
scaleFactor = 2.5f;
|
||||||
} else {
|
} else {
|
||||||
minWidth = MIN_WIDTH_P;
|
minWidth = MIN_WIDTH_P;
|
||||||
minHeight = MIN_HEIGHT_P;
|
minHeight = MIN_HEIGHT_P;
|
||||||
|
scaleFactor = 2.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight);
|
maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight);
|
||||||
@@ -96,7 +111,7 @@ public class PixelScene extends Scene {
|
|||||||
defaultZoom = SPDSettings.scale();
|
defaultZoom = SPDSettings.scale();
|
||||||
|
|
||||||
if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){
|
if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){
|
||||||
defaultZoom = (int)GameMath.gate(2, (int)Math.ceil( Game.density * 2.5 ), maxDefaultZoom);
|
defaultZoom = (int)GameMath.gate(2, (int)Math.ceil( Game.density * scaleFactor ), maxDefaultZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
minZoom = 1;
|
minZoom = 1;
|
||||||
@@ -168,6 +183,11 @@ public class PixelScene extends Scene {
|
|||||||
PointerEvent.clearListeners();
|
PointerEvent.clearListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean landscape(){
|
||||||
|
return SPDSettings.interfaceSize() > 0 || Game.width > Game.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static RenderedTextBlock renderTextBlock(int size ){
|
public static RenderedTextBlock renderTextBlock(int size ){
|
||||||
return renderTextBlock("", size);
|
return renderTextBlock("", size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,11 @@ public class Toolbar extends Component {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
GameScene.show(new WndBag(Dungeon.hero.belongings.backpack));
|
if (SPDSettings.interfaceSize() == 2){
|
||||||
|
GameScene.toggleInvPane();
|
||||||
|
} else {
|
||||||
|
GameScene.show(new WndBag(Dungeon.hero.belongings.backpack));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -181,6 +185,32 @@ public class Toolbar extends Component {
|
|||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
|
|
||||||
|
float right = width;
|
||||||
|
|
||||||
|
if (SPDSettings.interfaceSize() > 0){
|
||||||
|
btnInventory.setPos(right - btnInventory.width(), y);
|
||||||
|
btnWait.setPos(btnInventory.left() - btnWait.width(), y);
|
||||||
|
btnSearch.setPos(btnWait.left() - btnSearch.width(), y);
|
||||||
|
|
||||||
|
right = btnSearch.left();
|
||||||
|
for(int i = 3; i >= 0; i--) {
|
||||||
|
if (i == 3){
|
||||||
|
btnQuick[i].border(0, 2);
|
||||||
|
btnQuick[i].frame(106, 0, 19, 24);
|
||||||
|
} else if (i == 0){
|
||||||
|
btnQuick[i].border(2, 1);
|
||||||
|
btnQuick[i].frame(86, 0, 20, 24);
|
||||||
|
} else {
|
||||||
|
btnQuick[i].border(0, 1);
|
||||||
|
btnQuick[i].frame(88, 0, 18, 24);
|
||||||
|
}
|
||||||
|
btnQuick[i].setPos(right-btnQuick[i].width(), y+2);
|
||||||
|
right = btnQuick[i].left();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 0; i <= 3; i++) {
|
for(int i = 0; i <= 3; i++) {
|
||||||
if (i == 0 && !SPDSettings.flipToolbar() ||
|
if (i == 0 && !SPDSettings.flipToolbar() ||
|
||||||
i == 3 && SPDSettings.flipToolbar()){
|
i == 3 && SPDSettings.flipToolbar()){
|
||||||
@@ -196,7 +226,6 @@ public class Toolbar extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float right = width;
|
|
||||||
switch(Mode.valueOf(SPDSettings.toolbarMode())){
|
switch(Mode.valueOf(SPDSettings.toolbarMode())){
|
||||||
case SPLIT:
|
case SPLIT:
|
||||||
btnWait.setPos(x, y);
|
btnWait.setPos(x, y);
|
||||||
|
|||||||
@@ -269,12 +269,17 @@ public class WndSettings extends WndTabbed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (DeviceCompat.isAndroid()) {
|
if (DeviceCompat.isAndroid()) {
|
||||||
btnOrientation = new RedButton(PixelScene.landscape() ?
|
Boolean landscape = SPDSettings.landscape();
|
||||||
|
if (landscape == null){
|
||||||
|
landscape = Game.width > Game.height;
|
||||||
|
}
|
||||||
|
Boolean finalLandscape = landscape;
|
||||||
|
btnOrientation = new RedButton(finalLandscape ?
|
||||||
Messages.get(this, "portrait")
|
Messages.get(this, "portrait")
|
||||||
: Messages.get(this, "landscape")) {
|
: Messages.get(this, "landscape")) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
SPDSettings.landscape(!PixelScene.landscape());
|
SPDSettings.landscape(!finalLandscape);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
add(btnOrientation);
|
add(btnOrientation);
|
||||||
@@ -360,7 +365,9 @@ public class WndSettings extends WndTabbed {
|
|||||||
private static class UITab extends Component {
|
private static class UITab extends Component {
|
||||||
|
|
||||||
RenderedTextBlock title;
|
RenderedTextBlock title;
|
||||||
|
|
||||||
ColorBlock sep1;
|
ColorBlock sep1;
|
||||||
|
OptionSlider optUISize;
|
||||||
RenderedTextBlock barDesc;
|
RenderedTextBlock barDesc;
|
||||||
RedButton btnSplit; RedButton btnGrouped; RedButton btnCentered;
|
RedButton btnSplit; RedButton btnGrouped; RedButton btnCentered;
|
||||||
CheckBox chkFlipToolbar;
|
CheckBox chkFlipToolbar;
|
||||||
@@ -379,58 +386,84 @@ public class WndSettings extends WndTabbed {
|
|||||||
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
sep1 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
add(sep1);
|
add(sep1);
|
||||||
|
|
||||||
barDesc = PixelScene.renderTextBlock(Messages.get(this, "mode"), 9);
|
//add slider for UI size only if device has enough space to support it
|
||||||
add(barDesc);
|
float wMin = Game.width / PixelScene.MIN_WIDTH_FULL;
|
||||||
|
float hMin = Game.height / PixelScene.MIN_HEIGHT_FULL;
|
||||||
|
if (Math.min(wMin, hMin) >= 2*Game.density){
|
||||||
|
optUISize = new OptionSlider(
|
||||||
|
Messages.get(this, "size"),
|
||||||
|
Messages.get(this, "mobile"),
|
||||||
|
Messages.get(this, "full"),
|
||||||
|
0,
|
||||||
|
2
|
||||||
|
) {
|
||||||
|
@Override
|
||||||
|
protected void onChange() {
|
||||||
|
SPDSettings.interfaceSize(getSelectedValue());
|
||||||
|
ShatteredPixelDungeon.seamlessResetScene();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
optUISize.setSelectedValue(SPDSettings.interfaceSize());
|
||||||
|
add(optUISize);
|
||||||
|
}
|
||||||
|
|
||||||
btnSplit = new RedButton(Messages.get(this, "split")){
|
if (SPDSettings.interfaceSize() == 0) {
|
||||||
@Override
|
barDesc = PixelScene.renderTextBlock(Messages.get(this, "mode"), 9);
|
||||||
protected void onClick() {
|
add(barDesc);
|
||||||
textColor(TITLE_COLOR);
|
|
||||||
btnGrouped.textColor(WHITE);
|
|
||||||
btnCentered.textColor(WHITE);
|
|
||||||
SPDSettings.toolbarMode(Toolbar.Mode.SPLIT.name());
|
|
||||||
Toolbar.updateLayout();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (SPDSettings.toolbarMode().equals(Toolbar.Mode.SPLIT.name())) btnSplit.textColor(TITLE_COLOR);
|
|
||||||
add(btnSplit);
|
|
||||||
|
|
||||||
btnGrouped = new RedButton(Messages.get(this, "group")){
|
btnSplit = new RedButton(Messages.get(this, "split")) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
btnSplit.textColor(WHITE);
|
textColor(TITLE_COLOR);
|
||||||
textColor(TITLE_COLOR);
|
btnGrouped.textColor(WHITE);
|
||||||
btnCentered.textColor(WHITE);
|
btnCentered.textColor(WHITE);
|
||||||
SPDSettings.toolbarMode(Toolbar.Mode.GROUP.name());
|
SPDSettings.toolbarMode(Toolbar.Mode.SPLIT.name());
|
||||||
Toolbar.updateLayout();
|
Toolbar.updateLayout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (SPDSettings.toolbarMode().equals(Toolbar.Mode.GROUP.name())) btnGrouped.textColor(TITLE_COLOR);
|
if (SPDSettings.toolbarMode().equals(Toolbar.Mode.SPLIT.name()))
|
||||||
add(btnGrouped);
|
btnSplit.textColor(TITLE_COLOR);
|
||||||
|
add(btnSplit);
|
||||||
|
|
||||||
btnCentered = new RedButton(Messages.get(this, "center")){
|
btnGrouped = new RedButton(Messages.get(this, "group")) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
btnSplit.textColor(WHITE);
|
btnSplit.textColor(WHITE);
|
||||||
btnGrouped.textColor(WHITE);
|
textColor(TITLE_COLOR);
|
||||||
textColor(TITLE_COLOR);
|
btnCentered.textColor(WHITE);
|
||||||
SPDSettings.toolbarMode(Toolbar.Mode.CENTER.name());
|
SPDSettings.toolbarMode(Toolbar.Mode.GROUP.name());
|
||||||
Toolbar.updateLayout();
|
Toolbar.updateLayout();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (SPDSettings.toolbarMode().equals(Toolbar.Mode.CENTER.name())) btnCentered.textColor(TITLE_COLOR);
|
if (SPDSettings.toolbarMode().equals(Toolbar.Mode.GROUP.name()))
|
||||||
add(btnCentered);
|
btnGrouped.textColor(TITLE_COLOR);
|
||||||
|
add(btnGrouped);
|
||||||
|
|
||||||
chkFlipToolbar = new CheckBox(Messages.get(this, "flip_toolbar")){
|
btnCentered = new RedButton(Messages.get(this, "center")) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
btnSplit.textColor(WHITE);
|
||||||
SPDSettings.flipToolbar(checked());
|
btnGrouped.textColor(WHITE);
|
||||||
Toolbar.updateLayout();
|
textColor(TITLE_COLOR);
|
||||||
}
|
SPDSettings.toolbarMode(Toolbar.Mode.CENTER.name());
|
||||||
};
|
Toolbar.updateLayout();
|
||||||
chkFlipToolbar.checked(SPDSettings.flipToolbar());
|
}
|
||||||
add(chkFlipToolbar);
|
};
|
||||||
|
if (SPDSettings.toolbarMode().equals(Toolbar.Mode.CENTER.name()))
|
||||||
|
btnCentered.textColor(TITLE_COLOR);
|
||||||
|
add(btnCentered);
|
||||||
|
|
||||||
|
chkFlipToolbar = new CheckBox(Messages.get(this, "flip_toolbar")) {
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
SPDSettings.flipToolbar(checked());
|
||||||
|
Toolbar.updateLayout();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
chkFlipToolbar.checked(SPDSettings.flipToolbar());
|
||||||
|
add(chkFlipToolbar);
|
||||||
|
}
|
||||||
|
|
||||||
chkFlipTags = new CheckBox(Messages.get(this, "flip_indicators")){
|
chkFlipTags = new CheckBox(Messages.get(this, "flip_indicators")){
|
||||||
@Override
|
@Override
|
||||||
@@ -489,20 +522,31 @@ public class WndSettings extends WndTabbed {
|
|||||||
sep1.size(width, 1);
|
sep1.size(width, 1);
|
||||||
sep1.y = title.bottom() + 2*GAP;
|
sep1.y = title.bottom() + 2*GAP;
|
||||||
|
|
||||||
barDesc.setPos((width-barDesc.width())/2f, sep1.y + 1 + GAP);
|
height = sep1.y + 1;
|
||||||
PixelScene.align(barDesc);
|
|
||||||
|
|
||||||
int btnWidth = (int)(width - 2* GAP)/3;
|
if (optUISize != null){
|
||||||
btnSplit.setRect(0, barDesc.bottom() + GAP, btnWidth, 16);
|
optUISize.setRect(0, height + GAP, width, SLIDER_HEIGHT);
|
||||||
btnGrouped.setRect(btnSplit.right()+ GAP, btnSplit.top(), btnWidth, 16);
|
height = optUISize.bottom();
|
||||||
btnCentered.setRect(btnGrouped.right()+ GAP, btnSplit.top(), btnWidth, 16);
|
}
|
||||||
|
|
||||||
if (width > 200) {
|
if (barDesc != null) {
|
||||||
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width/2 - 1, BTN_HEIGHT);
|
barDesc.setPos((width - barDesc.width()) / 2f, height + GAP);
|
||||||
chkFlipTags.setRect(chkFlipToolbar.right() + GAP, chkFlipToolbar.top(), width/2 -1, BTN_HEIGHT);
|
PixelScene.align(barDesc);
|
||||||
|
|
||||||
|
int btnWidth = (int) (width - 2 * GAP) / 3;
|
||||||
|
btnSplit.setRect(0, barDesc.bottom() + GAP, btnWidth, 16);
|
||||||
|
btnGrouped.setRect(btnSplit.right() + GAP, btnSplit.top(), btnWidth, 16);
|
||||||
|
btnCentered.setRect(btnGrouped.right() + GAP, btnSplit.top(), btnWidth, 16);
|
||||||
|
|
||||||
|
if (width > 200) {
|
||||||
|
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width / 2 - 1, BTN_HEIGHT);
|
||||||
|
chkFlipTags.setRect(chkFlipToolbar.right() + GAP, chkFlipToolbar.top(), width / 2 - 1, BTN_HEIGHT);
|
||||||
|
} else {
|
||||||
|
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width, BTN_HEIGHT);
|
||||||
|
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP, width, BTN_HEIGHT);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width, BTN_HEIGHT);
|
chkFlipTags.setRect(0, height + GAP, width, BTN_HEIGHT);
|
||||||
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP, width, BTN_HEIGHT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sep2.size(width, 1);
|
sep2.size(width, 1);
|
||||||
@@ -511,9 +555,18 @@ public class WndSettings extends WndTabbed {
|
|||||||
chkFont.setRect(0, sep2.y + 1 + GAP, width, BTN_HEIGHT);
|
chkFont.setRect(0, sep2.y + 1 + GAP, width, BTN_HEIGHT);
|
||||||
|
|
||||||
if (btnKeyBindings != null){
|
if (btnKeyBindings != null){
|
||||||
sep3.size(width, 1);
|
if (width > 200){
|
||||||
sep3.y = chkFont.bottom() + 2;
|
chkFont.setSize(width/2-1, BTN_HEIGHT);
|
||||||
btnKeyBindings.setRect(0, sep3.y + 1 + GAP, width, BTN_HEIGHT);
|
sep3.size(1, BTN_HEIGHT + 2*GAP);
|
||||||
|
sep3.x = chkFont.right() + 0.5f;
|
||||||
|
sep3.y = sep2.y+1;
|
||||||
|
PixelScene.align(sep3);
|
||||||
|
btnKeyBindings.setRect(chkFont.right()+2, chkFont.top(), width/2 - 1, BTN_HEIGHT);
|
||||||
|
} else {
|
||||||
|
sep3.size(width, 1);
|
||||||
|
sep3.y = chkFont.bottom() + 2;
|
||||||
|
btnKeyBindings.setRect(0, sep3.y + 1 + GAP, width, BTN_HEIGHT);
|
||||||
|
}
|
||||||
height = btnKeyBindings.bottom();
|
height = btnKeyBindings.bottom();
|
||||||
} else {
|
} else {
|
||||||
height = chkFont.bottom();
|
height = chkFont.bottom();
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class DesktopLauncher {
|
|||||||
SPDSettings.set( new Lwjgl3Preferences( SPDSettings.DEFAULT_PREFS_FILE, basePath) );
|
SPDSettings.set( new Lwjgl3Preferences( SPDSettings.DEFAULT_PREFS_FILE, basePath) );
|
||||||
FileUtils.setDefaultFileProperties( Files.FileType.External, basePath );
|
FileUtils.setDefaultFileProperties( Files.FileType.External, basePath );
|
||||||
|
|
||||||
config.setWindowSizeLimits( 480, 320, -1, -1 );
|
config.setWindowSizeLimits( 720, 400, -1, -1 );
|
||||||
Point p = SPDSettings.windowResolution();
|
Point p = SPDSettings.windowResolution();
|
||||||
config.setWindowedMode( p.x, p.y );
|
config.setWindowedMode( p.x, p.y );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user