ID:153466
 
This will display a full-screen HUD. It works only with imported files (unless you set the icon states yourself... good luck). Make sure the imported file is the correct size in pixels to match your screen size.

Usage:
mob.CreateHUD('login.dmi',50) // 2 seconds


Proc:
mob
proc
CreateHUD(nicon, delay)
var/size = world.view * 2
size += 1 // size++ *shrug*
for(var/I=0,I<size,I++)
for(var/U=0,U<size,U++)
var/obj/screen/A = new /obj/screen/login(src.client)
A.screen_loc = "[I+1],[U+1]"
A.icon = nicon
A.icon_state = "[I],[U]"
src.client.screen += A
sleep(delay) // change to spawn(delay) and format tabs if you wish this proc to return immediately
for(var/obj/screen/login/A in src.client.screen)
del(A)


Not big enough to waste hub space on.


~Polatrite~
Polatrite wrote:
This will display a full-screen HUD. It works only with imported files (unless you set the icon states yourself... good luck). Make sure the imported file is the correct size in pixels to match your screen size.

Usage:
mob.CreateHUD('login.dmi',50) // 2 seconds

sleep(delay)

Actually, that'd be 5 seconds, because it measures in 1/10 of a second. :P

Anyway, the point of this post is to let you know this probably should have went in Creations.

~>Volte
Volte wrote: (in a paraphrased way ;)
You suck.

Polatrite wrote:
var/size = client.view * 2

Yeah, you're right about that. I had originally put 20, and decided that was a bit short for a login screen, so I changed it. Guess I forgot the comment. Was doing it all quickly. Also, you should use client view instead, since world view isn't always the same. The proc doesn't work with "11x13" view sizes and the like, so you'd have to adjust that yourself.
In response to Volte
Hmmm, I was about to post something like, "It's not like the forum descriptions label one explicitly as being for code snippets...", but then I checked, and found out, hey it does. Thank goodness for fact-checking. Now no one will ever know I was in error! HAHAHAHAH.... er, oops.
In response to Polatrite
Polatrite wrote:
Also, you should use client view instead, since world view isn't always the same. The proc doesn't work with "11x13" view sizes and the like, so you'd have to adjust that yourself.

A couple of procs that might be of assistance:
client/proc
sd_ScreenHeight()
if(istext(view))
return text2num(copytext(view,findtext(view,"x")+1,0))
else
return view * 2 + 1

sd_ScreenWidth()
if(istext(view))
return text2num(view)
else
return view * 2 + 1

In response to Shadowdarke
Heh, I was going to post something similar:
client
proc
xo_get_screen_dim(var/dimension)
var/client_view_x
var/client_view_y

if(istext(view))
var/x_pos = findtext(view,"x")
client_view_x = round((text2num(copytext(view,1,x_pos))-1)/2)
client_view_y = round((text2num(copytext(view,x_pos+1))-1)/2)
else
client_view_x = view
client_view_y = view

if(cmptext(dimension,"x")) return client_view_x
else if(cmptext(dimension,"y")) return client_view_y
else return list(client_view_x, client_view_y)

Of course, yours looks nicer.

~X