Fix mapping into Java enums.

The values are bitmask not contiguous, so we need to use a switch instead
of an array.
This commit is contained in:
Peter Johnson
2016-11-18 10:44:31 -08:00
parent 5ace9e4189
commit e1f4e3d2d7
5 changed files with 58 additions and 10 deletions

View File

@@ -23,8 +23,12 @@ public class VideoMode {
}
private static final PixelFormat[] m_pixelFormatValues = PixelFormat.values();
public static PixelFormat getPixelFormatFromInt(int pixelFormat) {
return m_pixelFormatValues[pixelFormat];
}
public VideoMode(int pixelFormat, int width, int height, int fps) {
this.pixelFormat = m_pixelFormatValues[pixelFormat];
this.pixelFormat = getPixelFormatFromInt(pixelFormat);
this.width = width;
this.height = height;
this.fps = fps;