Java
This plugin enables full access to Tellusim API from the Java and Kotlin programming language. It supports Windows, Linux, macOS, and Android platforms. The plugin also includes a comprehensive and user-friendly 3D math library for high-performance graphics development.
info
The plugins/binding/java/include
directory contains JNI headers.
The plugins/binding/java/source
directory contains Java and JNI sources.
The target Java library is libTellusimJNI
, which depends only on libTellusim
.
See Readme.txt for build instructions.
// create app
App app = new App(args);
if(!app.create(Platform.Any)) return;
// create window
Window window = new Window(app.getPlatform(), app.getDevice());
if(!window.isValidPtr()) return;
window.setSize(app.getWidth(), app.getHeight());
// set close callback
window.setCloseClickedCallback(new Window.CloseClickedCallback() {
public void run() { window.stop(); }
});
// set keyboard callback
window.setKeyboardPressedCallback(new Window.KeyboardPressedCallback() {
public void run(int key, int code) {
if(key == Window.Key.Esc.value) window.stop();
if(key == Window.Key.F12.value) {
Image image = new Image();
if(window.grab(image) && image.save("screenshot.png")) {
Log.print(Log.Level.Message, "Screenshot\n");
}
}
}
});
// create and show the window
String title = window.getPlatformName() + " Tellusim::Java";
if(!window.create(title, Window.Flags.DefaultFlags.or(Window.Flags.VerticalSync)) || !window.setHidden(false)) return;