Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a option to change the size of the screenshots you take. #1480

Merged
merged 3 commits into from Jan 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class RenderingConfig {
private boolean vSync;
private boolean clampLighting;
private int fboScale = 100;
private int screenshotSize = 1;
private PerspectiveCameraSettings cameraSettings = new PerspectiveCameraSettings(CameraSetting.NORMAL);

private RenderingDebugConfig debug = new RenderingDebugConfig();
Expand Down Expand Up @@ -429,6 +430,14 @@ public void setClampLighting(boolean clampLighting) {
this.clampLighting = clampLighting;
}

public int getScreenshotSize() {
return screenshotSize;
}

public void setScreenshotSize(int screenshotSize) {
this.screenshotSize = screenshotSize;
}

@Override
public String toString() {
return Config.createGson().toJsonTree(this).toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2014 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.terasology.rendering.nui.layers.mainMenu.videoSettings;

import org.terasology.config.RenderingConfig;

public enum ScreenshotSize {

SUPER("Super Size", 0) {
@Override
public void apply(RenderingConfig config) {
config.setScreenshotSize(0);
}
},
NORMAL("Normal Size", 1) {
@Override
public void apply(RenderingConfig config) {
config.setScreenshotSize(1);
}
},
SMALL("Small Size", 2) {
@Override
public void apply(RenderingConfig config) {
config.setScreenshotSize(2);
}
},
THUMBNAIL("Thumbnail", 3) {
@Override
public void apply(RenderingConfig config) {
config.setScreenshotSize(3);
}
};


private String displayName;
private int index;

private ScreenshotSize(String displayName, int index) {
this.displayName = displayName;
this.index = index;
}

public abstract void apply(RenderingConfig config);

public int getIndex() {
return index;
}

@Override
public String toString() {
return displayName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2014 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.terasology.rendering.nui.layers.mainMenu.videoSettings;

import org.terasology.config.RenderingConfig;
import org.terasology.rendering.nui.databinding.Binding;

public class ScreenshotSizeBinding implements Binding<ScreenshotSize> {

private RenderingConfig config;

public ScreenshotSizeBinding(RenderingConfig config) {
this.config = config;
}

@Override
public ScreenshotSize get() {
if(config.getScreenshotSize() == 0) {
return ScreenshotSize.SUPER;
} else if(config.getScreenshotSize() == 1) {
return ScreenshotSize.NORMAL;
} else if(config.getScreenshotSize() == 2) {
return ScreenshotSize.SMALL;
} else if(config.getScreenshotSize() == 3) {
return ScreenshotSize.THUMBNAIL;
} else {
return ScreenshotSize.NORMAL;
}
}

@Override
public void set(ScreenshotSize value) {
value.apply(config);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public void initialise() {
waterReflection.bindSelection(new WaterReflectionBinding(config.getRendering()));
}

UIDropdown<ScreenshotSize> screenshotSize = find("screenshotSize", UIDropdown.class);
if (screenshotSize != null) {
screenshotSize.setOptions(Lists.newArrayList(ScreenshotSize.THUMBNAIL, ScreenshotSize.SMALL, ScreenshotSize.NORMAL, ScreenshotSize.SUPER));
screenshotSize.bindSelection(new ScreenshotSizeBinding(config.getRendering()));
}

UIDropdown<Integer> blur = find("blur", UIDropdown.class);
if (blur != null) {
blur.setOptions(Lists.newArrayList(0, 1, 2, 3));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,20 @@ public void takeScreenshot() {
// TODO: Used to be huge for super screenies, shrunk down for performance until size is an in-game option
overwriteRtWidth = 1152;
overwriteRtHeight = 700;

if(config.getRendering().getScreenshotSize() == 0) {
overwriteRtWidth = Display.getWidth() * 2;
overwriteRtHeight = Display.getHeight() * 2;
} else if(config.getRendering().getScreenshotSize() == 1) {
overwriteRtWidth = Display.getWidth();
overwriteRtHeight = Display.getHeight();
} else if(config.getRendering().getScreenshotSize() == 2) {
overwriteRtWidth = Display.getWidth() / 2;
overwriteRtHeight = Display.getHeight() / 2;
} else if(config.getRendering().getScreenshotSize() == 3) {
overwriteRtWidth = Display.getWidth() / 4;
overwriteRtHeight = Display.getHeight() / 4;
}
createOrUpdateFullscreenFbos();
}

Expand Down
8 changes: 8 additions & 0 deletions engine/src/main/resources/assets/ui/menu/videoMenuScreen.ui
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
"type": "UIDropdown",
"id": "graphicsPreset"
},
{
"type" : "UILabel",
"text" : "Screenshot size: "
},
{
"type": "UIDropdown",
"id" : "screenshotSize"
},
{
"type": "UILabel",
"text": "V-Sync: "
Expand Down