As I began designing modules, I quickly ran into trouble trying to make some sheets customizable, so I decided to try creating an external class to enable drawing. In order to do that I’ve created a transparent piece as large as the map, then used scripting to treat it as a screen, so the only hard part was creating a simple paint software for that (thanks GPT5.2, I don’t know Java).
The following is a link to Filebin with the source code, the compiled one, my vassal module test bench and a short video demonstration (I’ll try my best to keep this link updated): Filebin | 7hhljn97pvv8255s
Right now, if you want to try it out on one of your modules:
- Download the drawing.zip, unpack it and put the drawing folder in the main directory of the vmod file.
- Modify the buildFile.xml on one of the first lines (“<VASSAL.build.module.BasicCommandEncoder/>”) so that it becomes “<drawing.DrawingCommandEncoder/>”
- Create a transparent piece as large as the map and put it in an At-Start-Stack in the middle of the map.
- Add the Does Not Stack trait with Move=NEVER
- Import the “drawing.DrawingLayer” class
- Put it as a trait. You can set up Draw/Text color RGB, line thickness, gum radius, text font and text size.
This will give you the minimum setup, that is, CTRL+D to enter Draw mode, CTRL+T to enter Text mode, ESC to leave any mode. Use LMB to draw/create a text box/edit a created text box. Hold down CTRL and use LMB to erase text/drawing. Note: I highly suggest to use only the draw’s eraser function, as the text’s eraser is laggy and doesn’t work on drawing, while the draw’s eraser works on both.
In order to add buttons I’ve used the GumLatch Dynamic Property, which speaks directly with the Java class, to toggle a virtual CTRL on/off, while the rest is just some work with Global Key Commands and Global Properties.
If you want to try my implementation, open the East&West module I’ve loaded into filebin, join as East player and open the East Codes & Naval.
I hope this will make designing some modules possible and/or easier.
I encourage you to take a look at the source code and modify it to make it better!
