mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 04:27:56 -04:00
Update .ico files, set taskbar icon icon for MacOS
This commit is contained in:
parent
86b6fbf7bc
commit
d03414e85e
Binary file not shown.
Before Width: | Height: | Size: 8.7 KiB |
BIN
android/assets/ExtraImages/Icons/Unciv128.png
Normal file
BIN
android/assets/ExtraImages/Icons/Unciv128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
android/assets/ExtraImages/Icons/Unciv32.png
Normal file
BIN
android/assets/ExtraImages/Icons/Unciv32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
@ -21,9 +21,14 @@ import com.unciv.utils.Display
|
||||
import com.unciv.utils.Log
|
||||
import org.lwjgl.system.Configuration
|
||||
import java.awt.GraphicsEnvironment
|
||||
import java.awt.Image
|
||||
import java.awt.Taskbar
|
||||
import java.awt.Toolkit
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
|
||||
internal object DesktopLauncher {
|
||||
|
||||
@JvmStatic
|
||||
@ -77,11 +82,13 @@ internal object DesktopLauncher {
|
||||
ImagePacker.packImages(isRunFromJAR)
|
||||
|
||||
val config = Lwjgl3ApplicationConfiguration()
|
||||
config.setWindowIcon("ExtraImages/Icon.png")
|
||||
config.setWindowIcon("ExtraImages/Icons/Unciv32.png", "ExtraImages/Icons/Unciv128.png")
|
||||
if (SharedLibraryLoader.isMac) updateDockIconForMacOs("ExtraImages/Icons/Unciv128.png")
|
||||
config.setTitle("Unciv")
|
||||
config.setHdpiMode(HdpiMode.Logical)
|
||||
config.setWindowSizeLimits(WindowState.minimumWidth, WindowState.minimumHeight, -1, -1)
|
||||
|
||||
|
||||
|
||||
|
||||
// LibGDX not yet configured, use regular java class
|
||||
@ -116,3 +123,15 @@ internal object DesktopLauncher {
|
||||
exitProcess(0)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateDockIconForMacOs(fileName: String) {
|
||||
try {
|
||||
val defaultToolkit: Toolkit = Toolkit.getDefaultToolkit()
|
||||
val imageResource: URL = FileHandle(fileName).file().toURI().toURL()
|
||||
val image: Image = defaultToolkit.getImage(imageResource)
|
||||
val taskbar = Taskbar.getTaskbar()
|
||||
taskbar.iconImage = image
|
||||
} catch (throwable: Throwable) {
|
||||
throwable.printStackTrace()
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 453 KiB |
Loading…
x
Reference in New Issue
Block a user