-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bidirectional IPC packets, support view tree operations for external …
…debugger, support for offscreen GameWindow and rendering and initial incremental compilation without Gradle for faster, more-stable hot reloading (#2249)
- Loading branch information
Showing
38 changed files
with
1,907 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
korge-core/src@jvm/korlibs/render/awt/AwtOffscreenGameWindow.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package korlibs.render.awt | ||
|
||
import korlibs.concurrent.thread.* | ||
import korlibs.graphics.gl.* | ||
import korlibs.kgl.* | ||
import korlibs.math.geom.* | ||
import korlibs.render.* | ||
import korlibs.time.* | ||
|
||
class AwtOffscreenGameWindow( | ||
var size: Size = Size(640, 480), | ||
val context: OffscreenKmlGlContext = NewOffsetKmlGlContext(size.width.toInt(), size.height.toInt(), doUnset = true), | ||
val draw: Boolean = false, | ||
override val ag: AGOpengl = AGOpenglAWT(context = context.ctx), | ||
exitProcessOnClose: Boolean = false, | ||
override var devicePixelRatio: Double = 1.0, | ||
) : GameWindow() { | ||
constructor( | ||
config: GameWindowCreationConfig, | ||
size: Size = Size(640, 480), | ||
context: OffscreenKmlGlContext = NewOffsetKmlGlContext(size.width.toInt(), size.height.toInt(), doUnset = true), | ||
) : this( | ||
size = size, | ||
//draw = config.draw, | ||
context = context, | ||
ag = AGOpenglAWT(config, context.ctx), | ||
//exitProcessOnClose = config.exitProcessOnClose, | ||
//devicePixelRatio = config.devicePixelRatio | ||
) | ||
|
||
override val width: Int get() = context.width | ||
override val height: Int get() = context.height | ||
|
||
init { | ||
this.exitProcessOnClose = exitProcessOnClose | ||
//onEvent(ReshapeEvent) { | ||
// context.setSize(it.width, it.height) | ||
// //size = Size(it.width.toDouble(), it.height.toDouble()) | ||
//} | ||
} | ||
|
||
override fun setSize(width: Int, height: Int) { | ||
val rwidth = (width * devicePixelRatio).toInt() | ||
val rheight = (height * devicePixelRatio).toInt() | ||
//println("OFFSCREEN: setSize: $width, $height") | ||
context.setSize(rwidth, rheight) | ||
context.doClear() | ||
dispatchReshapeEvent(0, 0, rwidth, rheight) | ||
} | ||
|
||
override suspend fun loopDelay(time: FastDuration) { | ||
NativeThread.sleepExact(time) | ||
} | ||
|
||
//override val ag: AG = if (draw) AGSoftware(width, height) else DummyAG(width, height) | ||
//override val ag: AG = AGDummy(width, height) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.