Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	client-app/src/main/kotlin/chiiugo/app/ConfigManager.kt
#	client-app/src/main/kotlin/chiiugo/app/Mascot.kt
#	client-app/src/main/kotlin/chiiugo/app/MascotState.kt
#	client-app/src/main/kotlin/main.kt
  • Loading branch information
naotiki committed May 30, 2023
2 parents 86dcb5b + 73f1058 commit 0399d96
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 24 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ build/
/captures
.externalNativeBuild
.cxx
ChiiugoConf.json
ChiiugoConf.json
how2sign

*.pfx
5 changes: 3 additions & 2 deletions chiiugo-protocol-core/src/jvmMain/kotlin/main.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/*
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator
@OptIn(ExperimentalSerializationApi::class)
fun main() {
private fun main() {
val descriptors = listOf(SocketProtocol.serializer().descriptor)
val schemas = ProtoBufSchemaGenerator.generateSchemaText(descriptors)
println(schemas)
}
}*/
2 changes: 1 addition & 1 deletion client-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies {
compose.desktop {
application {
buildTypes.release.proguard.isEnabled.set(false)
mainClass = "MainKt"
mainClass = "chiiugo.app.MainKt"
jvmArgs += listOf("-Dfile.encoding=UTF-8")
nativeDistributions {
modules("java.sql")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package chiiugo.app

import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
Expand Down Expand Up @@ -41,8 +43,8 @@ data class ConfigData(
var alwaysTop: Boolean = true,
var imageSize: Float = 175f,
var spawnCount: Int = 1,
var graphics:GraphicsData=GraphicsData(),
var debug:DebugData=DebugData()
var graphics: GraphicsData = GraphicsData(),
var debug: DebugData = DebugData()
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package chiiugo.app

import Event
import SocketProtocol
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.TooltipArea
Expand All @@ -18,9 +22,9 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.*
import androidx.compose.ui.window.Window
import data.DailyStatistic
import data.DailyStatistics
import data.dbQuery
import chiiugo.app.data.DailyStatistic
import chiiugo.app.data.DailyStatistics
import chiiugo.app.data.dbQuery
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package chiiugo.app

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
Expand All @@ -19,8 +21,6 @@ import org.jetbrains.compose.animatedimage.Blank
import org.jetbrains.compose.animatedimage.animate
import org.jetbrains.compose.animatedimage.loadResourceAnimatedImage
import org.jetbrains.compose.resources.loadOrNull
import java.awt.event.WindowEvent
import java.awt.event.WindowFocusListener

@Composable
fun Mascot(screenSize: ScreenSize, configData: ConfigData) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package chiiugo.app

import Event
import androidx.compose.animation.Animatable
import androidx.compose.animation.core.*
import androidx.compose.runtime.*
Expand Down Expand Up @@ -52,7 +55,7 @@ enum class Behaviours(val behaviourFunc: BehaviourFunc){
})
}

val defaultBehaviour:BehaviourFunc={
val defaultBehaviour: BehaviourFunc ={
randomWalk()
delay(Random.nextLong(0, 2000))
say(texts.random(), 5000)
Expand All @@ -70,12 +73,12 @@ val defaultBehaviour:BehaviourFunc={
}
typealias BehaviourFunc=suspend MascotState.()->Unit
class MascotState(private val screenSize: ScreenSize,) {
private var behaviourFunc:BehaviourFunc?=null
private var behaviourFunc: BehaviourFunc?=null
private var behaviourJob:Job? = null
//Composition対応Coroutineスコープ内で実行
suspend fun loop() {
coroutineScope {
server.onEventReceive {e,_->
server.onEventReceive { e, _->
println("Event Receive:$e")
when (e) {
is Event.FailedBuild -> {
Expand Down Expand Up @@ -198,7 +201,7 @@ class MascotState(private val screenSize: ScreenSize,) {
}
}
@Composable
fun rememberMascotState(screenSize: ScreenSize):MascotState {
fun rememberMascotState(screenSize: ScreenSize): MascotState {
return remember(screenSize) { MascotState(screenSize) }
}
val texts = arrayOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package chiiugo.app

import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalLayoutDirection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package chiiugo.app

import androidx.compose.runtime.*
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Density
Expand All @@ -23,5 +25,5 @@ class ScreenSize(density: Density){
fun rememberScreenSize(): ScreenSize {
val density = LocalDensity.current

return remember(density) {ScreenSize(density) }
return remember(density) { ScreenSize(density) }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package chiiugo.app

import androidx.compose.animation.core.AnimationVector2D
import androidx.compose.animation.core.TwoWayConverter
import androidx.compose.ui.unit.dp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package data
package chiiugo.app.data

import kotlinx.coroutines.Dispatchers
import kotlinx.datetime.Clock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package chiiugo.app

import SocketServer
import androidx.compose.foundation.layout.*
import androidx.compose.material.Button
import androidx.compose.material.Text
Expand All @@ -7,17 +10,13 @@ import androidx.compose.ui.BiasAlignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.key.*
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.*
import data.DatabaseFactory
import chiiugo.app.data.DatabaseFactory
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.skiko.GpuPriority
import org.jetbrains.skiko.GraphicsApi
import kotlin.random.Random

val colorList =
Expand All @@ -26,7 +25,7 @@ val server by lazy { SocketServer() }

@OptIn(ExperimentalResourceApi::class, ExperimentalComposeUiApi::class)
fun main() {
val graphicsData=ConfigManager.conf.graphics
val graphicsData= ConfigManager.conf.graphics
System.setProperty("skiko.renderApi",graphicsData.renderApi)
System.setProperty("skiko.fps.enabled",graphicsData.fps.toString())
System.setProperty("skiko.vsync.enabled",graphicsData.vsync.toString())
Expand All @@ -43,7 +42,7 @@ fun main() {
}

var exitCount by remember { mutableStateOf(0) }
val screenSize=rememberScreenSize()
val screenSize= rememberScreenSize()
//Windowを表示
repeat(configState.spawnCount){
Mascot(screenSize,configState)
Expand Down

0 comments on commit 0399d96

Please sign in to comment.