GNF
New Member
Absorbing Gameduino2 Book and FT800 Programmer Guide, Nice!
Posts: 5
|
Post by GNF on Apr 20, 2014 7:03:19 GMT -8
Hi, I've just been reading FT800 Programmers Guide Version 0.8. On page 21 section 2.5.1. the Graphics Coordinate Plane is explained: The figure below illustrates the graphics coordinate plane and its visible area. The valid X and Y coordinate ranges from -1024 to 1023 in pixel precision, i.e., from -16384 to 16383 in 1/16th pixel precision.
 Is it possible to set the topleft coordinates of the visible area to something other than x,y = (0,0)? That would make scrolling so much easier. Ifso, what registers do I need to set for that? Ifnot, what's the use of being able to place objects outside of the visible area? GNF
|
|
|
Post by jamesbowman on Apr 20, 2014 14:50:06 GMT -8
OK, these questions are connected. AFAIK there is no scroll register: the top left coordinate is always (0, 0).
So to scroll you have to add an x,y value to every vertex. Placing objects outside the visible screen is useful when scrolling. As elements (bitmaps, points, lines) get scrolled off-screen, their coordinates can be outside the visible area. Because the hardware handles this, the CPU doesn't need to do clipping to draw partially-offscreen bitmaps, points and lines.
|
|
|
Post by jamesbowman on Apr 20, 2014 14:52:54 GMT -8
|
|
GNF
New Member
Absorbing Gameduino2 Book and FT800 Programmer Guide, Nice!
Posts: 5
|
Post by GNF on Apr 20, 2014 22:04:02 GMT -8
OK, these questions are connected. AFAIK there is no scroll register: the top left coordinate is always (0, 0). So to scroll you have to add an x,y value to every vertex. Placing objects outside the visible screen is useful when scrolling. As elements (bitmaps, points, lines) get scrolled off-screen, their coordinates can be outside the visible area. Because the hardware handles this, the CPU doesn't need to do clipping to draw partially-offscreen bitmaps, points and lines. Thanx for the quick reply. Okay. So I guess the large offscreen area is for drawing e.g. large bitmap objects when scrolling. Got thrown off guard here because of the passage: "X and Y coordinate ranges from -1024 to 1023 in pixel precision". Because of that passage I was hoping that maybe setting the visible area somewhere in that range was possible. But in hindsight I think I should've read the passage on page 21 as follows: The valid X and Y coordinate ranges from 0 to 511 in pixel precision when using cmd VERTEX2II (GD.Vertex2ii). The valid X and Y coordinate ranges from -16384 to 16383 in 1/16th pixel precision when using cmd VERTEX2F (GD.Vertex2f).
Why? 2.5.8 Screen coordinates using VERTEX2II and VERTEX2F
The VERTEX2II command used above only allows positive screen coordinates. If the bitmap is partially off screen, for example during a screen scroll, then it is necessary to specify negative screen coordinates. The VERTEX2F command allows negative coordinates. It also allows fractional coordinates, because it specifies screen (x,y) in units of 1/16 of a pixel.Still a bit misleading as VERTEX2F doesn't also allow fractional coordinates. It only allows fractional coordinates in units of 1/16 of a pixel. GNF
|
|
|
Post by jamesbowman on Apr 21, 2014 7:41:31 GMT -8
Yes, it is a bit confusing. The idea is that VERTEX2F can express a superset of the coordinate values that VERTEX2II can express.
I had to cover this in the Gameduino 2 book (p.55). It is hard to explain clearly.
|
|