Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2015 7:46:24 GMT -5
I have "option TEXTPRIORITY, LOW" set so that print and drawtiles graphics appear behind sprites. However, I'd like sprites to appear behind anything on the WINDOW plane where the score and stats are. Any ideas?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2015 8:55:21 GMT -5
I have "option TEXTPRIORITY, LOW" set so that print and drawtiles graphics appear behind sprites. However, I'd like sprites to appear behind anything on the WINDOW plane where the score and stats are. Any ideas? BasiEgaXorz doesn't have a way to toggle the priority of text at runtime, so your best option for text that doesn't use the priority as set by TEXTPRIORITY is to draw it yourself ( instead of using PRINT ). Below is a simple example .. s = addsprite(1,1) propsprite s,2,1 setgfxplane window 'print_priority uses gfxplane, not textplane! print_priority 1,1,"Come see me take my hand" print_priority 1,2,"Come see me in my land" windowprop left,up,0,4 x = 140 y = 140 on vblank gosub main enable interrupt vblank end main: j = joypad(0) x+= j.3-j.2 y+= j.1-j.0 movesprite s,x,y return declare sub print_priority(x as integer, y as integer, text$ as string) l = len(text$) dataptr& = varptr&(text$) for i=1 to l read t drawtile t+32768,x,y x++ next exit sub end sub Bonus points for whoever gets the reference ( without using Google )
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2015 9:04:57 GMT -5
Holy hblank Batman! Thank you for that example. Seems like a good demonstration of the use of varptr/dataptr and how tile priority is addressed (adding 32768)
This gives me ideas for drawing life meters and using multiple font sets too.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2015 13:09:12 GMT -5
Seems like an extra tile gets drawn at the rightmost end if I use the output of a string$() function. To mitigate this I changed
l = len(text$)
to
l = len(text$) - 1
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2015 13:34:53 GMT -5
You could change the for loop to for l = 1 to l instead of 0. Less code/operations when compiled
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Aug 4, 2015 13:51:14 GMT -5
Yikes .. my mistake Thanks for reporting, I've edited the example.
|
|
|
Post by wraith on Aug 4, 2015 16:54:31 GMT -5
Titan leading us forward where destiny may be...
|
|