Kotlin OpenAL Arbitrary Sound using sine wave
GitHub: https://github.com/dickensas/kotlin-gradle-templates/tree/master/openal-generate
Around 50 Lines of Kotlin Code
GitHub: https://github.com/dickensas/kotlin-gradle-templates/tree/master/openal-generate
Around 50 Lines of Kotlin Code
Code DirectX 9 using kotlin
Kickstart Kotlin DirectX using WIN32 API's, DirectX SDK 2010
GitHub: https://github.com/dickensas/kotlin-gradle-templates/tree/master/win32-directx
Output window with WIN32 API
Around 150 line of Kotlin code
Easily create Kotlin based JavaFX Minecraft game using boilerplate Gradle DSL
GitHub https://github.com/dickensas/kotlin-gradle-templates/tree/master/minecraft-javafx
Kotlin Code
Easily create Kotlin based JavaFX using boilerplate Gradle DSL
GitHub https://github.com/dickensas/kotlin-gradle-templates/tree/master/kotlin-javafx
Kotlin Code
This article demonstrates easy way of generating C++ stub code including Java Generation for the corresponding C++ Classes using SWIG
The Gradle KTS project contains a sub module which contains the main source code, the header file and the SWIG file
The Gradle KTS is written in such way it will call the "swig" command line and generates the wrappers and copies the files to corresponding locations
The C++ compiler is auto chosen by Gradle cpp-library plugin, there is no need to write CMake or MakeFile or batch files for that
Code written in kotlin will get transformed to JavaScript NPM module which can be executed directly from Node.JS
GitHub https://github.com/dickensas/kotlin-gradle-templates/tree/master/js-nodejs
Simple Kotlin code
fun main() {
println ("hello")
test1()
}
The package.json which is manually created at root folder of the project
WebGLRenderingContext is a big API, it has 200+ properties and 100+ methods, writing a JavaScript stub and corresponding Kotlin stub is very difficult
We need to write 1400+ lines of JavaScript code and 3000+ lines Kotlin code
This Kotlin gradle script provides a simple approach to auto generate the stub and also compile the generated code to .klib
Gradle Stub Code in KTS
Kotlin WebAssembly runtime provides a global JavaScript array called heap
which can be accessed if the pointer of a variable is known
The pointer and size of the variable can be determined by library methods stringPointer and stringLengthBytes
The from JavaScript the value can be updated with below logic
Kotlin Main Code
From JavaScript as of now we cannot pass string to WebAssembly, therefore the string will be converted to an array of bytes and kept in browser's memory object of the kotlin web assembly framework object kotlinObject
From WebAssembly by calling the JavaScript method for each character, transfer the numeric value
Then convert the numeric value to character and combine to a string in kotlin
This is achieved using below code
JavaScript: string to UTF array utlity
Kotlin Shared DLL and Python Extension
GitHub: https://github.com/dickensas/kotlindll
Compile and Execute from MSYS2 or Cygwin with python development C header files
Demo Output
Python Code which calls the module