CSharp
This plugin enables full access to Tellusim API from the C# programming language. It supports both the CSC and Mono compilers and is compatible with Windows, Linux, and macOS platforms. The plugin also includes a comprehensive and user-friendly 3D math library for high-performance graphics development.
info
The plugins/binding/csharp/source
directory contains C# bindings.
The target C# library is libTellusimCS
, which depends on libTellusimC
and 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) return;
window.setSize(app.getWidth(), app.getHeight());
// set close callback
window.setCloseClickedCallback((IntPtr data) => { window.stop(); });
// set keyboard callback
window.setKeyboardPressedCallback((uint key, uint code, IntPtr data) => {
if(key == (uint)Window.Key.Esc) window.stop();
if(key == (uint)Window.Key.F12) {
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::CSharp";
if(!window.create(title, Window.Flags.DefaultFlags | Window.Flags.VerticalSync) || !window.setHidden(false)) return;