Search in sources :

Example 1 with SurfaceSize

use of com.jogamp.nativewindow.util.SurfaceSize in project narchy by automenta.

the class VID method initModeList.

static void initModeList() {
    final List<MonitorMode> modes = re.getModeList();
    final ArrayList<String> fs_resolutions_list = new ArrayList<>();
    final ArrayList<vidmode_t> fs_modes_list = new ArrayList<>();
    final HashSet<DimensionImmutable> resSet = new HashSet<>();
    for (int i = 0; i < modes.size(); i++) {
        // reverse order: low -> high res.
        final MonitorMode mm = modes.get(modes.size() - 1 - i);
        final SurfaceSize ss = mm.getSurfaceSize();
        final DimensionImmutable m = ss.getResolution();
        if (resSet.add(m)) {
            final StringBuilder sb = new StringBuilder();
            sb.append('[');
            sb.append(m.getWidth());
            sb.append(' ');
            sb.append(m.getHeight());
            while (sb.length() < 10) sb.append(' ');
            sb.append(']');
            fs_resolutions_list.add(sb.toString());
            sb.setLength(0);
            sb.append("Mode ");
            sb.append(i);
            sb.append(':');
            sb.append(m.getWidth());
            sb.append('x');
            sb.append(m.getHeight());
            fs_modes_list.add(new vidmode_t(sb.toString(), m.getWidth(), m.getHeight(), i));
        }
    }
    fs_resolutions = new String[fs_resolutions_list.size()];
    fs_modes = new vidmode_t[fs_modes_list.size()];
    fs_resolutions_list.toArray(fs_resolutions);
    fs_modes_list.toArray(fs_modes);
}
Also used : DimensionImmutable(com.jogamp.nativewindow.util.DimensionImmutable) SurfaceSize(com.jogamp.nativewindow.util.SurfaceSize) ArrayList(java.util.ArrayList) MonitorMode(com.jogamp.newt.MonitorMode) HashSet(java.util.HashSet)

Example 2 with SurfaceSize

use of com.jogamp.nativewindow.util.SurfaceSize in project narchy by automenta.

the class NEWTWin method getModeString.

public static String getModeString(MonitorMode mm) {
    final SurfaceSize ss = mm.getSurfaceSize();
    final DimensionImmutable m = ss.getResolution();
    final StringBuilder sb = new StringBuilder();
    sb.append(m.getWidth());
    sb.append('x');
    sb.append(m.getHeight());
    sb.append('x');
    sb.append(ss.getBitsPerPixel());
    sb.append('@');
    sb.append(mm.getRefreshRate());
    sb.append("Hz");
    return sb.toString();
}
Also used : SurfaceSize(com.jogamp.nativewindow.util.SurfaceSize) DimensionImmutable(com.jogamp.nativewindow.util.DimensionImmutable)

Aggregations

DimensionImmutable (com.jogamp.nativewindow.util.DimensionImmutable)2 SurfaceSize (com.jogamp.nativewindow.util.SurfaceSize)2 MonitorMode (com.jogamp.newt.MonitorMode)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1