Arduboy FX Arduino plugin

I made an Arduino plugin to make building and uploading FX data easy from the Arduno IDE.
Trying out one of the FX examples or just uploading a FX game from source is a breeze now:

fx-upload-using-plugin

Due to limitations of the Arduino IDE, the plugin must be installed manually. To grab the plugin tool and installation info, head over to:


Edit: Updated to version 1.02:
8 Likes

Incredible :heart_eyes: can’t wait to use this, excited to see what others will try now that it’s more accessible!

1 Like

The current FX examples need a bit of adjusting to work with the plugin but I’m working on an update to fix that.

VSCode allows you to configure tasks. The default configuration for verify / build are below. I haven’t loaded your integration yet, but assume you could configure a new task?

// A task runner that compiles / uploads the current .ino sketch
//
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
//
{
	"version": "2.0.0",
	"command": "arduino",
	"tasks": [
		{
			"label": "--verify",
			"type": "shell",
			"command": "arduino",
			"args": [
				"--verify",
				"-v",
				"${file}"
			],
			"problemMatcher": {
				"owner": "external",
				"fileLocation": [
					"relative",
					"${fileDirname}"
				],
				"pattern": {
					"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
					"file": 1,
					"line": 2,
					"column": 3,
					"severity": 4,
					"message": 5
				}
			},
			"group": {
				"_id": "build",
				"isDefault": false
			}
		},
		{
			"label": "--upload",
			"type": "shell",
			"command": "arduino",
			"args": [
				"--upload",
				"-v",
				"${file}"
			],
			"problemMatcher": [],
			"group": {
				"_id": "test",
				"isDefault": false
			}
		}
	]
}

The Arduino command line parameters are very limited. There is no way to launch the tool from command line. So an Arduino VSCode task for it isn’t an option :confused:

Is there an accelerator key on your menu option?

Was sort of wondering in VSCode if you could script a key sequence.

Actually, can you invoke your code outside of the IDE?

No, didn’t find a way.

The java module not. But the python scripts can (java just generates the paths to python and the files)


Updated the Homemade package so FX library examples should work fine now

I have a single image which is a 10 x 11 png (no transparency) which has a black border.

If I run the code:

    arduboy.drawFastHLine(0, 6, 128);
    arduboy.drawFastHLine(0, 0, 128);
    FX::drawBitmap(0, 0, Keyboard_W_01, 0, dbmNormal);
    FX::drawBitmap(20, 0, Keyboard_W_01, 0, dbmWhite);
    FX::drawBitmap(40, 0, Keyboard_W_01, 0, dbmBlack);
    FX::drawBitmap(60, 0, Keyboard_W_01, 0, dbmInvert);
    FX::drawBitmap(80, 0, Keyboard_W_01, 0, dbmOverwrite);
    FX::drawBitmap(100, 0, Keyboard_W_01, 0, dbmReverse);

I get:

ArduboyCapture(21)

The dbmReverse image is a little strange as it has rendered a two pixel border whereas the others have not. It does have an odd number Y dimension. Is this incorrect?

1 Like

Interesting.Thanks for the bug report. I think the culprit is in this line:

ArduboyFX.cpp line 629:

0xFF should probably be rowmask Will test this as soon as I can

Glad the post made sense :slight_smile:

The fix wasn’t as simple as that afterall but it has been fixed in the latest Homemade package version 1.3.3 :slight_smile:

Alternatively you can just grab the version 1.0.2 FX library files from here

Great … I will update to this version!

Sorry to make you do extra work. I am loving developing with this library - especially as there are more options with the graphics portion.

I tried to make an array of int8_ts today but found that fxdata-build.py did not like negative numbers.

Also, when defining the fxdata file I would love to be able to declare my images within a namspace. Its just a personal habit, but I tend to put images in their own namespace as often their name clashes with the class names of entities.

1 Like

NP I like the feedback and it only makes the library better.

Ah right ! Will look into it.

can you give an example of that?

BTW drawBitmap also supports frames like Arduboy2 Sprites::draw.

You put all the letter images of LeWord in a single image and make the filename end with ‘_10x11.png’ or _10x11_1.png’ when each frame is padded by 1 pixel for example:

‘font_5x8_1.png’
font_5x8_1

In your code you’d change the 0 into frameIndex:

FX::drawBitmap(x + xOffset, y + 1 + yOffset, Images::Keyboard_B[i], 0, dbmWhite);

into

FX::drawBitmap(x + xOffset, y + 1 + yOffset, Images::Keyboard_B, frameIndex, dbmWhite);

Do you mean how one would expect to do it within fxdata, or an example of how it would be done in a ‘classic’ Arduboy game?

Assuming you mean the latter:

(Any file but Images.h will show you an image defined in the namespace Images.)

I’ve got a feeling this is a habit @filmote has ‘caught’ from me.
Either that or it’s just great minds thinking alike.

Thanks that what I needed to know. I’ll see what I can do.

1 Like

Ok I’ve updated fxdata-build.py of the Arduino plugin and Python utilities.

You can use negative numbers, namespace and current fx data pointer

for negative numbers there may not be a spece between - and the number

a namespace can be defined like in C++ but additionally must be terminated by namespace_end

namespace name
{ 
}
namespace_end

Note that the curly brackets are purely cosmetic and may be omitted.

To create a constant expresstion that points to the current fx data pointer (compile time) you can use something as

Label = .

Note the ‘.’ is purely cosmetic and may be omitted

Another new feature is that constant expressions are created for image width, height, and the number of frames (the frames constant is only created if there is more than one frame).

Awesome. I have used the namespace feature already in my LeWord.

I would say so. It is nice to have qualified names though as it just makes the code easier to read.

Nah, like most programmers I just steal ideas.

3 Likes