plugins {
id("com.android.application")
id("kotlin-android")
+ ktlintGradle
}
private val keystorePropertiesFile = rootProject.file("keystore.properties")
const val ksp = "ru.fredboy:automultibind-ksp:${Versions.automultibind}"
}
- const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.agp}"
+ object KtLint {
+ const val ktlintGradlePlugin = "org.jlleitschuh.gradle:ktlint:${Versions.ktlintGradle}"
+ }
- // TODO: Remove after complete kotlin migration
- const val jetbrainsAnnotations = "org.jetbrains:annotations:${Versions.jetbrainsAnnotations}"
+ const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.agp}"
}
\ No newline at end of file
get() = id("com.google.devtools.ksp") version Versions.ksp
val PluginDependenciesSpecScope.kotlinxSerialization
get() = id("org.jetbrains.kotlin.plugin.serialization") version Versions.kotlin
+val PluginDependenciesSpecScope.ktlintGradle
+ get() = id("org.jlleitschuh.gradle.ktlint") version Versions.ktlintGradle
* [Source](https://github.com/fredboy/automultibind)
*/
const val automultibind = "1.0.0"
+
+ /**
+ * Ktlint gradle plugin
+ *
+ * [Source](https://github.com/JLLeitschuh/ktlint-gradle)
+ */
+ const val ktlintGradle = "12.3.0"
}
\ No newline at end of file
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
kotlin
ksp
kotlinxSerialization
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
kotlin
ksp
kotlinxSerialization
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
kotlin
ksp
kotlinxSerialization
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
kotlin
ksp
kotlinxSerialization
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
leg.setOrigin(leg.width / 2f, 0f)
head.setOrigin(head.width / 2, head.height)
- var backHandAnim = 0f
- var frontHandAnim = 0f
+ var backHandAnim: Float
+ var frontHandAnim: Float
val rightHandAnim = getRightHandAnim(delta)
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
}
}
+ @Suppress("unused")
fun update(delta: Float) {
val iterator = containerMap.iterator()
while (iterator.hasNext()) {
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
drops.forEach(action)
}
+ @Suppress("unused")
fun update(delta: Float) {
val iterator = drops.iterator()
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
val mobType: KClass<MOB>,
) : MobBehavior {
+ @Suppress("UNCHECKED_CAST")
final override fun update(mob: Mob, worldAdapter: MobWorldAdapter, delta: Float) {
if (mob::class == mobType) {
with(mob as MOB) {
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
}
+ @Suppress("unused")
fun update(delta: Float) {
handleMousePosition()
}
val action: MouseInputAction? = mouseInputActionMapper.map(
mouseX = mouseX.toFloat(),
mouseY = mouseY.toFloat(),
- cameraViewport = requireNotNull(gameContextRepository.getCameraContext()?.viewport),
+ cameraViewport = requireNotNull(gameContextRepository.getCameraContext().viewport),
button = button,
touchUp = touchUp,
pointer = pointer,
buttonHoldTask = null
}
- private fun handleHold(action: MouseInputAction) {
+ private fun handleHold() {
cancelHold()
val player = mobController.player
}
}
- private fun handleDown(action: MouseInputAction) {
+ private fun handleDown() {
cancelHold()
buttonHoldTask = object : Timer.Task() {
override fun run() {
- handleHold(action)
+ handleHold()
}
}
)
}
- private fun handleUp(action: MouseInputAction) {
+ private fun handleUp() {
val player = mobController.player
val item = player.activeItem.item
cancelHold()
}
if (action.actionKey.touchUp && buttonHoldTask?.isScheduled == true) {
- handleUp(action)
+ handleUp()
} else if (!action.actionKey.touchUp) {
- handleDown(action)
+ handleDown()
}
}
override fun checkConditions(action: MouseInputAction): Boolean {
return gameWindowsManager.currentWindowType == GameWindowType.NONE &&
- applicationContextRepository.isTouch() &&
-// mobsController.player.controlMode == Player.ControlMode.WALK &&
- gameContextRepository.getJoystick() != null &&
- (action.actionKey is MouseInputActionKey.Touch) &&
- (action.actionKey.pointer == gameContextRepository.getJoystick().pointer || !active) &&
- ((action.actionKey is MouseInputActionKey.Dragged) ||
- (action.screenX < action.cameraViewport.width / 2 && !action.actionKey.touchUp || active)) &&
- !(action.actionKey is MouseInputActionKey.Screen && action.isInsideHotbar(textureRegions))
+ applicationContextRepository.isTouch() && action.actionKey is MouseInputActionKey.Touch && (action.actionKey.pointer == gameContextRepository.getJoystick().pointer || !active) && ((action.actionKey is MouseInputActionKey.Dragged) ||
+ (action.screenX < action.cameraViewport.width / 2 && !action.actionKey.touchUp || active)) && !(action.actionKey is MouseInputActionKey.Screen && action.isInsideHotbar(textureRegions))
}
active = true
}
- private fun handleTouchUp(action: MouseInputAction) {
- gameContextRepository.getJoystick()?.deactivate()
+ private fun handleTouchUp() {
+ gameContextRepository.getJoystick().deactivate()
active = false
}
is MouseInputActionKey.Dragged -> handleDragged()
else -> {
if (action.actionKey.touchUp) {
- handleTouchUp(action)
+ handleTouchUp()
} else {
handleTouchDown(action)
}
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
plugins {
kotlin
ksp
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility
override fun quitGame() {
(screen as? GameScreen)?.let { gameScreen ->
- screen.dispose()
+ gameScreen.dispose()
setScreen(applicationComponent.menuScreen)
} ?: Gdx.app.error(TAG, "quitGame called when active screen is not Game")
}
val touchX = applicationContextRepository.getWidth() / Gdx.graphics.width * screenX.toFloat()
val touchY = applicationContextRepository.getHeight() / Gdx.graphics.height * screenY.toFloat()
- menuButtonRepository.getCurrentMenuButtons()?.values?.forEachIndexed { index, button ->
- if (!button.isEnabled) {
+ menuButtonRepository.getCurrentMenuButtons()?.values?.forEachIndexed { index, menuButton ->
+ if (!menuButton.isEnabled) {
return@forEachIndexed
}
)
if (rect.contains(touchX, touchY)) {
- when (button) {
+ when (menuButton) {
is MenuButton.Simple -> {
- val action = menuButtonActions[button.actionKey] ?: run {
- Gdx.app.error(TAG, "Menu handler for action '${button.actionKey}' not found")
+ val action = menuButtonActions[menuButton.actionKey] ?: run {
+ Gdx.app.error(TAG, "Menu handler for action '${menuButton.actionKey}' not found")
return@forEachIndexed
}
if (action.canPerform()) {
action.perform()
} else {
- Gdx.app.debug(TAG, "Can't perform action ${button.actionKey}")
+ Gdx.app.debug(TAG, "Can't perform action ${menuButton.actionKey}")
}
}
is MenuButton.BooleanOption -> {
- button.optionKeys.forEach { optionKey ->
+ menuButton.optionKeys.forEach { optionKey ->
menuButtonBooleanOption[optionKey]?.toggleOption() ?: run {
Gdx.app.error(TAG, "Menu option handler for option '$optionKey' not found")
}
spriter.projectionMatrix = camera.combined
}
+ @Suppress("unused")
fun render(delta: Float) {
spriter.begin()
drawBackground()
plugins {
- id("kotlin")
+ kotlin
+ ktlintGradle
}
java.sourceCompatibility = ApplicationInfo.sourceCompatibility