By Dominik Alessandri & Christian Wietlisbach
Hochschule Luzern Technik & Architektur
As part of our bachelor thesis, along with our Kinect module described last month, we developed a printscreen plugin for Open Wonderland. When the plugin is installed on a server, all connected users can choose if screenshots should be saved locally or on the server. If saved on the server, the pictures can be displayed in an automatically updated photo gallery. The update of the picture gallery is made with a shell script which is running as task in the background on the server. We had to implement it this way, as we did not find a way to save directly in the ‘docRoot’ folder in the ‘run’ directory. The shell script uses rsync to keep these two folders in sync.
When a user is connected to a server with the printscreen plugin installed, he can display the controls of the plugin by selecting ‘Window -> Printscreen Folder’:
The Printscreen Folder dialog allows the user to choose where to save the images:
When pressing the ‘o’ key, a new screenshot will be taken and either saved locally or on the server. The reason why the key binding was done with ‘o’ is very simple: The printscreen key is not forwarded from the client to the module. The capture of the key event is done on a level before the module gets the event. On this higher level, the “Print Screen” key is filtered and the module doesn’t get any event. Instead the message “Key is not allowed” appears. Version 3 of jMonkey will support taking screenshots by default, making it easier to capture the screen.
On the server-side, the screenshots are saved in /.wonderland-server/0.5/run/content/images/screenshot/. This folder should be created by an administrator when installing the plugin.
To run the photogallery, the content of the file ‘lightbox.zip’ needs to be extracted to /.wonderland-server/0.5/run/docRoot/lightbox/. This photo gallery shows all images stored in /.wonderland-server/0.5/run/docRoot/screenshot/. To update the photo gallery, we need a background task which copies the files from /.wonderland-server/0.5/run/content/images/screenshot/ to /.wonderland-server/0.5/run/docRoot/screenshot/. For example, the shell-script ‘copyScreenshot.sh’ can do the job.
An example of this photo gallery can be seen here: http://184.108.40.206:8080/lightbox/
You will need the following files to get the printscreen plugin running:
- printscreen-plugin.jar (http://220.127.116.11:8080/modules/ScreenshotPlugin/printscreen-plugin.jar)
- lightbox.zip (http://18.104.22.168:8080/modules/ScreenshotPlugin/lightbox.zip)
- copyScreenshot.sh (http://22.214.171.124:8080/modules/ScreenshotPlugin/copyScreenshot.sh)
- rsync or similar