Added Bitrate Input Field for GuiRenderSettings
This commit is contained in:
@@ -87,7 +87,7 @@ public class GuiConstants {
|
|||||||
public static final int RENDER_SETTINGS_INTERPOLATION_BUTTON = 9007;
|
public static final int RENDER_SETTINGS_INTERPOLATION_BUTTON = 9007;
|
||||||
public static final int RENDER_SETTINGS_FORCECHUNKS_BUTTON = 9008;
|
public static final int RENDER_SETTINGS_FORCECHUNKS_BUTTON = 9008;
|
||||||
public static final int RENDER_SETTINGS_FRAMERATE_SLIDER = 9009;
|
public static final int RENDER_SETTINGS_FRAMERATE_SLIDER = 9009;
|
||||||
public static final int RENDER_SETTINGS_QUALITY_SLIDER = 9010;
|
public static final int RENDER_SETTINGS_BITRATE_INPUT = 9010;
|
||||||
public static final int RENDER_SETTINGS_YOUTUBE_READY = 9011;
|
public static final int RENDER_SETTINGS_YOUTUBE_READY = 9011;
|
||||||
public static final int RENDER_SETTINGS_STATIC_CAMERA = 9012;
|
public static final int RENDER_SETTINGS_STATIC_CAMERA = 9012;
|
||||||
public static final int RENDER_SETTINGS_ADVANCED_BUTTON = 9013;
|
public static final int RENDER_SETTINGS_ADVANCED_BUTTON = 9013;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
private GuiNumberInput xRes, yRes;
|
private GuiNumberInput xRes, yRes;
|
||||||
private GuiToggleButton interpolation, forceChunks;
|
private GuiToggleButton interpolation, forceChunks;
|
||||||
private GuiVideoFramerateSlider framerateSlider;
|
private GuiVideoFramerateSlider framerateSlider;
|
||||||
private GuiVideoQualitySlider qualitySlider;
|
private GuiNumberInput bitrateInput;
|
||||||
private GuiColorPicker colorPicker;
|
private GuiColorPicker colorPicker;
|
||||||
|
|
||||||
private List<GuiButton> permanentButtons = new ArrayList<GuiButton>();
|
private List<GuiButton> permanentButtons = new ArrayList<GuiButton>();
|
||||||
@@ -48,10 +48,6 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
|
|
||||||
private final Minecraft mc = Minecraft.getMinecraft();
|
private final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
public GuiRenderSettings() {
|
|
||||||
ReplayMod.replaySender.setReplaySpeed(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
if(!initialized) {
|
if(!initialized) {
|
||||||
@@ -89,7 +85,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
yRes.setCursorPositionEnd();
|
yRes.setCursorPositionEnd();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
yRes = new GuiNumberInput(GuiConstants.RENDER_SETTINGS_RESOLUTION_Y, fontRendererObj, 0, 0, 50, 1, 100000, mc.displayHeight, false) {
|
yRes = new GuiNumberInput(GuiConstants.RENDER_SETTINGS_RESOLUTION_Y, fontRendererObj, 0, 0, 50, 1, 10000, mc.displayHeight, false) {
|
||||||
@Override
|
@Override
|
||||||
public void moveCursorBy(int move) {
|
public void moveCursorBy(int move) {
|
||||||
super.moveCursorBy(move);
|
super.moveCursorBy(move);
|
||||||
@@ -107,13 +103,25 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bitrateInput = new GuiNumberInput(GuiConstants.RENDER_SETTINGS_BITRATE_INPUT, fontRendererObj, 0, 0, 50, 1D, null, 10000D, false) {
|
||||||
|
@Override
|
||||||
|
public void drawTextBox() {
|
||||||
|
int index = getCursorPosition();
|
||||||
|
String textBefore = getText();
|
||||||
|
setText(textBefore+" kbps");
|
||||||
|
setCursorPosition(index);
|
||||||
|
super.drawTextBox();
|
||||||
|
setText(textBefore);
|
||||||
|
setCursorPosition(index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
xRes.setEnabled(false);
|
xRes.setEnabled(false);
|
||||||
yRes.setEnabled(false);
|
yRes.setEnabled(false);
|
||||||
|
bitrateInput.setEnabled(true);
|
||||||
|
|
||||||
framerateSlider = new GuiVideoFramerateSlider(GuiConstants.RENDER_SETTINGS_FRAMERATE_SLIDER, 0, 0, ReplayMod.replaySettings.getVideoFramerate(),
|
framerateSlider = new GuiVideoFramerateSlider(GuiConstants.RENDER_SETTINGS_FRAMERATE_SLIDER, 0, 0, ReplayMod.replaySettings.getVideoFramerate(),
|
||||||
I18n.format("replaymod.gui.rendersettings.framerate"));
|
I18n.format("replaymod.gui.rendersettings.framerate"));
|
||||||
qualitySlider = new GuiVideoQualitySlider(GuiConstants.RENDER_SETTINGS_QUALITY_SLIDER, 0, 0, (float)ReplayMod.replaySettings.getVideoQuality(),
|
|
||||||
I18n.format("replaymod.gui.rendersettings.quality"));
|
|
||||||
|
|
||||||
interpolation = new GuiToggleButton(GuiConstants.RENDER_SETTINGS_INTERPOLATION_BUTTON, 0, 0,
|
interpolation = new GuiToggleButton(GuiConstants.RENDER_SETTINGS_INTERPOLATION_BUTTON, 0, 0,
|
||||||
I18n.format("replaymod.gui.rendersettings.interpolation")+": ",
|
I18n.format("replaymod.gui.rendersettings.interpolation")+": ",
|
||||||
@@ -128,7 +136,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
|
|
||||||
forceChunks.setValue(ReplayMod.replaySettings.getWaitForChunks() ? 0 : 1);
|
forceChunks.setValue(ReplayMod.replaySettings.getWaitForChunks() ? 0 : 1);
|
||||||
|
|
||||||
forceChunks.width = interpolation.width = framerateSlider.width = qualitySlider.width = 150;
|
forceChunks.width = interpolation.width = framerateSlider.width = 150;
|
||||||
|
|
||||||
enableGreenscreen = new GuiCheckBox(GuiConstants.RENDER_SETTINGS_ENABLE_GREENSCREEN, 0, 0, I18n.format("replaymod.gui.rendersettings.chromakey"), false);
|
enableGreenscreen = new GuiCheckBox(GuiConstants.RENDER_SETTINGS_ENABLE_GREENSCREEN, 0, 0, I18n.format("replaymod.gui.rendersettings.chromakey"), false);
|
||||||
|
|
||||||
@@ -145,7 +153,6 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
|
|
||||||
defaultButtons.add(customResolution);
|
defaultButtons.add(customResolution);
|
||||||
defaultButtons.add(framerateSlider);
|
defaultButtons.add(framerateSlider);
|
||||||
defaultButtons.add(qualitySlider);
|
|
||||||
defaultButtons.add(ignoreCamDir);
|
defaultButtons.add(ignoreCamDir);
|
||||||
defaultButtons.add(youtubeExport);
|
defaultButtons.add(youtubeExport);
|
||||||
|
|
||||||
@@ -187,12 +194,16 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
forceChunks.xPosition = interpolation.xPosition+interpolation.width+10;
|
forceChunks.xPosition = interpolation.xPosition+interpolation.width+10;
|
||||||
forceChunks.yPosition = interpolation.yPosition;
|
forceChunks.yPosition = interpolation.yPosition;
|
||||||
|
|
||||||
|
String bitrateString = I18n.format("replaymod.gui.settings.bitrate")+": ";
|
||||||
|
int bsw = fontRendererObj.getStringWidth(bitrateString);
|
||||||
|
bitrateInput.xPosition = forceChunks.xPosition + bsw;
|
||||||
|
bitrateInput.width = forceChunks.width - bsw;
|
||||||
|
|
||||||
framerateSlider.xPosition = interpolation.xPosition;
|
framerateSlider.xPosition = interpolation.xPosition;
|
||||||
qualitySlider.xPosition = forceChunks.xPosition;
|
framerateSlider.yPosition = bitrateInput.yPosition = interpolation.yPosition + 20 + 10;
|
||||||
framerateSlider.yPosition = qualitySlider.yPosition = interpolation.yPosition + 20 + 10;
|
|
||||||
|
|
||||||
ignoreCamDir.xPosition = framerateSlider.xPosition + (framerateSlider.width - ignoreCamDir.width)/2;
|
ignoreCamDir.xPosition = framerateSlider.xPosition + (framerateSlider.width - ignoreCamDir.width)/2;
|
||||||
youtubeExport.xPosition = qualitySlider.xPosition + (qualitySlider.width - youtubeExport.width)/2;
|
youtubeExport.xPosition = bitrateInput.xPosition + (bitrateInput.width - youtubeExport.width)/2;
|
||||||
|
|
||||||
ignoreCamDir.yPosition = youtubeExport.yPosition = framerateSlider.yPosition+20+10;
|
ignoreCamDir.yPosition = youtubeExport.yPosition = framerateSlider.yPosition+20+10;
|
||||||
|
|
||||||
@@ -244,8 +255,12 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
|
|
||||||
xRes.drawTextBox();
|
xRes.drawTextBox();
|
||||||
yRes.drawTextBox();
|
yRes.drawTextBox();
|
||||||
|
bitrateInput.drawTextBox();
|
||||||
this.drawString(fontRendererObj, "*", xRes.xPosition + xRes.width + 5, xRes.yPosition + 3, Color.WHITE.getRGB());
|
this.drawString(fontRendererObj, "*", xRes.xPosition + xRes.width + 5, xRes.yPosition + 3, Color.WHITE.getRGB());
|
||||||
|
|
||||||
|
String bitrateString = I18n.format("replaymod.gui.settings.bitrate")+": ";
|
||||||
|
this.drawString(fontRendererObj, bitrateString, forceChunks.xPosition, bitrateInput.yPosition + 6, Color.WHITE.getRGB());
|
||||||
|
|
||||||
rendererDropdown.drawTextBox();
|
rendererDropdown.drawTextBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,6 +270,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
if(!rendererDropdown.mouseClickedResult(mouseX, mouseY)) {
|
if(!rendererDropdown.mouseClickedResult(mouseX, mouseY)) {
|
||||||
xRes.mouseClicked(mouseX, mouseY, mouseButton);
|
xRes.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
yRes.mouseClicked(mouseX, mouseY, mouseButton);
|
yRes.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
bitrateInput.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
if(mouseButton == 0) {
|
if(mouseButton == 0) {
|
||||||
List<GuiButton> toHandle = new ArrayList<GuiButton>();
|
List<GuiButton> toHandle = new ArrayList<GuiButton>();
|
||||||
@@ -275,7 +291,6 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
@Override
|
@Override
|
||||||
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
protected void mouseReleased(int mouseX, int mouseY, int state) {
|
||||||
framerateSlider.mouseReleased(mouseX, mouseY);
|
framerateSlider.mouseReleased(mouseX, mouseY);
|
||||||
qualitySlider.mouseReleased(mouseX, mouseY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -299,6 +314,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
}
|
}
|
||||||
xRes.textboxKeyTyped(typedChar, keyCode);
|
xRes.textboxKeyTyped(typedChar, keyCode);
|
||||||
yRes.textboxKeyTyped(typedChar, keyCode);
|
yRes.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
bitrateInput.textboxKeyTyped(typedChar, keyCode);
|
||||||
super.keyTyped(typedChar, keyCode);
|
super.keyTyped(typedChar, keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,6 +322,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
public void updateScreen() {
|
public void updateScreen() {
|
||||||
xRes.updateCursorCounter();
|
xRes.updateCursorCounter();
|
||||||
yRes.updateCursorCounter();
|
yRes.updateCursorCounter();
|
||||||
|
bitrateInput.updateCursorCounter();
|
||||||
super.updateScreen();
|
super.updateScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,8 +407,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
options.setFps(framerateSlider.getFPS());
|
options.setFps(framerateSlider.getFPS());
|
||||||
ReplayMod.replaySettings.setVideoFramerate(framerateSlider.getFPS());
|
ReplayMod.replaySettings.setVideoFramerate(framerateSlider.getFPS());
|
||||||
|
|
||||||
//TODO options.setQuality(qualitySlider.getQuality());
|
options.setBitrate(bitrateInput.getIntValue() + "K"); //Bitrate value is in Kilobytes
|
||||||
ReplayMod.replaySettings.setVideoQuality(qualitySlider.getQuality());
|
|
||||||
|
|
||||||
if(enableGreenscreen.isChecked()) {
|
if(enableGreenscreen.isChecked()) {
|
||||||
options.setSkyColor(colorPicker.getPickedColor());
|
options.setSkyColor(colorPicker.getPickedColor());
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ replaymod.gui.settings.title=Replay Mod Settings
|
|||||||
replaymod.gui.settings.interpolation.linear=Linear
|
replaymod.gui.settings.interpolation.linear=Linear
|
||||||
replaymod.gui.settings.interpolation.cubic=Cubic
|
replaymod.gui.settings.interpolation.cubic=Cubic
|
||||||
|
|
||||||
replaymod.gui.settings.quality=Video Quality
|
replaymod.gui.settings.bitrate=Video Bitrate
|
||||||
replaymod.gui.settings.framerate=Video Framerate
|
replaymod.gui.settings.framerate=Video Framerate
|
||||||
replaymod.gui.settings.notifications=Enable Notifications
|
replaymod.gui.settings.notifications=Enable Notifications
|
||||||
replaymod.gui.settings.recordserver=Record Server
|
replaymod.gui.settings.recordserver=Record Server
|
||||||
|
|||||||
Reference in New Issue
Block a user