jan пре 1 месец
родитељ
комит
61765c25f8

+ 18 - 0
.editorconfig

@@ -0,0 +1,18 @@
+# https://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{java,scala,groovy,kt,kts}]
+indent_size = 4
+
+[*.gradle]
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false

+ 2 - 0
.gitattributes

@@ -0,0 +1,2 @@
+* text=auto eol=lf
+*.bat text=auto eol=crlf

+ 164 - 0
.gitignore

@@ -0,0 +1,164 @@
+## Gradle:
+.gradle/
+gradle-app.setting
+/build/
+/android/build/
+/core/build/
+/lwjgl2/build/
+/lwjgl3/build/
+/html/build/
+/teavm/build/
+/ios/build/
+/ios-moe/build/
+/headless/build/
+/server/build/
+/shared/build/
+
+## Java:
+*.class
+*.war
+*.ear
+hs_err_pid*
+.attach_pid*
+
+## Android:
+/android/libs/armeabi-v7a/
+/android/libs/arm64-v8a/
+/android/libs/x86/
+/android/libs/x86_64/
+/android/gen/
+/android/out/
+local.properties
+com_crashlytics_export_strings.xml
+
+## Robovm:
+/ios/robovm-build/
+
+## iOS:
+/ios/xcode/*.xcodeproj/*
+!/ios/xcode/*.xcodeproj/xcshareddata
+!/ios/xcode/*.xcodeproj/project.pbxproj
+/ios/xcode/native/
+/ios/IOSLauncher.app
+/ios/IOSLauncher.app.dSYM
+
+## GWT:
+/html/war/
+/html/gwt-unitCache/
+.apt_generated/
+/html/war/WEB-INF/deploy/
+/html/war/WEB-INF/classes/
+.gwt/
+gwt-unitCache/
+www-test/
+.gwt-tmp/
+
+## TeaVM:
+# Not sure yet...
+
+## IntelliJ, Android Studio:
+.idea/
+*.ipr
+*.iws
+*.iml
+
+## Eclipse:
+.classpath
+.project
+.metadata/
+/android/bin/
+/core/bin/
+/lwjgl2/bin/
+/lwjgl3/bin/
+/html/bin/
+/teavm/bin/
+/ios/bin/
+/ios-moe/bin/
+/headless/bin/
+/server/bin/
+/shared/bin/
+*.tmp
+*.bak
+*.swp
+*~.nib
+.settings/
+.loadpath
+.externalToolBuilders/
+*.launch
+
+
+## NetBeans:
+
+/nbproject/private/
+/android/nbproject/private/
+/core/nbproject/private/
+/lwjgl2/nbproject/private/
+/lwjgl3/nbproject/private/
+/html/nbproject/private/
+/teavm/nbproject/private/
+/ios/nbproject/private/
+/ios-moe/nbproject/private/
+/headless/nbproject/private/
+/server/nbproject/private/
+/shared/nbproject/private/
+
+/nbbuild/
+/android/nbbuild/
+/core/nbbuild/
+/lwjgl2/nbbuild/
+/lwjgl3/nbbuild/
+/html/nbbuild/
+/teavm/nbbuild/
+/ios/nbbuild/
+/ios-moe/nbbuild/
+/headless/nbbuild/
+/server/nbbuild/
+/shared/nbbuild/
+
+/dist/
+/android/dist/
+/core/dist/
+/lwjgl2/dist/
+/lwjgl3/dist/
+/html/dist/
+/teavm/dist/
+/ios/dist/
+/ios-moe/dist/
+/headless/dist/
+/server/dist/
+/shared/dist/
+
+/nbdist/
+/android/nbdist/
+/core/nbdist/
+/lwjgl2/nbdist/
+/lwjgl3/nbdist/
+/html/nbdist/
+/teavm/nbdist/
+/ios/nbdist/
+/ios-moe/nbdist/
+/headless/nbdist/
+/server/nbdist/
+/shared/nbdist/
+
+nbactions.xml
+nb-configuration.xml
+
+## OS-Specific:
+.DS_Store
+Thumbs.db
+
+## Miscellaneous:
+*~
+*.*#
+*#*#
+/.kotlin/
+/assets/assets.txt
+
+## Special cases:
+
+## There is a resource-config.json file generated by nativeimage.gradle if you use Graal Native Image.
+## Some usage may need extra resource configuration in a different file with the same name.
+## You could also add that configuration to the text in nativeimage.gradle .
+## You should delete or comment out the next line if you have configuration in a different resource-config.json .
+**/resource-config.json

+ 3 - 0
assets/.gitkeep

@@ -0,0 +1,3 @@
+This file can be deleted if there are any other files present in this folder.
+It is only here to ensure this folder is added to Git, instead of being
+ignored because it is empty.

+ 438 - 0
assets/ui/uiskin.json

@@ -0,0 +1,438 @@
+{
+com.badlogic.gdx.graphics.g2d.BitmapFont: {
+  default: {
+    file: font.fnt
+  }
+  font: {
+    file: font.fnt
+  }
+  list: {
+    file: font-list.fnt
+  }
+  subtitle: {
+    file: font-subtitle.fnt
+  }
+  window: {
+    file: font-window.fnt
+  }
+}
+com.badlogic.gdx.graphics.Color: {
+  black: {
+    r: 0
+    g: 0
+    b: 0
+    a: 1
+  }
+  disabled: {
+    r: 0.23137255
+    g: 0.24705882
+    b: 0.25882354
+    a: 1
+  }
+  highlight: {
+    r: 0.19215687
+    g: 0.6627451
+    b: 0.95686275
+    a: 1
+  }
+  message: {
+    r: 0.44313726
+    g: 0.47843137
+    b: 0.5372549
+    a: 1
+  }
+  split: {
+    r: 0.44313726
+    g: 0.47843137
+    b: 0.5372549
+    a: 1
+  }
+  white: {
+    r: 1
+    g: 1
+    b: 1
+    a: 1
+  }
+}
+com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
+  split: {
+    name: white
+    color: split
+  }
+  black: {
+    name: white
+    color: black
+  }
+  highlight: {
+    name: white
+    color: highlight
+  }
+}
+com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable: {
+  progress-bar-knob-t: {
+    region: progress-bar-knob
+    minWidth: 0
+    minHeight: 5
+  }
+}
+com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
+  default: {
+    up: button-normal
+    down: button-normal-pressed
+    over: button-normal-over
+    focused: button-normal-over
+  }
+  spinner-up: {
+    up: spinner-up
+    down: spinner-up-pressed
+    over: spinner-up-over
+  }
+  spinner-down: {
+    up: spinner-down
+    down: spinner-down-pressed
+    over: spinner-down-over
+  }
+}
+com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
+  default: {
+    checkboxOn: checkbox-selected
+    checkboxOff: checkbox
+    checkboxOnOver: checkbox-selected-over
+    checkboxOver: checkbox-over
+    font: font
+  }
+  radio: {
+    checkboxOn: radio-selected
+    checkboxOff: radio
+    checkboxOnOver: radio-selected-over
+    checkboxOver: radio-over
+    font: font
+  }
+}
+com.badlogic.gdx.scenes.scene2d.ui.ImageButton$ImageButtonStyle: {
+  default: {
+    up: button-normal
+    down: button-normal-pressed
+    over: button-normal-over
+    focused: button-normal-over
+  }
+}
+com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton$ImageTextButtonStyle: {
+  default: {
+    font: font
+    up: button-normal
+    down: button-normal-pressed
+    over: button-normal-over
+    focused: button-normal-pressed
+  }
+}
+com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
+  default: {
+    font: font
+  }
+  window: {
+    font: window
+  }
+  list: {
+    font: list
+  }
+  subtitle: {
+    font: subtitle
+  }
+}
+com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: {
+  default: {
+    font: list
+    fontColorSelected: white
+    fontColorUnselected: white
+        selection: selection
+        background: list
+    }
+    list-nobg: {
+        font: list
+        fontColorSelected: white
+        fontColorUnselected: white
+        selection: selection
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.ProgressBar$ProgressBarStyle: {
+    default-horizontal: {
+        background: progress-bar-square
+        knobBefore: progress-bar-square-knob
+    }
+    default-vertical: {
+        background: progress-bar-square
+        knobBefore: progress-bar-square-knob
+    }
+    curved: {
+        background: progress-bar
+        knobBefore: progress-bar-knob-t
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
+    default: {
+        hScrollKnob: scrollbar
+        vScrollKnob: scrollbar
+    }
+    list: {
+        background: list
+        hScrollKnob: scrollbar
+        vScrollKnob: scrollbar
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: {
+    default: {
+        font: font
+        fontColor: white
+        background: select-box
+        scrollStyle: list
+        listStyle: list-nobg
+        backgroundOpen: select-box-open
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
+    default-horizontal: {
+        knobOver: slider-knob-over
+        knobDown: slider-knob-over
+        background: progress-bar-square
+        knob: slider-knob
+    }
+    default-vertical: {
+        knobOver: slider-knob-over
+        knobDown: slider-knob-over
+        background: progress-bar-square
+        knob: slider-knob
+    }
+    curved: {
+        knobOver: slider-knob-over
+        knobDown: slider-knob-over
+        background: slider
+        knob: slider-knob
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle: {
+    default-horizontal: {
+        handle: split
+    }
+    default-vertical: {
+        handle: split
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
+    default: {
+        font: font
+        up: button-normal
+        down: button-normal-pressed
+        over: button-normal-over
+        focused: button-normal-over
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: {
+    default: {
+        font: font
+        fontColor: white
+        disabledFontColor: disabled
+        background: textfield
+        focusedBackground: textfield-selected
+        cursor: white
+        selection: highlight
+        messageFont: font
+        messageFontColor: message
+    }
+    spinner: {
+        font: font
+        fontColor: white
+        disabledFontColor: disabled
+        background: spinner-textfield
+        focusedBackground: spinner-textfield-selected
+        cursor: white
+        selection: highlight
+        messageFont: font
+        messageFontColor: message
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle: {
+    default: {
+        label: default
+        background: list
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.Touchpad$TouchpadStyle: {
+    default: {
+        background: list
+        knob: slider-knob
+    }
+}
+com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
+    default: {
+        background: window
+        titleFont: window
+    }
+},
+
+    com.badlogic.gdx.graphics.Color: {
+        white: { r: 1, g: 1, b: 1, a: 1 },
+        gray: { r: 0.5, g: 0.5, b: 0.5, a: 1 },
+        black: { r: 0, g: 0, b: 0, a: 1 },
+
+        up: { r: 0.1, g: 0.1, b: 0.1, a: 1 },
+        over: { r: 0.3, g: 0.3, b: 0.3, a: 1 },
+        down: { r: 0.3, g: 0, b: 0, a: 1 },
+        checked: { r: 0.3, g: 0, b: 0, a: 1 },
+        checkedOver: { r: 0.4, g: 0, b: 0, a: 1 },
+        disabled: { r: 0.4, g: 0.4, b: 0.4, a: 1 },
+        background: { r: 0.2, g: 0.2, b: 0.2, a: 1 },
+        selection: { r: 0.3, g: 0, b: 0, a: 1 },
+        semiTransparent: { r: 0, g: 0, b: 0, a: 0.6 },
+
+        font: white
+        fontOver: white
+        fontDown: gray
+        fontChecked: white
+        fontCheckedOver: white
+        fontDisabled: gray
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
+        buttonUp: { name: rect, color: up },
+        buttonOver: { name: rect, color: over },
+        buttonDown: { name: rect, color: down },
+        buttonDisabled: { name: rect, color: disabled },
+        buttonChecked: { name: rect, color: checked },
+        buttonCheckedOver: { name: rect, color: checkedOver },
+        checkBoxOn: { name: check-on, color: up },
+        checkBoxOff: { name: check, color: up },
+        checkBoxOver: { name: check, color: over },
+        checkBoxOnDisabled: { name: check-on, color: disabled },
+        checkBoxOffDisabled: { name: check, color: disabled },
+        icon: { name: check-on, color: font },
+        selection: { name: dot, color: selection },
+        list: { name: rect, color: background },
+        progressHorizontal: { name: line-v, color: up },
+        progressHorizontalKnob: { name: line-v, color: down },
+        progressHorizontalDisabled: { name: line-v, color: disabled },
+        progressHorizontalKnobDisabled: { name: line-v, color: disabled },
+        progressVertical: { name: line-h, color: up },
+        progressVerticalKnob: { name: line-h, color: down },
+        progressVerticalDisabled: { name: line-h, color: disabled },
+        progressVerticalKnobDisabled: { name: line-h, color: disabled },
+        scrollHorizontal: { name: line-v, color: up },
+        scrollVertical: { name: line-h, color: up },
+        scrollKnob: { name: knob-v, color: down },
+        scrollKnobVertical: { name: knob-h, color: down },
+        scrollPane: { name: rect, color: background },
+        selectBox: { name: select, color: up },
+        selectOver: { name: select, color: over },
+        selectDown: { name: select, color: over },
+        selectDisabled: { name: select, color: disabled },
+        selectList: { name: rect, color: over },
+        splitPane: { name: square, color: down },
+        sliderHorizontal: { name: square, color: up },
+        sliderKnob: { name: rect, color: up },
+        sliderKnobOver: { name: rect, color: over },
+        sliderKnobDown: { name: rect, color: down },
+        sliderKnobDisabled: { name: rect, color: disabled },
+        sliderVertical: { name: square, color: up },
+        sliderVerticalKnob: { name: rect, color: up },
+        sliderVerticalKnobOver: { name: rect, color: over },
+        sliderVerticalKnobDown: { name: rect, color: down },
+        sliderVerticalKnobDisabled: { name: rect, color: disabled },
+        textField: { name: rect, color: up },
+        textFieldDown: { name: rect, color: over },
+        textFieldDisabled: { name: rect, color: disabled },
+        textFieldCursor: { name: dot, color: font },
+        tooltip: { name: rect, color: up },
+        touchpad: { name: rect, color: over },
+        touchpadKnob: { name: check-on, color: down },
+        tree: { name: rect, color: background },
+        treeOver: { name: dot, color: over },
+        treeMinus: { name: tree-minus, color: up },
+        treePlus: { name: tree-plus, color: up },
+        window: { name: rect, color: background },
+        windowResize: { name: window-resize, color: background },
+        windowBorder: { name: window-border, color: background },
+        alpha: { name: dot, color: semiTransparent }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
+        default: { up: buttonUp, over: buttonOver, down: buttonDown, disabled: buttonDisabled },
+        toggle: { up: buttonUp, over: buttonOver, down: buttonDown, checked: buttonChecked, checkedOver: buttonCheckedOver, disabled: buttonDisabled }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
+        default: { checkboxOn: checkBoxOn, checkboxOff: checkBoxOff, checkboxOver: checkBoxOver, checkboxOnDisabled: checkBoxOnDisabled,
+            checkboxOffDisabled: checkBoxOffDisabled, font: default, fontColor: font, overFontColor: fontOver, downFontColor: fontDown,
+            checkedFontColor: fontChecked, checkedOverFontColor: fontCheckedOver, disabledFontColor: fontDisabled, pressedOffsetY: -1, pressedOffsetX: 1 }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.ImageButton$ImageButtonStyle: {
+        default: { up: buttonUp, over: buttonOver, down: buttonDown, disabled: buttonDisabled, imageUp: icon }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton$ImageTextButtonStyle: {
+        default: { up: buttonUp, over: buttonOver, down: buttonDown, disabled: buttonDisabled, font: default, fontColor: font,
+            overFontColor: fontOver, downFontColor: fontDown, disabledFontColor: fontDisabled, pressedOffsetY: -1, pressedOffsetX: 1, imageUp: icon }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
+        default: { font: default, fontColor: font },
+        white: { font: default, fontColor: white }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: {
+        default: { fontColorUnselected: font, selection: selection, fontColorSelected: fontDown, font: default },
+        background: { background: list, fontColorUnselected: font, selection: selection, fontColorSelected: fontDown, font: default }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.ProgressBar$ProgressBarStyle: {
+        default-horizontal: { background: progressHorizontal, knobBefore: progressHorizontalKnob,
+            disabledBackground: progressHorizontalDisabled, disabledKnobBefore: progressHorizontalKnobDisabled },
+        default-vertical: { background: progressVertical, knobBefore: progressVerticalKnob,
+            disabledBackground: progressVerticalDisabled, disabledKnobBefore: progressVerticalKnobDisabled }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
+        default: { hScrollKnob: scrollKnob, vScrollKnob: scrollKnobVertical, hScroll: scrollHorizontal, vScroll: scrollVertical },
+        clean: { hScrollKnob: scrollKnob, vScrollKnob: scrollKnobVertical },
+        background: { background: scrollPane, hScrollKnob: scrollKnob, vScrollKnob: scrollKnobVertical, hScroll: scrollHorizontal, vScroll: scrollVertical }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: {
+        default: { font: default, fontColor: font, disabledFontColor: fontDisabled, background: selectBox, backgroundOver: selectOver,
+            backgroundOpen: selectDown, backgroundDisabled: selectDisabled, scrollStyle: default, listStyle:
+            { background: selectList, fontColorUnselected: font, selection: selection, fontColorSelected: fontDown, font: default }
+        }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
+        default-horizontal: { background: sliderHorizontal, knob: sliderKnob, knobOver: sliderKnobOver, knobDown: sliderKnobDown,
+            disabledKnob: sliderKnobDisabled },
+        default-vertical: { background: sliderVertical, knob: sliderVerticalKnob, knobOver: sliderVerticalKnobOver,
+            knobDown: sliderVerticalKnobDown,    disabledKnob: sliderVerticalKnobDisabled }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle: {
+        default-vertical: { handle: splitPane },
+        default-horizontal: { handle: splitPane }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
+        default: { up: buttonUp, over: buttonOver, down: buttonDown, disabled: buttonDisabled, font: default, fontColor: font,
+            overFontColor: fontOver, downFontColor: fontDown, disabledFontColor: fontDisabled, pressedOffsetY: -1, pressedOffsetX: 1 },
+        toggle: { up: buttonUp, over: buttonOver, down: buttonDown, checked: buttonChecked, checkedOver: buttonCheckedOver,
+            disabled: buttonDisabled, font: default, fontColor: font, overFontColor: fontOver, downFontColor: fontDown, disabledFontColor:
+            fontDisabled, checkedFontColor: fontChecked, checkedOverFontColor: fontCheckedOver, pressedOffsetY: -1, pressedOffsetX: 1 },
+        text: { font: default, fontColor: up, overFontColor: over, downFontColor: down, disabledFontColor: disabled,
+            pressedOffsetY: -1, pressedOffsetX: 1 },
+        textToggle: { font: default, fontColor: up, overFontColor: over, downFontColor: down, disabledFontColor:
+        disabled, checkedFontColor: font, checkedOverFontColor: fontOver, pressedOffsetY: -1, pressedOffsetX: 1 }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: {
+        default: { font: default, messageFont: default, fontColor: font, focusedFontColor: fontOver, disabledFontColor: fontDisabled,
+            messageFontColor: fontDown, background: textField, focusedBackground: textFieldDown, disabledBackground: textFieldDisabled,
+            cursor: textFieldCursor, selection: selection }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle: {
+        default: { label: default, background: tooltip }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.Touchpad$TouchpadStyle: {
+        default: { background: touchpad, knob: touchpadKnob }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.Tree$TreeStyle: {
+        default: { minus: treeMinus, plus: treePlus, selection: selection, over: treeOver },
+        background: { background: tree, minus: treeMinus, plus: treePlus, selection: selection, over: treeOver }
+    },
+    com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
+        default: { titleFont: default, background: window, titleFontColor: fontDisabled },
+        resize: { titleFont: default, background: windowResize, titleFontColor: fontDisabled },
+        border: { titleFont: default, background: windowBorder, titleFontColor: fontDisabled },
+        dialog: { titleFont: default, background: window, titleFontColor: fontDisabled, stageBackground: alpha }
+    }
+}

BIN
assets/ui/uiskin.png


+ 12 - 0
gradle/gradle-daemon-jvm.properties

@@ -0,0 +1,12 @@
+#This file is generated by updateDaemonJvm
+toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4945f00643ec68e7c7a6b66f90124f89/redirect
+toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/e50b80b5a11d194a898bc3e6211b7c4b/redirect
+toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4945f00643ec68e7c7a6b66f90124f89/redirect
+toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/e50b80b5a11d194a898bc3e6211b7c4b/redirect
+toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/f257be9f04bfdf169051808541767806/redirect
+toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/1dcbacacca32618bd21ec5465779ade1/redirect
+toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4945f00643ec68e7c7a6b66f90124f89/redirect
+toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/e50b80b5a11d194a898bc3e6211b7c4b/redirect
+toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1e91f45234d88a64dafb961c93ddc75a/redirect
+toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/5a88b04b5e582b332d2e6bc12b45f1b9/redirect
+toolchainVersion=21

BIN
gradle/wrapper/gradle-wrapper.jar


+ 9 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,9 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
+networkTimeout=10000
+retries=0
+retryBackOffMs=500
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 48 - 0
gradlew

@@ -0,0 +1,48 @@
+package me.lethunderhawk.lwjgl3;
+
+import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
+import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
+import me.lethunderhawk.Main;
+
+/** Launches the desktop (LWJGL3) application. */
+public class Lwjgl3Launcher {
+    public static void main(String[] args) {
+        if (StartupHelper.startNewJvmIfRequired()) return; // This handles macOS support and helps on Windows.
+        createApplication();
+    }
+
+    private static Lwjgl3Application createApplication() {
+        return new Lwjgl3Application(new Main(), getDefaultConfiguration());
+    }
+
+    private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() {
+        Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration();
+        configuration.setTitle("Smog");
+        //// Vsync limits the frames per second to what your hardware can display, and helps eliminate
+        //// screen tearing. This setting doesn't always work on Linux, so the line after is a safeguard.
+        configuration.useVsync(true);
+        //// Limits FPS to the refresh rate of the currently active monitor, plus 1 to try to match fractional
+        //// refresh rates. The Vsync setting above should limit the actual FPS to match the monitor.
+        configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate + 1);
+        //// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be
+        //// useful for testing performance, but can also be very stressful to some hardware.
+        //// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing.
+
+        configuration.setWindowedMode(640, 480);
+        //// You can change these files; they are in lwjgl3/src/main/resources/ .
+        //// They can also be loaded from the root of assets/ .
+        configuration.setWindowIcon("libgdx128.png", "libgdx64.png", "libgdx32.png", "libgdx16.png");
+
+        //// This could improve compatibility with Windows machines with buggy OpenGL drivers, Macs
+        //// with Apple Silicon that have to emulate compatibility with OpenGL anyway, and more.
+        //// This uses the dependency `com.badlogicgames.gdx:gdx-lwjgl3-angle` to function.
+        //// You would need to add this line to lwjgl3/build.gradle , below the dependency on `gdx-backend-lwjgl3`:
+        ////     implementation "com.badlogicgames.gdx:gdx-lwjgl3-angle:$gdxVersion"
+        //// You can choose to add the following line and the mentioned dependency if you want; they
+        //// are not intended for games that use GL30 (which is compatibility with OpenGL ES 3.0).
+        //// Know that it might not work well in some cases.
+//        configuration.setOpenGLEmulation(Lwjgl3ApplicationConfiguration.GLEmulation.ANGLE_GLES20, 0, 0);
+
+        return configuration;
+    }
+}

+ 227 - 0
lwjgl3/src/main/java/me/lethunderhawk/lwjgl3/StartupHelper.java

@@ -0,0 +1,227 @@
+/*
+ * Copyright 2020 damios
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Note, the above license and copyright applies to this file only.
+package me.lethunderhawk.lwjgl3;
+
+import com.badlogic.gdx.Version;
+import com.badlogic.gdx.backends.lwjgl3.Lwjgl3NativesLoader;
+
+import org.lwjgl.system.JNI;
+import org.lwjgl.system.linux.UNISTD;
+import org.lwjgl.system.macosx.LibC;
+import org.lwjgl.system.macosx.ObjCRuntime;
+
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * A helper object for game startup, featuring three utilities related to LWJGL3 on various operating systems.
+ * <p>
+ * The utilities are as follows:
+ * <ul>
+ *  <li> Windows: Prevents a common crash related to LWJGL3's extraction of shared library files.</li>
+ *  <li> macOS: Spawns a child JVM process with {@code -XstartOnFirstThread} in the JVM args (if it was not already).
+ *  This is required for LWJGL3 to work on macOS.</li>
+ *  <li> Linux (NVIDIA GPUs only): Spawns a child JVM process with the {@code __GL_THREADED_OPTIMIZATIONS}
+ *  {@link System#getenv(String) Environment Variable} set to {@code 0} (if it was not already). This is required for
+ *  LWJGL3 to work on Linux with NVIDIA GPUs.</li>
+ * </ul>
+ * <a href="https://jvm-gaming.org/t/starting-jvm-on-mac-with-xstartonfirstthread-programmatically/57547">Based on this java-gaming.org post by kappa</a>
+ * @author damios
+ */
+public class StartupHelper {
+
+	private StartupHelper() {}
+
+	private static final String JVM_RESTARTED_ARG = "jvmIsRestarted";
+
+	/**
+	 * Must only be called on Linux. Check OS first (or use short-circuit evaluation)!
+	 * @return whether NVIDIA drivers are present on Linux.
+	 */
+	public static boolean isLinuxNvidia() {
+		String[] drivers = new File("/proc/driver").list(
+			(dir, path) -> path.toUpperCase(Locale.ROOT).contains("NVIDIA")
+		);
+		if (drivers == null) return false;
+		return drivers.length > 0;
+	}
+
+	/**
+	 * Applies the utilities as described by {@link StartupHelper}'s Javadoc.
+	 * <p>
+	 * All {@link System#getenv() Environment Variables} are copied to the child JVM process (if it is spawned), as
+	 * specified by {@link ProcessBuilder#environment()}; the same applies for
+	 * {@link System#getProperties() System Properties}.
+	 * <p>
+	 * <b>Usage:</b>
+	 * <pre><code>
+	 * public static void main(String[] args) {
+	 * 	 if (StartupHelper.startNewJvmIfRequired()) return;
+	 * 	 // ... The rest of main() goes here, as normal.
+	 * }
+	 * </code></pre>
+	 * @return whether a child JVM process was spawned or not.
+	 */
+	public static boolean startNewJvmIfRequired() {
+		return startNewJvmIfRequired(true);
+	}
+
+	/**
+	 * Applies the utilities as described by {@link StartupHelper}'s Javadoc.
+	 * <p>
+	 * All {@link System#getenv() Environment Variables} are copied to the child JVM process (if it is spawned), as
+	 * specified by {@link ProcessBuilder#environment()}; the same applies for
+	 * {@link System#getProperties() System Properties}.
+	 * <p>
+	 * <b>Usage:</b>
+	 * <pre><code>
+	 * public static void main(String[] args) {
+	 *   // The parameter on the next line could instead be false if you don't want to inherit IO.
+	 * 	 if (StartupHelper.startNewJvmIfRequired(true)) return;
+	 * 	 // ... The rest of main() goes here, as normal.
+	 * }
+	 * </code></pre>
+	 * @param inheritIO whether I/O should be inherited in the child JVM process. Please note that enabling this will
+	 *                  block the thread until the child JVM process stops executing.
+	 * @return whether a child JVM process was spawned or not.
+	 */
+	public static boolean startNewJvmIfRequired(boolean inheritIO) {
+		String osName = System.getProperty("os.name").toLowerCase(Locale.ROOT);
+		if (osName.contains("mac")) return startNewJvm0(/*isMac =*/ true, inheritIO);
+		if (osName.contains("windows")) {
+			// Here, we are trying to work around an issue with how LWJGL3 loads its extracted .dll files.
+			// By default, LWJGL3 extracts to the directory specified by "java.io.tmpdir": usually, the user's home.
+			// If the user's name has non-ASCII (or some non-alphanumeric) characters in it, that would fail.
+			// By extracting to the relevant "ProgramData" folder, which is usually "C:\ProgramData", we avoid this.
+			// We also temporarily change the "user.name" property to one without any chars that would be invalid.
+			// We revert our changes immediately after loading LWJGL3 natives.
+			String programData = System.getenv("ProgramData");
+			if (programData == null) programData = "C:\\Temp"; // if ProgramData isn't set, try some fallback.
+			String prevTmpDir = System.getProperty("java.io.tmpdir", programData);
+			String prevUser = System.getProperty("user.name", "libGDX_User");
+			System.setProperty("java.io.tmpdir", programData + "\\libGDX-temp");
+			System.setProperty(
+				"user.name",
+				("User_" + prevUser.hashCode() + "_GDX" + Version.VERSION).replace('.', '_')
+			);
+			Lwjgl3NativesLoader.load();
+			System.setProperty("java.io.tmpdir", prevTmpDir);
+			System.setProperty("user.name", prevUser);
+			return false;
+		}
+		return startNewJvm0(/*isMac =*/ false, inheritIO);
+	}
+
+	private static final String MAC_JRE_ERR_MSG = "A Java installation could not be found. If you are distributing this app with a bundled JRE, be sure to set the '-XstartOnFirstThread' argument manually!";
+	private static final String LINUX_JRE_ERR_MSG = "A Java installation could not be found. If you are distributing this app with a bundled JRE, be sure to set the environment variable '__GL_THREADED_OPTIMIZATIONS' to '0'!";
+	private static final String CHILD_LOOP_ERR_MSG = "The current JVM process is a spawned child JVM process, but StartupHelper has attempted to spawn another child JVM process! This is a broken state, and should not normally happen! Your game may crash or not function properly!";
+
+	/**
+	 * Spawns a child JVM process if on macOS, or on Linux with NVIDIA drivers.
+	 * <p>
+	 * All {@link System#getenv() Environment Variables} are copied to the child JVM process (if it is spawned), as
+	 * specified by {@link ProcessBuilder#environment()}; the same applies for
+	 * {@link System#getProperties() System Properties}.
+	 * @param isMac whether the current OS is macOS. If this is `false` then the current OS is assumed to be Linux (and
+	 *             an immediate check for NVIDIA drivers is performed).
+	 * @param inheritIO whether I/O should be inherited in the child JVM process. Please note that enabling this will
+	 *                 block the thread until the child JVM process stops executing.
+	 * @return whether a child JVM process was spawned or not.
+	 */
+	public static boolean startNewJvm0(boolean isMac, boolean inheritIO) {
+		long processID = getProcessID(isMac);
+		if (!isMac) {
+			// No need to restart non-NVIDIA Linux
+			if (!isLinuxNvidia()) return false;
+			// check whether __GL_THREADED_OPTIMIZATIONS is already disabled
+			if ("0".equals(System.getenv("__GL_THREADED_OPTIMIZATIONS"))) return false;
+		} else {
+			// There is no need for -XstartOnFirstThread on Graal native image
+			if (!System.getProperty("org.graalvm.nativeimage.imagecode", "").isEmpty()) return false;
+
+			// Checks if we are already on the main thread, such as from running via Construo.
+			long objcMsgSend = ObjCRuntime.getLibrary().getFunctionAddress("objc_msgSend");
+			long nsThread = ObjCRuntime.objc_getClass("NSThread");
+			long currentThread = JNI.invokePPP(nsThread, ObjCRuntime.sel_getUid("currentThread"), objcMsgSend);
+			boolean isMainThread = JNI.invokePPZ(currentThread, ObjCRuntime.sel_getUid("isMainThread"), objcMsgSend);
+			if (isMainThread) return false;
+
+			if ("1".equals(System.getenv("JAVA_STARTED_ON_FIRST_THREAD_" + processID))) return false;
+		}
+
+		// Check whether this JVM process is a child JVM process already.
+		// This state shouldn't usually be reachable, but this stops us from endlessly spawning new child JVM processes.
+		if ("true".equals(System.getProperty(JVM_RESTARTED_ARG))) {
+			System.err.println(CHILD_LOOP_ERR_MSG);
+			return false;
+		}
+
+		// Spawn the child JVM process with updated environment variables or JVM args
+		List<String> jvmArgs = new ArrayList<>();
+		// The following line is used assuming you target Java 8, the minimum for LWJGL3.
+		String javaExecPath = System.getProperty("java.home") + "/bin/java";
+		// If targeting Java 9 or higher, you could use the following instead of the above line:
+		//String javaExecPath = ProcessHandle.current().info().command().orElseThrow()
+		if (!(new File(javaExecPath).exists())) {
+			System.err.println(getJreErrMsg(isMac));
+			return false;
+		}
+
+		jvmArgs.add(javaExecPath);
+		if (isMac) jvmArgs.add("-XstartOnFirstThread");
+		jvmArgs.add("-D" + JVM_RESTARTED_ARG + "=true");
+		jvmArgs.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments());
+		jvmArgs.add("-cp");
+		jvmArgs.add(System.getProperty("java.class.path"));
+		String mainClass = System.getenv("JAVA_MAIN_CLASS_" + processID);
+		if (mainClass == null) {
+			StackTraceElement[] trace = Thread.currentThread().getStackTrace();
+			if (trace.length > 0) mainClass = trace[trace.length - 1].getClassName();
+			else {
+				System.err.println("The main class could not be determined.");
+				return false;
+			}
+		}
+		jvmArgs.add(mainClass);
+
+		try {
+			ProcessBuilder processBuilder = new ProcessBuilder(jvmArgs);
+			if (!isMac) processBuilder.environment().put("__GL_THREADED_OPTIMIZATIONS", "0");
+
+			if (!inheritIO) processBuilder.start();
+			else processBuilder.inheritIO().start().waitFor();
+		} catch (Exception e) {
+			System.err.println("There was a problem restarting the JVM.");
+			// noinspection CallToPrintStackTrace
+			e.printStackTrace();
+		}
+
+		return true;
+	}
+
+	private static String getJreErrMsg(boolean isMac) {
+		if (isMac) return MAC_JRE_ERR_MSG;
+		else return LINUX_JRE_ERR_MSG;
+	}
+
+	private static long getProcessID(boolean isMac) {
+		if (isMac) return LibC.getpid();
+		else return UNISTD.getpid();
+	}
+}

+ 8 - 0
settings.gradle

@@ -0,0 +1,8 @@
+plugins {
+  // Applies the foojay-resolver plugin to allow automatic download of JDKs.
+  id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
+}
+// A list of which subprojects to load as part of the same larger project.
+// You can remove Strings from the list and reload the Gradle project
+// if you want to temporarily disable a subproject.
+include 'lwjgl3', 'server', 'shared', 'core'