LoginLogin

How do Graphic, Map, and Fade layers stack?

Root / Programming Questions / [.]

ProKukuCreated:
So I’m trying to make GCIRCLEs on the screen, and there’s a map and a FADE layer. I know that the FADE layer is always on top, and I cleared the FADE before the Graphics commands, but the Map seems to block out any Graphics commands also, such as a GBOX not appearing on screen. I’m also in XSCREEN 4, so that may affect what’s going on. I then found out, by moving the map to the left, that the map wasn’t blocking the Graphics commands, they simply weren’t appearing at all. I used FADE and BACKCOLOR and they worked perfectly fine, but GCIRCLE and GBOX and etc. do nothing. Basically, I’m trying to figure out how to display those GBOX/CIRCLEs. Are maps always closer than graphics in layers? Does XSCREEN 4 mess up how graphics are produced?

Did you try messing around with GPRIO?

If you change the Z axis of the graphics screen to make it above the BG layer (GPRIO -256), it should show up.

I will reiterate what the others said and say that GPRIO is what you want to look into. Here is a small demo to demonstrate its use.
VAR SCREEN_W = 320, SCREEN_H = 480
VAR BG_W = SCREEN_W / 16
VAR BG_H = SCREEN_H / 16
VAR I, J, B

ACLS
XSCREEN 4, 256, 2
BGSCREEN 0, BG_W, BG_H

FOR J = 0 TO BG_H - 1
 FOR I = 0 TO BG_W - 1
  BGPUT 0, I, J, (I + J) MOD 2
 NEXT I
NEXT J

GPRIO -255
REPEAT
 B = BUTTON()
 GCIRCLE RND(SCREEN_W), RND(SCREEN_H), RND(60) + 10, RGB(RND(256), RND(256), RND(256))
 VSYNC
UNTIL (B AND #B) != 0
If you run the program, you should see circles drawn over the background tiles. If you comment out the GPRIO line you should see the circles drawn behind the background tiles. -256 puts the drawing commands in front of everything, and 256 puts them behind everything.

The annoying thing is that I didn’t even need to use GPRIO at all, the error was in the color code I used for the Graphics commands :/ Thanks for the responses though!