Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scyjava compatibility #630

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
28 changes: 20 additions & 8 deletions src/main/kotlin/graphics/scenery/SceneryBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,27 @@ open class SceneryBase @JvmOverloads constructor(var applicationName: String,
val scijavaContext: Context? = null) {

/** The scene used by the renderer in the application */
protected var scene: Scene = Scene()
var scene: Scene = Scene()
protected set
/** REPL for the application, can be initialised in the [init] function */
protected var repl: REPL? = null
var repl: REPL? = null
protected set
/** Frame number for counting FPS */
protected var ticks = 0L
/** The default renderer for this application, see [Renderer] */
protected var renderer: Renderer? = null
var renderer: Renderer? = null
protected set
/** The Hub used by the application, see [Hub] */
var hub: Hub = Hub()
/** Global settings storage */
protected var settings: Settings = Settings()
var settings: Settings = Settings()
protected set
/** ui-behaviour input handler */
protected var inputHandler: InputHandler? = null
var inputHandler: InputHandler? = null
protected set
/** [Statistics] object to collect runtime stats on various routines. */
protected var stats: Statistics = Statistics(hub)
var stats: Statistics = Statistics(hub)
protected set

/** State variable for registering a new renderer */
data class NewRendererParameters(val rendererType: String, val hub: Hub,
Expand Down Expand Up @@ -116,7 +122,13 @@ open class SceneryBase @JvmOverloads constructor(var applicationName: String,
fun XInitThreads()

companion object {
val INSTANCE = Native.loadLibrary("X11", XLib::class.java) as XLib
lateinit var INSTANCE: XLib

init {
if(Platform.get() == Platform.LINUX) {
INSTANCE = Native.loadLibrary("X11", XLib::class.java) as XLib
}
}
}
}

Expand All @@ -132,7 +144,7 @@ open class SceneryBase @JvmOverloads constructor(var applicationName: String,
* e.g. for [Scene] construction and [Renderer] initialisation.
*/
open fun init() {

renderer = hub.add(Renderer.createRenderer(hub, applicationName, scene, windowWidth, windowHeight))
}

/**
Expand Down