|
openwallpaper
|
OpenWallpaper scene file format is .owf. It is a ZIP archive containing scene.wasm WebAssembly module and any kind of asset files you need. In scene.wasm, you must implement two functions:
In module, you can call any extern function from openwallpaper.h. These functions are implemented by the host application and encapsulate all the platform-specific logic, so .owf is completely platform-independent.
Let's make a basic scene module that does not draw anything and just prints "Hello, world" in console. In this guide we will write in C, but you can use any language that can be compiled to WebAssembly. First, let's get necessary tools:
Create scene.c file with the following content:
Compile it to WASM module with following command:
Compress the resulting scene.wasm module into ZIP archive with your preferred tool and name the archive e.g. scene.owf. Then, run it with wallpaperd:
You should see a black screen wallpaper and "Hello, world!" output in console.
Let's get screen resolution using ow_get_screen_size function from OpenWallpaper API. Download openwallpaper.h header and place it in your working directory. Write following code in scene.c:
Rebuild and run the scene with wallpaperd, like before. You should see a black screen wallpaper and your screen resolution in console.