interface
var
client/client
list/screen
showing = 0
initialized = 0
anchor_x
anchor_y
x
y
control_flags = INTERACT_NONE
proc
Show()
if(!showing)
if(!initialized)
Init()
initialized = 1
showing = 1
if(screen) client.screen += screen
return 1
return 0
Hide()
if(showing)
showing = 0
if(screen) client.screen -= screen
return 1
return 0
Init()
showsleep(duration)
var/etime = world.time+duration
while(showing&&world.time<etime)
sleep(TICK_LAG)
return showing
Focus(interface/ofocus)
Unfocus(interface/nfocus)
keyPress(bind,taps,time,delta)
return control_flags&INTERACT_KEYBOARD ? 1 : 0
keyRelease(bind,taps,time,delta)
return control_flags&INTERACT_KEYBOARD ? 1 : 0
Click(atom/object,location,control,params)
return control_flags&INTERACT_CLICK ? 1 : 0
DblClick(atom/object,location,control,params)
return control_flags&INTERACT_DBLCLICK ? 1 : 0
MouseDown(atom/object,location,control,params)
return control_flags&INTERACT_MOUSEHOLD ? 1 : 0
MouseUp(atom/object,location,control,params)
return control_flags&INTERACT_MOUSEHOLD ? 1 : 0
MouseEntered(atom/object,location,control,params)
return control_flags&INTERACT_MOUSEHOVER ? 1 : 0
MouseExited(atom/object,location,control,params)
return control_flags&INTERACT_MOUSEHOVER ? 1 : 0
MouseMove(atom/object,location,control,params)
return control_flags&INTERACT_MOUSEMOVE ? 1 : 0
MouseDrag(atom/object,atom/over_object,src_location,over_location,src_control,over_control,params)
return control_flags&INTERACT_MOUSEDRAG ? 1 : 0
MouseDrop(atom/object,atom/over_object,src_location,over_location,src_control,over_control,params)
return control_flags&INTERACT_MOUSEDROP ? 1 : 0
MouseWheel(atom/object,delta_x,delta_y,location,control,params)
return control_flags&INTERACT_MOUSEWHEEL ? 1 : 0
onClick(hudobj/object,location,control,params)
set waitfor = 0
. = showing
onDblClick(hudobj/object,location,control,params)
set waitfor = 0
. = showing
onMouseDown(hudobj/object,location,control,params)
set waitfor = 0
. = showing
onMouseUp(hudobj/object,location,control,params)
set waitfor = 0
. = showing
onMouseEntered(hudobj/object,location,control,params)
set waitfor = 0
. = showing
onMouseExited(hudobj/object,location,control,params)
set waitfor = 0
. = showing
onMouseMove(hudobj/object,location,control,params)
set waitfor = 0
. = showing
onMouseDrag(hudobj/object,atom/over_object,src_location,over_location,src_control,over_control,params)
set waitfor = 0
. = showing
onMouseDrop(hudobj/object,atom/over_object,src_location,over_location,src_control,over_control,params)
set waitfor = 0
. = showing
onMouseWheel(hudobj/object,delta_x,delta_y,location,control,params)
set waitfor = 0
. = showing
onButton(hudobj/object)
set waitfor = 0
. = showing
Destroy()
for(var/hudobj/h in screen)
h.container = null
New(client/owner,showing)
src.client = ismob(owner) ? owner:client : owner
if(showing==null&&src.showing) Show()
else if(showing) Show()
Del()
if(client&&showing&&screen)
client.screen -= screen
screen = null
client = null
..()
hudobj
parent_type = /obj
plane = HUD_PLANE
layer = 0
var/tmp
id
interface/container
mouse_flags = INTERACT_NONE
screen_x
screen_y
New(interface/owner,id=null,x=0,y=0)
if(owner) src.container = owner
if(id) src.id = id
screen_x = x
screen_y = y
if(!screen_loc)
screen_loc = "[owner.anchor_x]:[x+owner.x],[owner.anchor_y]:[y+owner.y]"
Click(location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_CLICK) return container.onClick(src,location,control,params)
DblClick(location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_DBLCLICK) return container.onDblClick(src,location,control,params)
MouseDown(location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEHOLD) return container.onMouseDown(src,location,control,params)
MouseUp(location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEHOLD) return container.onMouseUp(src,location,control,params)
MouseDrag(over_object,src_location,over_location,src_control,over_control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEDRAG) return container.onMouseDrag(src,over_object,src_location,over_location,src_control,over_control,params)
MouseDrop(over_object,src_location,over_location,src_control,over_control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEDROP) return container.onMouseDrop(src,over_object,src_location,over_location,src_control,over_control,params)
MouseEntered(location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEHOVER) return container.onMouseEntered(src,location,control,params)
MouseExited(location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEHOVER) return container.onMouseExited(src,location,control,params)
MouseMove(location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEMOVE) return container.onMouseMove(src,location,control,params)
MouseWheel(delta_x,delta_y,location,control,params)
if(container&&container.showing&&mouse_flags&INTERACT_MOUSEWHEEL) return container.onMouseWheel(src,delta_x,delta_y,location,control,params)
ID:2142088
Sep 1 2016, 10:00 pm
|
|
Sep 1 2016, 10:00 pm
|
|
Implementation example:
|