fix: updated to new display creation
This commit is contained in:
parent
a5ab6c385b
commit
37d383963d
|
@ -82,7 +82,17 @@ public class MovingSoundTest extends BasicTest {
|
||||||
|
|
||||||
//initialize display
|
//initialize display
|
||||||
try {
|
try {
|
||||||
Display.create(new DisplayMode(320, 240, 32, 60), 8, 24, 0, false);
|
int mode = -1;
|
||||||
|
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
||||||
|
for (int i = 0; i < modes.length; i ++) {
|
||||||
|
if( modes[i].width == 640 &&
|
||||||
|
modes[i].height == 480 &&
|
||||||
|
modes[i].bpp == 16 &&
|
||||||
|
modes[i].freq == 60) {
|
||||||
|
mode = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Display.create(modes[mode], false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
|
@ -50,12 +50,18 @@ import java.nio.*;
|
||||||
public final class Game {
|
public final class Game {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
int mode = -1;
|
||||||
System.out.println("Available display modes:");
|
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
||||||
for (int i = 0; i < modes.length; i ++)
|
for (int i = 0; i < modes.length; i ++) {
|
||||||
System.out.println(modes[i]);
|
if( modes[i].width == 640 &&
|
||||||
|
modes[i].height == 480 &&
|
||||||
|
modes[i].bpp == 16 &&
|
||||||
|
modes[i].freq == 60) {
|
||||||
|
mode = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
// For now let's just pick a mode we're certain to have
|
// For now let's just pick a mode we're certain to have
|
||||||
Display.create(new DisplayMode(640, 480, 16, 60), 8, 16, 0, true);
|
Display.create(modes[mode], false);
|
||||||
System.out.println("Created display.");
|
System.out.println("Created display.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Failed to create display due to "+e);
|
System.err.println("Failed to create display due to "+e);
|
||||||
|
|
|
@ -64,15 +64,30 @@ public class Grass {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
int mode = -1;
|
||||||
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
||||||
System.out.println("Available display modes:");
|
System.out.println("Available display modes(" + modes.length + "):");
|
||||||
for (int i = 0; i < modes.length; i ++)
|
for (int i = 0; i < modes.length; i ++) {
|
||||||
System.out.println(modes[i]);
|
//System.out.println(modes[i]);
|
||||||
|
if( modes[i].width == 640 &&
|
||||||
|
modes[i].height == 480 &&
|
||||||
|
modes[i].bpp == 16 &&
|
||||||
|
modes[i].freq == 60) {
|
||||||
|
mode = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == -1) {
|
||||||
|
System.out.println("did not find suitable mode");
|
||||||
|
} else {
|
||||||
|
System.out.println("Display mode: " + modes[mode]);
|
||||||
|
}
|
||||||
// For now let's just pick a mode we're certain to have
|
// For now let's just pick a mode we're certain to have
|
||||||
Display.create(new DisplayMode(800, 600, 16, 60), 8, 16, 0, false);
|
|
||||||
|
Display.create(modes[mode], false);
|
||||||
System.out.println("Created display.");
|
System.out.println("Created display.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("Failed to create display due to "+e);
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue