Move graphics initialization code around in method

This commit is contained in:
JeremyStar™ 2024-07-25 04:14:17 +02:00
parent f5af9b34a0
commit 24e26e6a82
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -217,10 +217,15 @@ public final class GraphicsSubsystem implements SubsystemMainClass {
} else } else
logger.diag(apiName + " is incompatible with this system"); logger.diag(apiName + " is incompatible with this system");
logger.diag("Compatible is/are " + ListFormatter.formatList(compatibleApis)); if (compatibleApis.isEmpty()) {
logger.error("No compatible Graphics API was found");
return false;
} else if (compatibleApis.size() == 1)
logger.diag("Compatible is " + compatibleApis.getFirst());
else
logger.diag("Compatible are " + ListFormatter.formatList(compatibleApis));
// Choose last item in list. // Choose last item in list.
if (!compatibleApis.isEmpty()) {
api = registeredApis.get(compatibleApis.getLast()); api = registeredApis.get(compatibleApis.getLast());
try { try {
logger.diag("Initializing Graphics API"); logger.diag("Initializing Graphics API");
@ -231,10 +236,6 @@ public final class GraphicsSubsystem implements SubsystemMainClass {
} }
return true; return true;
} else {
logger.error("No compatible Graphics API was found");
return false;
}
} }
/** /**