Circular viewport (or camera) in GMS 2

C

Cjohs

Guest
Hi
I would like to make a circular secondary viewport for a minimap. How to go about that?
It is easy enough for me to create a rectangular one (with zooming and scrolling and all that) using the built in viewports, but a circular one...?? I dont know where to begin: can it be done using the built in stuff (viewports and cameras) or will I have to do the hard lifting myself?
 

icuurd12b42

TMC Founder
GMC Elder
draw your minimap to a surface instead of having another view
then draw a sprite on the surface with bm_subtract. The sprite being the shape you want where white and alpha 1 parts will turn transparent... and black, alpha 0 will remain intact
then draw the surface where your minimap would go
 
I'm trying to do something similar so that I can show the player an area off the map like a how you would imagine a surveillance camera. I've got it working using the view_set_surface_id function to but the shape is a square and if I try to set the surface to a circle using bm_subtract then I just get a circle but the viewport doesn't show up on the surface anymore.
 
Top