Skip to content

Commit 8ddb04b

Browse files
committed
changing naming to "Display" instead of "Monitor"
1 parent d8d827b commit 8ddb04b

File tree

17 files changed

+290
-79
lines changed

17 files changed

+290
-79
lines changed

jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,13 @@ private Rect getSurfaceFrame() {
557557
}
558558

559559
@Override
560-
public Monitors getMonitors() {
560+
public Displays getDisplays() {
561561
// TODO Auto-generated method stub
562562
return null;
563563
}
564564

565565
@Override
566-
public int getPrimaryMonitor() {
566+
public int getPrimaryDisplay() {
567567
// TODO Auto-generated method stub
568568
return 0;
569569
}

jme3-core/src/main/java/com/jme3/app/LegacyApplication.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.jme3.renderer.Renderer;
5151
import com.jme3.renderer.ViewPort;
5252
import com.jme3.system.AppSettings;
53+
import com.jme3.system.Displays;
5354
import com.jme3.system.JmeContext;
5455
import com.jme3.system.JmeContext.Type;
5556
import com.jme3.system.JmeSystem;
@@ -882,4 +883,29 @@ public Object call() {
882883
return null;
883884
}
884885
}
886+
887+
888+
/**
889+
* This call will return a list of Monitors that glfwGetMonitors()
890+
* returns and information about the monitor, like width, height,
891+
* and refresh rate.
892+
*
893+
* @return returns a list of monitors and their information.
894+
*/
895+
public Displays getDisplays()
896+
{
897+
return context.getDisplays();
898+
}
899+
900+
/**
901+
* Use this to get the positional number of the primary
902+
* monitor from the glfwGetMonitors() function call.
903+
*
904+
* @return the position of the value in the arraylist of
905+
* the primary monitor.
906+
*/
907+
public int getPrimaryDisplay()
908+
{
909+
return context.getPrimaryDisplay();
910+
}
885911
}

jme3-core/src/main/java/com/jme3/system/AppSettings.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public final class AppSettings extends HashMap<String, Object> {
266266
public static final String JOAL = "JOAL";
267267

268268
static {
269-
defaults.put("Monitor", 0);
269+
defaults.put("Display", 0);
270270
defaults.put("CenterWindow", true);
271271
defaults.put("Width", 640);
272272
defaults.put("Height", 480);
@@ -1483,31 +1483,30 @@ public void setWindowYPosition(int pos) {
14831483

14841484

14851485
/**
1486-
* Gets the monitor number used when creating a window.
1486+
* Gets the display number used when creating a window.
14871487
*
14881488
* <p>
1489-
* This setting is used only with LWJGL3, it defines which monitor to use when creating a OpenGL
1489+
* This setting is used only with LWJGL3, it defines which display to use when creating a OpenGL
14901490
* window.
14911491
*
1492-
* @return the desired monitor used when creating a OpenGL window
1493-
* @see #setMonitor(long)
1492+
* @return the desired display used when creating a OpenGL window
14941493
*/
1495-
public int getMonitor() {
1496-
return getInteger("Monitor");
1494+
public int getDisplay() {
1495+
return getInteger("Display");
14971496
}
14981497

14991498
/**
1500-
* Sets the monitor number used when creating a window. The position number is the number in the
1499+
* Sets the display number used when creating a window. The position number is the number in the
15011500
* list of monitors GlfwGetMonitors returns.
15021501
*
15031502
* <p>
1504-
* This setting is used only with LWJGL3, it defines which monitor to use when creating a OpenGL
1503+
* This setting is used only with LWJGL3, it defines which display to use when creating a OpenGL
15051504
* window. its default value is 0.
15061505
*
1507-
* @param mon the desired monitor used when creating a OpenGL window
1506+
* @param mon the desired display used when creating a OpenGL window
15081507
*
15091508
*/
1510-
public void setMonitor(int mon) {
1511-
putInteger("Monitor", mon);
1509+
public void setDisplay(int mon) {
1510+
putInteger("Display", mon);
15121511
}
15131512
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2009-2023 jMonkeyEngine All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without modification, are permitted
5+
* provided that the following conditions are met:
6+
*
7+
* * Redistributions of source code must retain the above copyright notice, this list of conditions
8+
* and the following disclaimer.
9+
*
10+
* * Redistributions in binary form must reproduce the above copyright notice, this list of
11+
* conditions and the following disclaimer in the documentation and/or other materials provided with
12+
* the distribution.
13+
*
14+
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors may be used to endorse or
15+
* promote products derived from this software without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
24+
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
package com.jme3.system;
27+
28+
/**
29+
* This class holds information about the display that was returned by glfwGetMonitors() calls in
30+
* the context class
31+
*
32+
* @author Kevin Bales
33+
*/
34+
public class DisplayInfo {
35+
36+
/**
37+
* displayID - display id that was return from Lwjgl3.
38+
*/
39+
public long displayID = 0;
40+
41+
/**
42+
* width - width that was return from Lwjgl3.
43+
*/
44+
public int width = 1080;
45+
46+
/**
47+
* height - height that was return from Lwjgl3.
48+
*/
49+
public int height = 1920;
50+
51+
/**
52+
* rate - refresh rate that was return from Lwjgl3.
53+
*/
54+
public int rate = 60;
55+
56+
/**
57+
* primary - indicates if the display is the primary monitor.
58+
*/
59+
public boolean primary = false;
60+
61+
/**
62+
* name - display name that was return from Lwjgl3.
63+
*/
64+
public String name = "Generic Monitor";
65+
66+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* Copyright (c) 2009-2023 jMonkeyEngine All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without modification, are permitted
5+
* provided that the following conditions are met:
6+
*
7+
* * Redistributions of source code must retain the above copyright notice, this list of conditions
8+
* and the following disclaimer.
9+
*
10+
* * Redistributions in binary form must reproduce the above copyright notice, this list of
11+
* conditions and the following disclaimer in the documentation and/or other materials provided with
12+
* the distribution.
13+
*
14+
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors may be used to endorse or
15+
* promote products derived from this software without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
24+
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
package com.jme3.system;
27+
28+
import java.util.ArrayList;
29+
30+
/**
31+
* This class holds all information about all displays that where return from the glfwGetMonitors()
32+
* call. It stores them into an ArrayList
33+
*
34+
* @author Kevin Bales
35+
*/
36+
public class Displays {
37+
38+
private ArrayList<DisplayInfo> displays = new ArrayList<DisplayInfo>();
39+
40+
public int addNewMonitor(long displaysID) {
41+
DisplayInfo info = new DisplayInfo();
42+
info.displayID = displaysID;
43+
displays.add(info);
44+
return displays.size() - 1;
45+
}
46+
47+
/**
48+
* This function returns the size of the display ArrayList
49+
*
50+
* @return the
51+
*/
52+
public int size() {
53+
return displays.size();
54+
}
55+
56+
/**
57+
* Call to get display information on a certain display.
58+
*
59+
* @param pos the position in the ArrayList of the display information that you want to get.
60+
* @return returns the DisplayInfo data for the display called for.
61+
*/
62+
public DisplayInfo get(int pos) {
63+
if (pos < displays.size())
64+
return displays.get(pos);
65+
66+
return null;
67+
}
68+
69+
/**
70+
* Set information about this display stored in displayPos display in the array list.
71+
*
72+
* @param displayPos ArrayList position of display to update
73+
* @param name name of the display
74+
* @param width the current width the display is displaying
75+
* @param height the current height the display is displaying
76+
* @param rate the current refresh rate the display is set to
77+
*/
78+
public void setInfo(int displayPos, String name, int width, int height, int rate) {
79+
if (displayPos < displays.size()) {
80+
DisplayInfo info = displays.get(displayPos);
81+
if (info != null) {
82+
info.width = width;
83+
info.height = height;
84+
info.rate = rate;
85+
info.name = name;
86+
}
87+
}
88+
}
89+
90+
/**
91+
* This function will mark a certain display as the primary display.
92+
*
93+
* @param displayPos the position in the ArrayList of which display is the primary display
94+
*/
95+
public void setPrimaryDisplay(int displayPos) {
96+
if (displayPos < displays.size()) {
97+
DisplayInfo info = displays.get(displayPos);
98+
if (info != null)
99+
info.primary = true;
100+
}
101+
102+
}
103+
104+
105+
106+
}

jme3-core/src/main/java/com/jme3/system/JmeContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ public enum Type {
232232
*
233233
* @return returns a list of monitors and their information.
234234
*/
235-
public Monitors getMonitors();
235+
public Displays getDisplays();
236236

237237
/**
238238
* Use this to get the positional number of the primary monitor from the glfwGetMonitors()
239239
* function call.
240240
*
241241
* @return the position of the value in the arraylist of the primary monitor.
242242
*/
243-
public int getPrimaryMonitor();
243+
public int getPrimaryDisplay();
244244
}

jme3-core/src/main/java/com/jme3/system/NullContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,13 @@ public int getWindowYPosition() {
308308
}
309309

310310
@Override
311-
public Monitors getMonitors() {
311+
public Displays getDisplays() {
312312
// TODO Auto-generated method stub
313313
return null;
314314
}
315315

316316
@Override
317-
public int getPrimaryMonitor() {
317+
public int getPrimaryDisplay() {
318318
// TODO Auto-generated method stub
319319
return 0;
320320
}

jme3-desktop/src/main/java/com/jme3/system/AWTContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ public int getWindowYPosition() {
277277
}
278278

279279
@Override
280-
public Monitors getMonitors() {
280+
public Displays getDisplays() {
281281
// TODO Auto-generated method stub
282282
return null;
283283
}
284284

285285
@Override
286-
public int getPrimaryMonitor() {
286+
public int getPrimaryDisplay() {
287287
// TODO Auto-generated method stub
288288
return 0;
289289
}

jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanelsContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@ public int getWindowYPosition() {
330330
}
331331

332332
@Override
333-
public Monitors getMonitors() {
333+
public Displays getDisplays() {
334334
// TODO Auto-generated method stub
335335
return null;
336336
}
337337

338338
@Override
339-
public int getPrimaryMonitor() {
339+
public int getPrimaryDisplay() {
340340
// TODO Auto-generated method stub
341341
return 0;
342342
}

0 commit comments

Comments
 (0)