diff --git a/desktop/build.gradle b/desktop/build.gradle index 6149b845a2..86baa7fd1b 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -5,6 +5,7 @@ sourceSets.main.java.srcDirs = [ "src/" ] project.ext.mainClassName = "com.unciv.app.desktop.DesktopLauncher" project.ext.assetsDir = new File("../android/assets") +project.ext.discordDir = new File("discord_rpc") task run(dependsOn: classes, type: JavaExec) { main = project.mainClassName @@ -29,6 +30,8 @@ task dist(type: Jar) { // see Laurent1967's comment on https://github.com/libgdx/libgdx/issues/5491 from {configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }} from files(project.assetsDir) + // This is for the .dll and .so files to ake the Discord RPC work on all desktops + from files(project.discordDir) archiveFileName = "${appName}.jar" manifest { diff --git a/desktop/discord_rpc/darwin/libdiscord-rpc.dylib b/desktop/discord_rpc/darwin/libdiscord-rpc.dylib new file mode 100644 index 0000000000..b48f5616cd Binary files /dev/null and b/desktop/discord_rpc/darwin/libdiscord-rpc.dylib differ diff --git a/desktop/discord_rpc/linux-x86-64/libdiscord-rpc.so b/desktop/discord_rpc/linux-x86-64/libdiscord-rpc.so new file mode 100644 index 0000000000..43f56c753e Binary files /dev/null and b/desktop/discord_rpc/linux-x86-64/libdiscord-rpc.so differ diff --git a/desktop/discord_rpc/win32-x86-64/discord-rpc.dll b/desktop/discord_rpc/win32-x86-64/discord-rpc.dll new file mode 100644 index 0000000000..289d550306 Binary files /dev/null and b/desktop/discord_rpc/win32-x86-64/discord-rpc.dll differ diff --git a/desktop/discord_rpc/win32-x86/discord-rpc.dll b/desktop/discord_rpc/win32-x86/discord-rpc.dll new file mode 100644 index 0000000000..4254cfa278 Binary files /dev/null and b/desktop/discord_rpc/win32-x86/discord-rpc.dll differ diff --git a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt index 73b33bc2e9..da34f5e42f 100644 --- a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt +++ b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt @@ -16,36 +16,37 @@ import kotlin.concurrent.thread internal object DesktopLauncher { @JvmStatic fun main(arg: Array) { - - if (File("../Images").exists()) { // So we don't run this from within a fat JAR - val settings = TexturePacker.Settings() - // Apparently some chipsets, like NVIDIA Tegra 3 graphics chipset (used in Asus TF700T tablet), - // don't support non-power-of-two texture sizes - kudos @yuroller! - // https://github.com/yairm210/UnCiv/issues/1340 - settings.maxWidth = 2048 - settings.maxHeight = 2048 - settings.combineSubdirectories = true - settings.pot = true - settings.fast = true - - // This is so they don't look all pixelated - settings.filterMag = Texture.TextureFilter.MipMapLinearLinear - settings.filterMin = Texture.TextureFilter.MipMapLinearLinear - TexturePacker.process(settings, "../Images", ".", "game") - } + if (File("../Images").exists()) // So we don't run this from within a fat JAR + packImages() val config = LwjglApplicationConfiguration() config.addIcon("ExtraImages/Icon.png", Files.FileType.Internal) config.title = "Unciv" - val game = UnCivGame("Desktop") -// tryActivateDiscord(game) // Deactivated until we can figure out how to make it work from the .jar + tryActivateDiscord(game) LwjglApplication(game, config) } + private fun packImages() { + val settings = TexturePacker.Settings() + // Apparently some chipsets, like NVIDIA Tegra 3 graphics chipset (used in Asus TF700T tablet), + // don't support non-power-of-two texture sizes - kudos @yuroller! + // https://github.com/yairm210/UnCiv/issues/1340 + settings.maxWidth = 2048 + settings.maxHeight = 2048 + settings.combineSubdirectories = true + settings.pot = true + settings.fast = true + + // This is so they don't look all pixelated + settings.filterMag = Texture.TextureFilter.MipMapLinearLinear + settings.filterMin = Texture.TextureFilter.MipMapLinearLinear + TexturePacker.process(settings, "../Images", ".", "game") + } + private fun tryActivateDiscord(game: UnCivGame) { try { val handlers = DiscordEventHandlers()