jsyphon
This commit is contained in:
committed by
edwin
parent
bb7439db54
commit
31b79685eb
62
orx-syphon/src/main/kotlin/jsyphon/JSyphonClient.kt
Normal file
62
orx-syphon/src/main/kotlin/jsyphon/JSyphonClient.kt
Normal file
@@ -0,0 +1,62 @@
|
||||
package jsyphon
|
||||
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class JSyphonClient // public API
|
||||
{
|
||||
private var ptr: Long = 0
|
||||
|
||||
companion object {
|
||||
init {
|
||||
System.load(File("orx-syphon/src/main/kotlin/jsyphon/libJSyphon.jnilib").absolutePath)
|
||||
}
|
||||
}
|
||||
|
||||
fun init() {
|
||||
ptr = init(null)
|
||||
}
|
||||
|
||||
fun setApplicationName(appName: String?) {
|
||||
setApplicationName(ptr, appName)
|
||||
}
|
||||
|
||||
fun setServerName(serverName: String?) {
|
||||
setServerName(ptr, serverName)
|
||||
}
|
||||
|
||||
val isValid: Boolean
|
||||
get() = isValid(ptr)
|
||||
|
||||
fun newFrameImageForContext(): JSyphonImage {
|
||||
val dict = newFrameDataForContext()
|
||||
val name = dict["name"] as Long?
|
||||
val width = dict["width"] as Double?
|
||||
val height = dict["height"] as Double?
|
||||
return JSyphonImage(name!!.toInt(), width!!.toInt(), height!!.toInt())
|
||||
}
|
||||
|
||||
// Native method declarations
|
||||
external fun init(options: HashMap<String?, Any?>?): Long
|
||||
external fun setApplicationName(ptr: Long, appName: String?)
|
||||
external fun setServerName(ptr: Long, serverName: String?)
|
||||
external fun isValid(ptr: Long): Boolean
|
||||
|
||||
@JvmOverloads
|
||||
external fun serverDescription(ptr: Long = this.ptr): HashMap<String?, String?>?
|
||||
|
||||
@JvmOverloads
|
||||
external fun hasNewFrame(ptr: Long = this.ptr): Boolean
|
||||
|
||||
@JvmOverloads
|
||||
external fun newFrameDataForContext(ptr: Long = this.ptr): HashMap<String, Any>
|
||||
|
||||
@JvmOverloads
|
||||
external fun stop(ptr: Long = this.ptr) // public JSyphonImage newFrameImageForContext() {
|
||||
// HashMap<String, Object> dict = newFrameDataForContext();
|
||||
// Long name = (Long)dict.get("name");
|
||||
// Double width = (Double)dict.get("width");
|
||||
// Double height = (Double)dict.get("height");
|
||||
// return new JSyphonImage(name.intValue(), width.intValue(), height.intValue());
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user