mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Discord RPC now works from Desktop .Jar!
This commit is contained in:
parent
e0219036f6
commit
4844a98af1
@ -5,6 +5,7 @@ sourceSets.main.java.srcDirs = [ "src/" ]
|
|||||||
|
|
||||||
project.ext.mainClassName = "com.unciv.app.desktop.DesktopLauncher"
|
project.ext.mainClassName = "com.unciv.app.desktop.DesktopLauncher"
|
||||||
project.ext.assetsDir = new File("../android/assets")
|
project.ext.assetsDir = new File("../android/assets")
|
||||||
|
project.ext.discordDir = new File("discord_rpc")
|
||||||
|
|
||||||
task run(dependsOn: classes, type: JavaExec) {
|
task run(dependsOn: classes, type: JavaExec) {
|
||||||
main = project.mainClassName
|
main = project.mainClassName
|
||||||
@ -29,6 +30,8 @@ task dist(type: Jar) {
|
|||||||
// see Laurent1967's comment on https://github.com/libgdx/libgdx/issues/5491
|
// see Laurent1967's comment on https://github.com/libgdx/libgdx/issues/5491
|
||||||
from {configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }}
|
from {configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }}
|
||||||
from files(project.assetsDir)
|
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"
|
archiveFileName = "${appName}.jar"
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
|
BIN
desktop/discord_rpc/darwin/libdiscord-rpc.dylib
Normal file
BIN
desktop/discord_rpc/darwin/libdiscord-rpc.dylib
Normal file
Binary file not shown.
BIN
desktop/discord_rpc/linux-x86-64/libdiscord-rpc.so
Normal file
BIN
desktop/discord_rpc/linux-x86-64/libdiscord-rpc.so
Normal file
Binary file not shown.
BIN
desktop/discord_rpc/win32-x86-64/discord-rpc.dll
Normal file
BIN
desktop/discord_rpc/win32-x86-64/discord-rpc.dll
Normal file
Binary file not shown.
BIN
desktop/discord_rpc/win32-x86/discord-rpc.dll
Normal file
BIN
desktop/discord_rpc/win32-x86/discord-rpc.dll
Normal file
Binary file not shown.
@ -16,36 +16,37 @@ import kotlin.concurrent.thread
|
|||||||
internal object DesktopLauncher {
|
internal object DesktopLauncher {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun main(arg: Array<String>) {
|
fun main(arg: Array<String>) {
|
||||||
|
if (File("../Images").exists()) // So we don't run this from within a fat JAR
|
||||||
if (File("../Images").exists()) { // So we don't run this from within a fat JAR
|
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")
|
|
||||||
}
|
|
||||||
|
|
||||||
val config = LwjglApplicationConfiguration()
|
val config = LwjglApplicationConfiguration()
|
||||||
config.addIcon("ExtraImages/Icon.png", Files.FileType.Internal)
|
config.addIcon("ExtraImages/Icon.png", Files.FileType.Internal)
|
||||||
config.title = "Unciv"
|
config.title = "Unciv"
|
||||||
|
|
||||||
|
|
||||||
val game = UnCivGame("Desktop")
|
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)
|
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) {
|
private fun tryActivateDiscord(game: UnCivGame) {
|
||||||
try {
|
try {
|
||||||
val handlers = DiscordEventHandlers()
|
val handlers = DiscordEventHandlers()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user