Correct line numbers, remove ptr arithmetic
This commit is contained in:
parent
af763ae9f9
commit
0eb3f5c49e
@ -52,7 +52,7 @@ void display(void)
|
|||||||
PutDrawEnv(&draw[db]);
|
PutDrawEnv(&draw[db]);
|
||||||
// We're using a reverse OT, so we want to display the last item first. See PsyQ's LibRef47.pdf, p.277
|
// We're using a reverse OT, so we want to display the last item first. See PsyQ's LibRef47.pdf, p.277
|
||||||
DrawOTag(&ot[db][OTLEN - 1]);
|
DrawOTag(&ot[db][OTLEN - 1]);
|
||||||
// Uncomment the following line to use a regular oredered OT. Uncomment l.100 accordingly
|
// Comment above line, and uncomment the following line to use a regular oredered OT. Comment l.71 and Uncomment l.73 accordingly
|
||||||
//~ DrawOTag(ot[db]);
|
//~ DrawOTag(ot[db]);
|
||||||
db = !db;
|
db = !db;
|
||||||
nextpri = primbuff[db];
|
nextpri = primbuff[db];
|
||||||
@ -69,17 +69,17 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Initialize the reversed ordering table. This means the elements at index OTLEN - 1 is drawn first.
|
// Initialize the reversed ordering table. This means the elements at index OTLEN - 1 is drawn first.
|
||||||
ClearOTagR(ot[db], OTLEN);
|
ClearOTagR(ot[db], OTLEN);
|
||||||
// Use regular order OT, uncomment l.77 accordingly
|
// Use regular order OT, uncomment l.53 accordingly
|
||||||
//~ ClearOTag(ot[db], OTLEN);
|
//~ ClearOTag(ot[db], OTLEN);
|
||||||
// yellow_tile is before pink and blue tile in the code,
|
// yellow_tile is before pink and blue tile in the code,
|
||||||
// and it displays behind because it is added to a different ot index (od[db] + OTLEN - 1)
|
// and it displays behind because it is added to a different ot index (od[db] + OTLEN - 1)
|
||||||
// Using a Regular or Reverse OT will have an effect on drawing order. (See lines 77 and 100)
|
// Using a Regular or Reverse OT will have an effect on drawing order. (See lines 53 and 73)
|
||||||
yellow_tile = (TILE * ) nextpri; // yellow_tile is a pointer to primbuf content at adress nextpri, that's cast (type converted) to a TILE struc.
|
yellow_tile = (TILE * ) nextpri; // yellow_tile is a pointer to primbuf content at adress nextpri, that's cast (type converted) to a TILE struc.
|
||||||
setTile(yellow_tile); // initialize the TILE structure ( fill the length and tag(?) value )
|
setTile(yellow_tile); // initialize the TILE structure ( fill the length and tag(?) value )
|
||||||
setXY0(yellow_tile, CENTERX - 32 , CENTERY - 48); // Set X,Y
|
setXY0(yellow_tile, CENTERX - 32 , CENTERY - 48); // Set X,Y
|
||||||
setWH(yellow_tile, 128, 40); // Set Width, Height
|
setWH(yellow_tile, 128, 40); // Set Width, Height
|
||||||
setRGB0(yellow_tile, 255, 255, 0); // Set color
|
setRGB0(yellow_tile, 255, 255, 0); // Set color
|
||||||
addPrim(ot[db] + OTLEN - 1, yellow_tile); // Add primitive to ordering table
|
addPrim(ot[db][OTLEN - 1], yellow_tile); // Add primitive to ordering table
|
||||||
nextpri += sizeof(TILE);
|
nextpri += sizeof(TILE);
|
||||||
// blue_tile added at od[db] + OTLEN - 2
|
// blue_tile added at od[db] + OTLEN - 2
|
||||||
blue_tile = (TILE * ) nextpri; // blue_tile is a pointer to primbuf content at adress nextpri, that's cast (type converted) to a blue_tile struc.
|
blue_tile = (TILE * ) nextpri; // blue_tile is a pointer to primbuf content at adress nextpri, that's cast (type converted) to a blue_tile struc.
|
||||||
@ -87,18 +87,18 @@ int main(void)
|
|||||||
setXY0(blue_tile, CENTERX - 16, CENTERY - 32); // Set X,Y
|
setXY0(blue_tile, CENTERX - 16, CENTERY - 32); // Set X,Y
|
||||||
setWH(blue_tile, 32, 64); // Set Width, Height
|
setWH(blue_tile, 32, 64); // Set Width, Height
|
||||||
setRGB0(blue_tile, 60, 180, 255); // Set color
|
setRGB0(blue_tile, 60, 180, 255); // Set color
|
||||||
addPrim(ot[db] + OTLEN - 2, blue_tile); // Add primitive to ordering table
|
addPrim(ot[db][OTLEN - 2], blue_tile); // Add primitive to ordering table
|
||||||
nextpri += sizeof(TILE); // Increment the adress nextpri points to by the size of TILE struct
|
nextpri += sizeof(TILE); // Increment the adress nextpri points to by the size of TILE struct
|
||||||
// pink_tile is after blue_tile in the code,
|
// pink_tile is after blue_tile in the code,
|
||||||
// so it is drawn before, thus under blue_tile.
|
// so it is drawn before, thus under blue_tile.
|
||||||
// However, it is added at the same ot index (od[db] + OTLEN - 2)
|
// However, it is added at the same ot index (od[db] + OTLEN - 2)
|
||||||
// so using a Regular or Reverse OT won't have an effect on drawing order.
|
// so using a Regular or Reverse OT won't have an effect on drawing order.
|
||||||
pink_tile = (TILE * ) nextpri; // pink_tile is a pointer to primbuf content at adress nextpri, that's cast (type converted) to a TILE struc.
|
pink_tile = (TILE * ) nextpri; // pink_tile is a pointer to primbuf content at adress nextpri, that's cast (type converted) to a TILE struc.
|
||||||
setTile(pink_tile); // initialize the TILE structure ( fill the length and tag(?) value )
|
setTile(pink_tile); // initialize the TILE structure ( fill the length and tag(?) value )
|
||||||
setXY0(pink_tile, CENTERX, CENTERY - 64); // Set X,Y
|
setXY0(pink_tile, CENTERX, CENTERY - 64); // Set X,Y
|
||||||
setWH(pink_tile, 64, 64); // Set Width, Height
|
setWH(pink_tile, 64, 64); // Set Width, Height
|
||||||
setRGB0(pink_tile, 255, 32, 255); // Set color
|
setRGB0(pink_tile, 255, 32, 255); // Set color
|
||||||
addPrim(ot[db] + OTLEN - 2, pink_tile); // Add primitive to ordering table
|
addPrim(ot[db][OTLEN - 2], pink_tile); // Add primitive to ordering table
|
||||||
nextpri += sizeof(TILE);
|
nextpri += sizeof(TILE);
|
||||||
FntPrint("Hello tile !");
|
FntPrint("Hello tile !");
|
||||||
FntFlush(-1);
|
FntFlush(-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user