theog
Junior Member
Posts: 13
|
Post by theog on Jan 10, 2016 7:22:44 GMT -8
Hello guys, Is it possible to load more than 15 Assets in one Arduino sketch? The asset converter doesn´t convert more than 15. Thank you.
|
|
|
Post by jamesbowman on Jan 10, 2016 12:14:31 GMT -8
I assume you have some images that are the same size. For example a set of icons. The first step is to combine all the smaller images into a "master" image with all the smaller ones stacked vertically. For example the "walk" animation frames are 32x32, and can be formatted vertically like this: Then after asset loading, do: GD.BitmapHandle(STACKED_HANDLE); GD.BitmapLayout(GD.ARGB4, 32, 32);
This tells the GPU to treat the bitmap as 32x32 tiles, with the "Cell" argument to GD.Vertex2ii() specifying which tile to use. So you can now draw one of the images with: GD.Vertex2ii(x, y, STACKED_HANDLE, 3); // draw 3rd image
|
|
|
Post by tftlcdcyg on Jan 16, 2016 21:08:47 GMT -8
What is wrong? #include <SPI.h> #include <GD2.h>
#include "walkx.h"
void setup() { GD.begin(); LOAD_ASSETS(); GD.BitmapHandle(WALK1_HANDLE); GD.BitmapLayout(ARGB4, 32, 32); }
void loop() { GD.Clear(); GD.Begin(BITMAPS); GD.Vertex2ii(50, 25, WALK1_HANDLE, 3); // GD.swap(); } Attachments:
walkx.gd2 (2.65 KB)
walkx.h (228 B)
|
|
|
Post by jamesbowman on Jan 16, 2016 21:33:56 GMT -8
Oops. BitmapLayout should be the number of bytes in a line, which for ARGB4 is 2 bytes per pixel. Try:
GD.BitmapLayout(ARGB4, 2 * 32, 32);
|
|