|
Post by marekspychalski on Nov 29, 2018 2:01:14 GMT -8
Hi there,
I'm having trouble with displaying image converted to binary file with LOAD_ASSETS(). I'm trying to display it with GD.Vertex2ii( 610, 20, 1), where 610=x, 20=y, 1 = handle, but I know that x can not be bigger than 511 pixels. So i tried to use GD.Vertex2f( 610 * 16 , 20 * 16 , 1), but it didn't work because GD.Vertex2f does not receive third parameter. Do you have any suggestion how to display asset with x position >511 ?
Thanks in advance
|
|
|
Post by tftlcdcyg on Nov 29, 2018 6:43:56 GMT -8
VertexTranslateX allows to overcome the limit of the 511 px For example: GD.SaveContext(); GD.VertexTranslateX(610*16); GD.Vertex2ii(0, 240, 4); //asset 4 GD.RestoreContext(); VertexTranslateX or VertexTranslateY in action! MCU: Nucleo F767ZI TFT: NHD 7" (800x480 px, FT813) Library: gameduino 2/3 modified for STM32 and teensy 3.6, with SdFat library core FT81xmania team.
|
|
|
Post by jamesbowman on Nov 29, 2018 8:08:22 GMT -8
Yes, you can do:
GD.BitmapHandle(h); GD.Cell(c); GD.Vertex2f(x * 16 , y * 16 , 1); which is just the same as:
GD.Vertex2ii(x, y, h, c);
except that it allows coordinates outside 0-511.
I sometimes make a small function to optimize this:
void vx(int x, int y, int h = 0, int c = 0) { if (((x | y) & ~511) != 0) { GD.BitmapHandle(h); GD.Cell(c); GD.Vertex2f(x * 16 , y * 16 , 1); } else { GD.Vertex2ii(x, y, h, c); } } So you can just use vx() all the time instead of Vertex2ii()/Vertex2f().
|
|
|
Post by marekspychalski on Nov 30, 2018 4:09:39 GMT -8
good job my friends it WORKS!! thank you!
|
|