Skip to content

Commit

Permalink
fix: Get the game running on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
crykn committed Mar 10, 2024
1 parent fe8e68a commit b8c7d92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions desktop/src/main/java/de/eskalon/gg/desktop/DesktopLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ public static void main(String[] args) {

/* libGDX config */
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setTitle(ProjektGGApplication.GAME_NAME);
config.setWindowedMode(1280, 720);
config.setForegroundFPS(120);
config.setOpenGLEmulation(
Lwjgl3ApplicationConfiguration.GLEmulation.GL30, 3, 2);
config.setResizable(false);
config.setTitle(ProjektGGApplication.GAME_NAME);
config.useVsync(false);
config.setForegroundFPS(120);
config.setWindowedMode(1280, 720);
config.setWindowIcon(FileType.Internal, "icon16.png", "icon32.png",
"icon48.png");

Expand All @@ -62,7 +64,7 @@ public static void main(String[] args) {
e.printStackTrace();
System.exit(-1);
}
});
}, args);
}

}
6 changes: 6 additions & 0 deletions game/src/main/java/de/eskalon/gg/misc/ImGuiRenderer.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package de.eskalon.gg.misc;

import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics;
import com.badlogic.gdx.scenes.scene2d.utils.UIUtils;

import de.damios.guacamole.Preconditions;
import imgui.ImGui;
Expand All @@ -25,6 +27,10 @@ private ImGuiRenderer() {
public static void init() {
Preconditions.checkState(imGuiGlfw == null && imGuiGl3 == null,
"ImGuiRenderer was already initialised. Call dispose() first!");
Preconditions.checkState(!(Gdx.app.getType() == ApplicationType.Desktop
|| Gdx.app.getType() == ApplicationType.HeadlessDesktop)
|| !UIUtils.isMac || Gdx.gl30 != null,
"ImGUI requires OpenGL >= 3.0. Since the default OpenGL profile on macOS only supports 2.1, the 3.2 core profile needs to be enabled via Lwjgl3ApplicationConfiguration#setOpenGLEmulation(Lwjgl3ApplicationConfiguration.GLEmulation.GL30, 3, 2).");

imGuiGlfw = new ImGuiImplGlfw();
imGuiGl3 = new ImGuiImplGl3();
Expand Down

0 comments on commit b8c7d92

Please sign in to comment.