0 Members and 1 Guest are viewing this topic.
Hello,The code I'd posted previously (the little sprite command), shows how to load colors to a grob, and how to scale it.Code: [Select]EXPORT Sprite()BEGINDIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));WAIT(3);END;Note that scaling is only a pixel by pixel things. It doesn't not interpolate. Also note that you can specify different source regions from the grob. This means you could have a larger grob containing a tileset, and blit in from a specific location.
EXPORT Sprite()BEGINDIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));WAIT(3);END;
You forgot to remove the WAIT(0.02) commands That said, we already notice it's not even running at 50 FPS like the WAIT command tried to slow it down to, but there will be a speed gain if you remove it for sure.
Quote from: timwessman on August 12, 2013, 03:09:42 amHello,The code I'd posted previously (the little sprite command), shows how to load colors to a grob, and how to scale it.Code: [Select]EXPORT Sprite()BEGINDIMGROB_P(G2,4,4,{ #7C0003E0001F0000:64, #0, #0, #7C0003E0001F0000:64 });BLIT_P(G0,20,20,100,100,G2,RGB(0,0,0));WAIT(3);END;Note that scaling is only a pixel by pixel things. It doesn't not interpolate. Also note that you can specify different source regions from the grob. This means you could have a larger grob containing a tileset, and blit in from a specific location.I've tried some of my own 4x4 sprites and they work fine. However, I can't manage to go beyond 4x4 because I can't specify hex strings longer than 64 bits. Any way that bigger sprites can be done (using hex strings)?
That looks great! By the way, how is the directional pad in the center? Does it feel solid, and is it responsive?
By the way, is there any image<>hex converter that supports A1R5G5B5 format or something that can convert JPEG/BMP/GIF to exactly that image format?
Quote from: DJ Omnimaga on August 12, 2013, 04:06:06 amBy the way, is there any image<>hex converter that supports A1R5G5B5 format or something that can convert JPEG/BMP/GIF to exactly that image format? No, don't have anything for that. Sorry. (might tweak one and post it later though). It is a very basic encoding scheme though.Basically, all that is happening is that you convert a #FF value into a linearly scaled #1F value. Here is a C macro that shows how this is done internally.#define RGBToColor(R,G,B) (((R>>3)<<10)+((G>>3)<<5)+((B>>3))) // transforms 0-255 RGB into colorThe 16 bit is just a flag that signifies transparency.Note that the DIMGROB command just takes the information in order. So if you want to make a 6x3 grob, The first 4 16 bit groups come out of the first hex numb, the next hex num takes the first 2 and then the last 2 are the start of the second line and so on... { |#64bits, #(upper32)||(lower32), #64bits|,|#64bits,#(upper32bits)|(unused) }.Each line in the 6 width takes the first 6 16 bit groups it finds. Each "line" of the grob is defined between the paired | |. Remember that all hex numbers, regardless of sign/unsigned/bits is internally 64 bits of data.
And here is a small converter for windows : img2prime.zip (just drag and drop the image to convert on it) (image)It even handles transparency But I'm not sure if the ":64" are always necessary.