Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Some fixes #600

Merged
merged 3 commits into from
Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.soywiz.kmem.Arch
import com.soywiz.kmem.Os
import com.soywiz.kmem.Runtime

@SharedImmutable
internal actual val currentOs: Os = when (Platform.osFamily) {
OsFamily.UNKNOWN -> Os.UNKNOWN
OsFamily.MACOSX -> Os.MACOSX
Expand All @@ -15,8 +16,11 @@ internal actual val currentOs: Os = when (Platform.osFamily) {
OsFamily.TVOS -> Os.TVOS
OsFamily.WATCHOS -> Os.WATCHOS
}

@SharedImmutable
internal actual val currentRuntime: Runtime = Runtime.NATIVE

@SharedImmutable
internal actual val currentArch: Arch = when (Platform.cpuArchitecture) {
CpuArchitecture.UNKNOWN -> Arch.UNKNOWN
CpuArchitecture.ARM32 -> Arch.ARM32
Expand All @@ -31,5 +35,7 @@ internal actual val currentArch: Arch = when (Platform.cpuArchitecture) {
internal actual val currentIsDebug: Boolean get() = Platform.isDebugBinary
internal actual val currentIsLittleEndian: Boolean get() = Platform.isLittleEndian

@SharedImmutable
internal actual val currentRawPlatformName: String = "native-$currentOs-$currentArch-$currentBuildVariant"
@SharedImmutable
internal actual val currentRawOsName: String = "$currentOs"
3 changes: 3 additions & 0 deletions korgw/src/commonMain/kotlin/com/soywiz/kgl/KmlGlProxy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,9 @@ open class KmlGlProxy(parent: KmlGl) : KmlGlFastProxy(parent) {
}
}
open class KmlGlFastProxy(var parent: KmlGl) : KmlGl() {
override val gles: Boolean get() = parent.gles
override val linux: Boolean get() = parent.linux
override val android: Boolean get() = parent.android
override val webgl: Boolean get() = parent.webgl
override val webgl2: Boolean get() = parent.webgl2
override val root: KmlGl get() = parent.root
Expand Down
4 changes: 2 additions & 2 deletions korma/src/commonMain/kotlin/com/soywiz/korma/geom/Line.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface ILine {
val b: IPoint
}

open class Line(override val a: Point, override val b: Point) : ILine {
data class Line(override val a: Point, override val b: Point) : ILine {
private val temp = Point()

fun round(): Line {
Expand Down Expand Up @@ -129,7 +129,7 @@ open class Line(override val a: Point, override val b: Point) : ILine {
}
}

open class LineIntersection(
data class LineIntersection(
val line: Line = Line(),
val intersection: Point = Point()
) {
Expand Down
7 changes: 7 additions & 0 deletions korma/src/commonTest/kotlin/com/soywiz/korma/geom/LineTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ class LineTest {
assertEquals(Point(0, 100), Line(Point(0, 0), Point(0, 100)).projectedPoint(Point(0, 100)))
assertEquals(Point(0, 150), Line(Point(0, 0), Point(0, 100)).projectedPoint(Point(0, 150)))
}

@Test
fun testLineData() {
val gen = { Line(Point(0, 0), Point(100, 100)) }
assertEquals(gen(), gen())
assertEquals(gen().hashCode(), gen().hashCode())
}
}