DrawLib is an open-source vector drawing library for Mnemonimov, written in misa.
Creating a full vector drawing library, with every feature imaginable, would take an incredible amount of time for just one person to make. Therefore, I'm creating this project so that you can add functionality to a standard library easily.
- Pixel-aligned-centre circle drawing
- Line drawing using Bresenham's algorithm
Feel like there should be more on this list? Consider creating an issue with your idea for functionality, or you can even create it yourself, open a pull request, and it might be added straight into this repository.
To download DrawLib, you can:
- Click the green button titled 'code', and select 'Download ZIP',
- Unzip the folder
- Find the file under
<root>/source/DrawLib.misa - Copy and paste the contents into your Mnemonimov project, ideally at the top of the project.
Or just simply copy and paste the code from github directly.
To call a DrawLib function, simply put values into the correct argument registers, then use the cal instruction with the function.
These functions may be under categories like Circle or Line, so make sure you use those global labels, as well as the local labels of the function.
A function call may look like:
# load each argument
mov a0, 50
mov a1, 50
mov a2, 150
mov a3, 100
cal Line.DrawLine # <Global label>.<Local label>
Individual functions don't have a colour parameter, instead you need to set the fill colour manually.
To do this, set State.FillColour to a luma value (0-255):
str u8t, <colour>, State.FillColour