Skip to content

Commit e233ba3

Browse files
committed
Implemented a setting of OpenGL version.
1 parent cb585dc commit e233ba3

14 files changed

Lines changed: 272 additions & 35 deletions

File tree

.idea/runConfigurations/Editor.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/messages/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ SettingsDialogTabGraphics=Graphics
109109
SettingsDialogTabOther=Other
110110
SettingsDialogClasspathFolderLabel=Classpath folder
111111
SettingsDialogThemeLabel=Theme
112+
SettingsDialogOpenGLLabel=OpenGL
112113
SettingsDialogClasspathFolderChooserTitle=Select folder with .jar's
113114
SettingsDialogEnvsFolderLabel=Environment folder
114115
SettingsDialogEnvsFolderChooserTitle=Select a folder with environment textures

resources/messages/messages_de.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ SettingsDialogTabGraphics=Grafik
109109
SettingsDialogTabOther=Weitere
110110
SettingsDialogClasspathFolderLabel=Verzeichnis classpath
111111
SettingsDialogThemeLabel=Theme
112+
SettingsDialogOpenGLLabel=OpenGL
112113
SettingsDialogClasspathFolderChooserTitle=Wählen Sie Verzeichnis mit .jar-Dateien
113114
SettingsDialogEnvsFolderLabel=Verzeichnis mit Umgebungstexturen
114115
SettingsDialogEnvsFolderChooserTitle=Wählen Sie Verzeichnis mit Umgebungstexturen

resources/messages/messages_ru.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ SettingsDialogTabGraphics=Графика
110110
SettingsDialogTabOther=Остальные
111111
SettingsDialogClasspathFolderLabel=Папка classpath
112112
SettingsDialogThemeLabel=Тема
113+
SettingsDialogOpenGLLabel=OpenGL
113114
SettingsDialogClasspathFolderChooserTitle=Выберите папку с .jar'ками
114115
SettingsDialogEnvsFolderLabel=Папка текст. окруж.
115116
SettingsDialogEnvsFolderChooserTitle=Выберите папку с текстурами окружения

src/com/ss/editor/JFXApplication.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.ss.editor.ui.component.log.LogView;
2121
import com.ss.editor.ui.dialog.ConfirmDialog;
2222
import com.ss.editor.ui.scene.EditorFXScene;
23+
import com.ss.editor.util.OpenGLVersion;
2324
import de.codecentric.centerdevice.javafxsvg.SvgImageLoaderFactory;
2425
import javafx.application.Application;
2526
import javafx.application.Platform;
@@ -84,6 +85,11 @@ public static void main(final String[] args) throws IOException {
8485
System.setProperty("prism.lcdtext", "false");
8586
System.setProperty("prism.text", "t2k");
8687

88+
final EditorConfig editorConfig = EditorConfig.getInstance();
89+
final OpenGLVersion openGLVersion = editorConfig.getOpenGLVersion();
90+
91+
System.setProperty("jfx.background.render", openGLVersion.getRender());
92+
8793
// some settings for the render of JavaFX
8894
//System.setProperty("prism.cacheshapes", "true");
8995
//System.setProperty("prism.scrollcacheopt", "true");

src/com/ss/editor/Messages.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ public class Messages {
409409
* The constant SETTINGS_DIALOG_THEME_LABEL.
410410
*/
411411
public static final String SETTINGS_DIALOG_THEME_LABEL;
412+
/**
413+
* The constant SETTINGS_DIALOG_OPEN_GL_LABEL.
414+
*/
415+
public static final String SETTINGS_DIALOG_OPEN_GL_LABEL;
412416
/**
413417
* The constant SETTINGS_DIALOG_CLASSPATH_FOLDER_CHOOSER_TITLE.
414418
*/
@@ -2406,6 +2410,7 @@ public class Messages {
24062410
SETTINGS_DIALOG_TAB_OTHER = bundle.getString("SettingsDialogTabOther");
24072411
SETTINGS_DIALOG_CLASSPATH_FOLDER_LABEL = bundle.getString("SettingsDialogClasspathFolderLabel");
24082412
SETTINGS_DIALOG_THEME_LABEL = bundle.getString("SettingsDialogThemeLabel");
2413+
SETTINGS_DIALOG_OPEN_GL_LABEL = bundle.getString("SettingsDialogOpenGLLabel");
24092414
SETTINGS_DIALOG_CLASSPATH_FOLDER_CHOOSER_TITLE = bundle.getString("SettingsDialogClasspathFolderChooserTitle");
24102415
SETTINGS_DIALOG_ENVS_FOLDER_LABEL = bundle.getString("SettingsDialogEnvsFolderLabel");
24112416
SETTINGS_DIALOG_ENVS_FOLDER_CHOOSER_TITLE = bundle.getString("SettingsDialogEnvsFolderChooserTitle");

src/com/ss/editor/analytics/google/GAnalytics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private static void doSend(@NotNull final Map<String, Object> parameters) {
251251

252252
final String distribution = operatingSystem.getDistribution();
253253
final String os = StringUtils.isEmpty(distribution) ? operatingSystem.getName() + " " + operatingSystem.getVersion() : distribution;
254-
final String appVersion = Config.VERSION;
254+
final String appVersion = Config.STRING_VERSION;
255255
final String language = Locale.getDefault().toString();
256256
final String userId = Utils.getUserName();
257257
final String javaVersion = System.getProperty("java.vm.name", "unknown") + " " +

src/com/ss/editor/config/Config.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.ss.editor.Editor;
44
import com.ss.editor.document.DocumentConfig;
5+
import com.ss.editor.util.AppVersion;
56
import com.ss.editor.util.EditorUtil;
67
import org.jetbrains.annotations.NotNull;
78
import com.ss.rlib.util.Utils;
@@ -32,10 +33,16 @@ public abstract class Config {
3233
public static final String TITLE = "jME3 SpaceShift Editor";
3334

3435
/**
35-
* The constant VERSION.
36+
* The constant APP_VERSION.
3637
*/
3738
@NotNull
38-
public static final String VERSION = "v.0.9.10";
39+
public static final AppVersion APP_VERSION = new AppVersion("0.9.10");
40+
41+
/**
42+
* The constant STRING_VERSION.
43+
*/
44+
@NotNull
45+
public static final String STRING_VERSION = APP_VERSION.toString();
3946

4047
/**
4148
* The path to application folder.

src/com/ss/editor/config/EditorConfig.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.ss.editor.config;
22

3+
import static com.ss.editor.util.OpenGLVersion.GL_32;
34
import static com.ss.rlib.util.ObjectUtils.notNull;
45
import static com.ss.rlib.util.Utils.get;
56
import com.jme3.asset.AssetEventListener;
@@ -12,6 +13,7 @@
1213
import com.ss.editor.annotation.FromAnyThread;
1314
import com.ss.editor.ui.css.CssColorTheme;
1415
import com.ss.editor.util.EditorUtil;
16+
import com.ss.editor.util.OpenGLVersion;
1517
import com.ss.rlib.logging.Logger;
1618
import com.ss.rlib.logging.LoggerManager;
1719
import org.jetbrains.annotations.NotNull;
@@ -51,6 +53,7 @@ public final class EditorConfig implements AssetEventListener {
5153
private static final String PREF_SCREEN_HEIGHT = SCREEN_ALIAS + "." + "screenHeight";
5254
private static final String PREF_SCREEN_MAXIMIZED = SCREEN_ALIAS + "." + "screenMaximized";
5355

56+
private static final String PREF_GRAPHIC_OPEN_GL = GRAPHICS_ALIAS + "." + "openGL";
5457
private static final String PREF_GRAPHIC_ANISOTROPY = GRAPHICS_ALIAS + "." + "anisotropy";
5558
private static final String PREF_GRAPHIC_FRAME_RATE = GRAPHICS_ALIAS + "." + "frameRate";
5659
private static final String PREF_GRAPHIC_CAMERA_ANGLE = GRAPHICS_ALIAS + "." + "cameraAngle";
@@ -69,7 +72,7 @@ public final class EditorConfig implements AssetEventListener {
6972
private static final String PREF_AUTO_TANGENT_GENERATING = ASSET_EDITING + "." + "autoTangentGenerating";
7073
private static final String PREF_DEFAULT_USE_FLIPPED_TEXTURE = ASSET_EDITING + "." + "defaultUseFlippedTexture";
7174
private static final String PREF_CAMERA_LAMP_ENABLED = ASSET_EDITING + "." + "defaultCameraLampEnabled";
72-
private static final String PREF_ANALYTICS_QUESTION = ASSET_OTHER + "." + "analyticsQuestion" + Config.VERSION;
75+
private static final String PREF_ANALYTICS_QUESTION = ASSET_OTHER + "." + "analyticsQuestion" + Config.STRING_VERSION;
7376

7477
private static final String PREF_GLOBAL_LEFT_TOOL_WIDTH = ASSET_OTHER + "." + "globalLeftToolWidth";
7578
private static final String PREF_GLOBAL_LEFT_TOOL_COLLAPSED = ASSET_OTHER + "." + "globalLeftToolCollapsed";
@@ -116,6 +119,12 @@ public static EditorConfig getInstance() {
116119
@Nullable
117120
private volatile Path currentAsset;
118121

122+
/**
123+
* The current open GL version.
124+
*/
125+
@Nullable
126+
private volatile OpenGLVersion openGLVersion;
127+
119128
/**
120129
* The path to the folder with additional classpath.
121130
*/
@@ -730,6 +739,21 @@ public void setTheme(@NotNull final CssColorTheme theme) {
730739
this.theme = theme.ordinal();
731740
}
732741

742+
/**
743+
* @return the current open GL version.
744+
*/
745+
@NotNull
746+
public OpenGLVersion getOpenGLVersion() {
747+
return notNull(openGLVersion);
748+
}
749+
750+
/**
751+
* @param openGLVersion the current open GL version.
752+
*/
753+
public void setOpenGLVersion(@NotNull final OpenGLVersion openGLVersion) {
754+
this.openGLVersion = openGLVersion;
755+
}
756+
733757
/**
734758
* Gets settings.
735759
*
@@ -794,6 +818,7 @@ private void init() {
794818
this.defaultEditorCameraEnabled = prefs.getBoolean(PREF_CAMERA_LAMP_ENABLED, true);
795819
this.analyticsQuestion = prefs.getBoolean(PREF_ANALYTICS_QUESTION, false);
796820
this.theme = prefs.getInt(PREF_THEME, CssColorTheme.DARK.ordinal());
821+
this.openGLVersion = OpenGLVersion.valueOf(prefs.getInt(PREF_GRAPHIC_OPEN_GL, GL_32.ordinal()));
797822

798823
final String currentAssetURI = prefs.get(PREF_CURRENT_ASSET, null);
799824

@@ -867,6 +892,7 @@ public synchronized void save() {
867892
prefs.putBoolean(PREF_CAMERA_LAMP_ENABLED, isDefaultEditorCameraEnabled());
868893
prefs.putBoolean(PREF_ANALYTICS_QUESTION, isAnalyticsQuestion());
869894
prefs.putInt(PREF_THEME, getTheme().ordinal());
895+
prefs.putInt(PREF_GRAPHIC_OPEN_GL, getOpenGLVersion().ordinal());
870896

871897
final Vector3f whitePoint = getToneMapFilterWhitePoint();
872898

src/com/ss/editor/task/CheckNewVersionTask.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.ss.editor.JFXApplication;
55
import com.ss.editor.Messages;
66
import com.ss.editor.config.Config;
7+
import com.ss.editor.util.AppVersion;
78
import javafx.application.HostServices;
89
import javafx.application.Platform;
910
import javafx.scene.control.Alert;
@@ -58,9 +59,11 @@ public void run() {
5859
Header encoding = entity.getContentEncoding();
5960
String enc = encoding == null ? "UTF-8" : encoding.getValue();
6061

61-
final String targetVersion = IOUtils.toString(content, enc).trim();
62+
final String targetVersion = IOUtils.toString(content, enc)
63+
.trim()
64+
.replace("v.", "");
6265

63-
if (Config.VERSION.equals(targetVersion)) {
66+
if (Config.APP_VERSION.compareTo(new AppVersion(targetVersion)) <= 0) {
6467
return;
6568
}
6669

0 commit comments

Comments
 (0)