Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions core/src/bms/player/beatoraja/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,20 @@ public void setResolution(Resolution resolution) {
this.resolution = resolution;
}

public int getRealResolutionWidth() {
return useResolution ? windowWidth : resolution.width;
}

public int getRealResolutionHeight() {
return useResolution ? windowHeight : resolution.height;
}

public CustomizableResolution getRealResolution() {
return useResolution
? new CustomizableResolution(windowWidth, windowHeight)
: new CustomizableResolution(resolution.width, resolution.height);
}

public int getWindowWidth() {
return windowWidth;
}
Expand Down
16 changes: 16 additions & 0 deletions core/src/bms/player/beatoraja/CustomizableResolution.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package bms.player.beatoraja;

/**
* Customizable resolution, because original Resolution enum cannot be instantiated at runtime
*
* @see Resolution
*/
public class CustomizableResolution {
public final int width;
public final int height;

public CustomizableResolution(int width, int height) {
this.width = width;
this.height = height;
}
}
25 changes: 13 additions & 12 deletions core/src/bms/player/beatoraja/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -518,43 +518,44 @@ public void render() {
sprite.begin();
systemfont.setColor(Color.CYAN);
message.setLength(0);
int height = config.getRealResolutionHeight();
systemfont.draw(sprite, message.append("FPS ").append(Gdx.graphics.getFramesPerSecond()), debugTextXpos,
config.getResolution().height - 2);
height - 2);
if(debug) {
message.setLength(0);
systemfont.draw(sprite, message.append("Skin Pixmap Images ").append(SkinLoader.getResource().size()), debugTextXpos,
config.getResolution().height - 26);
height - 26);
message.setLength(0);
systemfont.draw(sprite, message.append("Total Memory Used(MB) ").append(Runtime.getRuntime().totalMemory() / (1024 * 1024)), debugTextXpos,
config.getResolution().height - 50);
height - 50);
message.setLength(0);
systemfont.draw(sprite, message.append("Total Free Memory(MB) ").append(Runtime.getRuntime().freeMemory() / (1024 * 1024)), debugTextXpos,
config.getResolution().height - 74);
height - 74);
message.setLength(0);
systemfont.draw(sprite, message.append("Max Sprite In Batch ").append(sprite.maxSpritesInBatch), debugTextXpos,
config.getResolution().height - 98);
height - 98);
message.setLength(0);
systemfont.draw(sprite, message.append("Skin Pixmap Resource Size ").append(SkinLoader.getResource().size()), debugTextXpos,
config.getResolution().height - 122);
height - 122);
message.setLength(0);
systemfont.draw(sprite, message.append("Stagefile Pixmap Resource Size ").append(selector.getStagefileResource().size()), debugTextXpos,
config.getResolution().height - 146);
height - 146);
message.setLength(0);
systemfont.draw(sprite, message.append("Banner Pixmap Resource Size ").append(selector.getBannerResource().size()), debugTextXpos,
config.getResolution().height - 170);
height - 170);
if (current.getSkin() != null) {
message.setLength(0);
systemfont.draw(sprite, message.append("Skin Prepare Time ").append(current.getSkin().pcntPrepare), debugTextXpos,
config.getResolution().height - 194);
height - 194);
message.setLength(0);
systemfont.draw(sprite, message.append("Skin Draw Time ").append(current.getSkin().pcntDraw), debugTextXpos,
config.getResolution().height - 218);
height - 218);
var i = 0;
var l = current.getSkin().pcntmap.keySet().stream().mapToInt(c->c.getSimpleName().length()).max().orElse(1);
var f = "%" + l + "s";
message.setLength(0);
message.append(String.format(f,"SkinObject")).append(" num // prepare cur/avg/max // draw cur/avg/max");
systemfont.draw(sprite, message, debugTextXpos, config.getResolution().height - 242);
systemfont.draw(sprite, message, debugTextXpos, height - 242);
var entrys = current.getSkin().pcntmap.entrySet().stream()
.sorted((e1,e2) -> e1.getKey().getSimpleName().compareTo(e2.getKey().getSimpleName()))
.toList();
Expand All @@ -568,7 +569,7 @@ public void render() {
.append(e.getValue()[4]/100).append(" / ")
.append(e.getValue()[5]/100000).append(" / ")
.append(e.getValue()[6]/100);
systemfont.draw(sprite, message, debugTextXpos, config.getResolution().height - (266 + i * 24));
systemfont.draw(sprite, message, debugTextXpos, height - (266 + i * 24));
i++;
}
}
Expand Down
8 changes: 2 additions & 6 deletions core/src/bms/player/beatoraja/MainLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.ObjectMapper;
import imgui.ImGui;
import imgui.ImGuiIO;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
Expand All @@ -27,7 +24,6 @@
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;

import bms.player.beatoraja.AudioConfig.DriverType;
import bms.player.beatoraja.ir.IRConnectionManager;
import bms.player.beatoraja.launcher.PlayConfigurationView;
import bms.player.beatoraja.song.SQLiteSongDatabaseAccessor;
Expand Down Expand Up @@ -141,8 +137,8 @@ public static void play(Path bmsPath, BMSPlayerMode playerMode, boolean forceExi
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
gdxConfig.setOpenGLEmulation(Lwjgl3ApplicationConfiguration.GLEmulation.GL30, 3, 2);
}
final int w = config.getResolution().width;
final int h = config.getResolution().height;
final int w = config.getRealResolutionWidth();
final int h = config.getRealResolutionHeight();
String targetMonitorName = config.getMonitorName();
Graphics.Monitor targetMonitor = null;
Graphics.DisplayMode gdxDisplayMode;
Expand Down
2 changes: 1 addition & 1 deletion core/src/bms/player/beatoraja/Resolution.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public enum Resolution {
*/
public final int height;

private Resolution(int width, int height) {
Resolution(int width, int height) {
this.width = width;
this.height = height;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/bms/player/beatoraja/config/KeyConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void create() {
if(getSkin() == null) {
SkinHeader header = new SkinHeader();
header.setSourceResolution(Resolution.HD);
header.setDestinationResolution(main.getConfig().getResolution());
header.setDestinationResolution(main.getConfig().getRealResolution());
this.setSkin(new KeyConfigurationSkin(header));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BMSPlayerInputProcessor {
private KeyLogger keylog = new KeyLogger();

public BMSPlayerInputProcessor(Config config, PlayerConfig player) {
Resolution resolution = config.getResolution();
CustomizableResolution resolution = config.getRealResolution();
kbinput = new KeyBoardInputProcesseor(this, player.getMode14().getKeyboardConfig(), resolution);
// Gdx.input.setInputProcessor(kbinput);
Controllers.preferredManager = "bms.player.beatoraja.controller.Lwjgl3ControllerManager";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Arrays;

import bms.player.beatoraja.CustomizableResolution;
import bms.player.beatoraja.PlayModeConfig.KeyboardConfig;
import bms.player.beatoraja.Resolution;
import bms.player.beatoraja.modmenu.SkinWidgetManager;
Expand Down Expand Up @@ -39,7 +40,7 @@ public class KeyBoardInputProcesseor extends BMSPlayerInputDevice implements Inp
/**
* 画面の解像度。マウスの入力イベント処理で使用
*/
private Resolution resolution;
private CustomizableResolution resolution;

/**
* 各キーのon/off状態
Expand All @@ -58,7 +59,7 @@ public class KeyBoardInputProcesseor extends BMSPlayerInputDevice implements Inp
*/
private int duration;

public KeyBoardInputProcesseor(BMSPlayerInputProcessor bmsPlayerInputProcessor, KeyboardConfig config, Resolution resolution) {
public KeyBoardInputProcesseor(BMSPlayerInputProcessor bmsPlayerInputProcessor, KeyboardConfig config, CustomizableResolution resolution) {
super(bmsPlayerInputProcessor, Type.KEYBOARD);
this.mouseScratchInput = new MouseScratchInput(bmsPlayerInputProcessor, this, config);
this.setConfig(config);
Expand Down
43 changes: 30 additions & 13 deletions core/src/bms/player/beatoraja/launcher/VideoConfigurationView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,40 @@
<Label text="%RESOLUTION" GridPane.rowIndex="2" GridPane.columnIndex="0" styleClass="optionLabel"/>
<ComboBox fx:id="resolution" GridPane.rowIndex="2" GridPane.columnIndex="1"/>

<Label text="%MONITOR" GridPane.rowIndex="3" GridPane.columnIndex="0" styleClass="optionLabel"/>
<ComboBox fx:id="monitor" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
<Label text="%CUSTOM_RESOLUTION" GridPane.rowIndex="3" GridPane.columnIndex="0" styleClass="optionLabel" />
<CheckBox fx:id="customResolution" mnemonicParsing="false" GridPane.rowIndex="3" GridPane.columnIndex="1" />

<Label text="%VSYNC" GridPane.rowIndex="4" GridPane.columnIndex="0" styleClass="optionLabel"/>
<CheckBox fx:id="vSync" mnemonicParsing="false" GridPane.rowIndex="4" GridPane.columnIndex="1"/>
<Label text="%CUSTOM_RESOLUTION_WIDTH" GridPane.rowIndex="4" GridPane.columnIndex="0" styleClass="optionLabel" />
<NumericSpinner fx:id="customResolutionWidth" editable="true" GridPane.rowIndex="4" GridPane.columnIndex="1" >
<valueFactory>
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="1280" max="9999999" min="0"/>
</valueFactory>
</NumericSpinner>
<Label text="%CUSTOM_RESOLUTION_HEIGHT" GridPane.rowIndex="4" GridPane.columnIndex="2" styleClass="optionLabel" />
<NumericSpinner fx:id="customResolutionHeight" editable="true" GridPane.rowIndex="4" GridPane.columnIndex="3" >
<valueFactory>
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="720" max="9999999" min="0"/>
</valueFactory>
</NumericSpinner>


<Label text="%MONITOR" GridPane.rowIndex="5" GridPane.columnIndex="0" styleClass="optionLabel"/>
<ComboBox fx:id="monitor" GridPane.rowIndex="5" GridPane.columnIndex="1"/>

<Label text="%VSYNC" GridPane.rowIndex="6" GridPane.columnIndex="0" styleClass="optionLabel"/>
<CheckBox fx:id="vSync" mnemonicParsing="false" GridPane.rowIndex="6" GridPane.columnIndex="1"/>

<Label text="%MAXFPS" GridPane.rowIndex="5" GridPane.columnIndex="0" styleClass="optionLabel"/>
<NumericSpinner fx:id="maxFps" editable="true" GridPane.rowIndex="5" GridPane.columnIndex="1">
<Label text="%MAXFPS" GridPane.rowIndex="7" GridPane.columnIndex="0" styleClass="optionLabel"/>
<NumericSpinner fx:id="maxFps" editable="true" GridPane.rowIndex="7" GridPane.columnIndex="1">
<valueFactory>
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="60" max="1000" min="0"/>
</valueFactory>
</NumericSpinner>

<Label text="%BGA" GridPane.rowIndex="6" GridPane.columnIndex="0" GridPane.columnSpan="2" styleClass="optionHeader"/>
<Label text="%BGA" GridPane.rowIndex="8" GridPane.columnIndex="0" GridPane.columnSpan="2" styleClass="optionHeader"/>

<Label text="%BGA" GridPane.rowIndex="7" GridPane.columnIndex="0" styleClass="optionLabel"/>
<ComboBox fx:id="bgaOp" GridPane.rowIndex="7" GridPane.columnIndex="1">
<Label text="%BGA" GridPane.rowIndex="9" GridPane.columnIndex="0" styleClass="optionLabel"/>
<ComboBox fx:id="bgaOp" GridPane.rowIndex="9" GridPane.columnIndex="1">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="On"/>
Expand All @@ -48,19 +65,19 @@
</items>
</ComboBox>

<Label text="%MISSLAYER_DURATION" GridPane.rowIndex="8" GridPane.columnIndex="0" styleClass="optionLabel">
<Label text="%MISSLAYER_DURATION" GridPane.rowIndex="10" GridPane.columnIndex="0" styleClass="optionLabel">
<tooltip>
<Tooltip text="Set miss layer display time (ms)" textAlignment="CENTER"/>
</tooltip>
</Label>
<NumericSpinner fx:id="missLayerTime" editable="true" GridPane.rowIndex="8" GridPane.columnIndex="1">
<NumericSpinner fx:id="missLayerTime" editable="true" GridPane.rowIndex="10" GridPane.columnIndex="1">
<valueFactory>
<SpinnerValueFactory.IntegerSpinnerValueFactory amountToStepBy="1" initialValue="500" max="10000" min="0"/>
</valueFactory>
</NumericSpinner>

<Label text="%BGA_EXPAND" GridPane.rowIndex="9" GridPane.columnIndex="0" styleClass="optionLabel"/>
<ComboBox fx:id="bgaExpand" GridPane.rowIndex="9" GridPane.columnIndex="1">
<Label text="%BGA_EXPAND" GridPane.rowIndex="11" GridPane.columnIndex="0" styleClass="optionLabel"/>
<ComboBox fx:id="bgaExpand" GridPane.rowIndex="11" GridPane.columnIndex="1">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Full"/>
Expand Down
15 changes: 15 additions & 0 deletions core/src/bms/player/beatoraja/launcher/VideoConfigurationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@
import javafx.scene.control.Spinner;
import javafx.util.Pair;

import java.awt.*;
import java.net.URL;
import java.util.Arrays;
import java.util.ResourceBundle;

public class VideoConfigurationView implements Initializable {
@FXML
private ComboBox<Resolution> resolution;

@FXML
private CheckBox customResolution;
@FXML
private Spinner<Integer> customResolutionWidth;
@FXML
private Spinner<Integer> customResolutionHeight;

@FXML
private ComboBox<Config.DisplayMode> displayMode;
@FXML
Expand Down Expand Up @@ -49,6 +58,9 @@ public void initialize(URL location, ResourceBundle resources) {
public void update(Config config) {
displayMode.setValue(config.getDisplaymode());
resolution.setValue(config.getResolution());
customResolution.setSelected(config.isUseResolution());
customResolutionWidth.getValueFactory().setValue(config.getWindowWidth());
customResolutionHeight.getValueFactory().setValue(config.getWindowHeight());
vSync.setSelected(config.isVsync());
monitor.setValue(config.getMonitorName());
bgaOp.getSelectionModel().select(config.getBga());
Expand All @@ -62,6 +74,9 @@ public void updatePlayer(PlayerConfig player) {

public void commit(Config config) {
config.setResolution(resolution.getValue());
config.setUseResolution(customResolution.isSelected());
config.setWindowWidth(customResolutionWidth.getValue());
config.setWindowHeight(customResolutionHeight.getValue());
config.setDisplaymode(displayMode.getValue());
config.setVsync(vSync.isSelected());
config.setMonitorName(monitor.getValue());
Expand Down
1 change: 1 addition & 0 deletions core/src/bms/player/beatoraja/select/SearchTextField.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bms.player.beatoraja.select;

import bms.player.beatoraja.CustomizableResolution;
import bms.player.beatoraja.Resolution;
import bms.player.beatoraja.SpriteBatchHelper;
import bms.player.beatoraja.input.KeyBoardInputProcesseor.ControlKeys;
Expand Down
7 changes: 2 additions & 5 deletions core/src/bms/player/beatoraja/skin/Skin.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package bms.player.beatoraja.skin;

import bms.player.beatoraja.MainController;
import bms.player.beatoraja.MainState;
import bms.player.beatoraja.Resolution;
import bms.player.beatoraja.ShaderManager;
import bms.player.beatoraja.*;
import bms.player.beatoraja.SkinConfig.Offset;
import bms.player.beatoraja.skin.SkinObject.SkinOffset;
import bms.player.beatoraja.skin.property.BooleanProperty;
Expand Down Expand Up @@ -101,7 +98,7 @@ public class Skin {
public Skin(SkinHeader header) {
this.header = header;
Resolution org = header.getSourceResolution();
Resolution dst = header.getDestinationResolution();
CustomizableResolution dst = header.getDestinationResolution();
width = dst.width;
height = dst.height;
dw = ((float)dst.width) / org.width;
Expand Down
7 changes: 4 additions & 3 deletions core/src/bms/player/beatoraja/skin/SkinHeader.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package bms.player.beatoraja.skin;

import bms.player.beatoraja.CustomizableResolution;
import bms.player.beatoraja.Resolution;
import bms.player.beatoraja.SkinConfig;

Expand Down Expand Up @@ -67,7 +68,7 @@ public class SkinHeader {

private Resolution sourceResolution;

private Resolution destinationResolution;
private CustomizableResolution destinationResolution;

public SkinType getSkinType() {
return mode;
Expand Down Expand Up @@ -228,11 +229,11 @@ public void setSourceResolution(Resolution sourceResolution) {
this.sourceResolution = sourceResolution;
}

public Resolution getDestinationResolution() {
public CustomizableResolution getDestinationResolution() {
return destinationResolution;
}

public void setDestinationResolution(Resolution destinationResolution) {
public void setDestinationResolution(CustomizableResolution destinationResolution) {
this.destinationResolution = destinationResolution;
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/bms/player/beatoraja/skin/json/JSONSkinLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class JSONSkinLoader extends SkinLoader {

protected Resolution dstr;
protected CustomizableResolution dstr;
protected boolean usecim;
protected int bgaExpand = -1;

Expand Down Expand Up @@ -59,7 +59,7 @@ public JSONSkinLoader() {

public JSONSkinLoader(SkinLuaAccessor lua) {
this.lua = lua;
dstr = HD;
dstr = new CustomizableResolution(HD.width, HD.height);
usecim = false;
}

Expand All @@ -74,7 +74,7 @@ public JSONSkinLoader(MainState state, Config c) {

public JSONSkinLoader(MainState state, Config c, SkinLuaAccessor lua) {
this.lua = lua;
dstr = c.getResolution();
dstr = c.getRealResolution();
usecim = false;
bgaExpand = c.getBgaExpand();
lua.exportMainStateAccessor(state);
Expand Down
Loading