ID:2536870
 
Note
Things added to mob.screen will use pixel_x & pixel_y instead of screen_loc for positioning.

mob/var/tmp/obj/screen/screen

mob/Login()
screen = new(client)
screen.Add("Pie",new/obj/pie{pixel_x=196;pixel_y=64})
screen.Show("Pie")

obj/screen
appearance_flags = PLANE_MASTER
screen_loc = "1,1"
New(client/c){hud=new;c.screen+=src}
var list/hud
proc
Add(id,o)
if(id in hud){return FALSE}
hud[id] = o
return TRUE
Show(id)
if(!(id in hud)){return FALSE}
vis_contents |= hud[id]
return TRUE
Hide(id)
if(!(id in hud)){return FALSE}
vis_contents -= hud[id]
return TRUE
Why is it better?
You can use animate(), moving the position of things on-screen with ease.

0,0 being the bottom-left of the screen
In response to Kozuma3
You can do this already by animating an atom's transform.
In response to Crazah
Crazah wrote:
You can do this already by animating an atom's transform.

Nice. With this you just edit a variable but it's up to whoever decides to do stuff.
Good stuff. I've been waist deep in this space. Providing a multiplayer snippet could be useful as well. Showing how you vis_contents.Add() objects to another object and then Add() that containing object for all players to see everything.
Actually incorporating this approach into my latest game. I really like the simplicity of it. Especially the ability to show and hide by id. I'm hoping this simplifies some things for me.
In response to PopLava
PopLava wrote:
Especially the ability to show and hide by id. I'm hoping this simplifies some things for me.

It's very useful :D, modifying pixel_x & pixel_y is easy compared to screen_loc, you can even use vis_flags to easily hide objects as well from vis_contents instead of removing them.
vis_flags must be in 513?

Login to reply.