While using a GUI Control is ideal for stuff related to clicking, with normal displays you could try something such as this:
PHP Code:
//#CLIENTSIDE
function showHUD(){
this.addHUDObj(this.showimg(200, "image.png", x, y), 32, 32, 4);
this.addHUDObj(this.showimg(201, "image2.png", x, y), 64, 64, 4);
temp.t = this.showtext(202, x, y, "tempus sans itc", "b", "text");
temp.t.zoom = 0.5;
temp.w = gettextwidth(temp.t.zoom, temp.t.font, temp.t.style, temp.t.text);
temp.h = gettextheight(temp.t.zoom, temp.t.font, temp.t.style, temp.t.text);
this.addHUDObj(temp.t, temp.w, temp.h, 5);
}
function addHUDObj(temp.display, temp.w, temp.h, temp.layer){
temp.display.dwidth = temp.w;
temp.display.dheight = temp.h;
temp.display.layer = temp.layer;
this.displays.add(temp.display);
}
function onMouseDown(temp.button) {
if(temp.button != "left")
return;
for(temp.d : this.displays){
if(
mousescreenx in <temp.d.x, temp.d.x + temp.d.dwidth> &&
mousescreeny in <temp.d.y, temp.d.y + temp.d.dheight>
){
this.startDrag(temp.d);
return;
}
}
}
function startDrag(temp.d){
this.dragobj = temp.d;
this.draglayer = this.dragobj.layer;
this.draglayer = 6;
this.dragoffx = mousescreenx - this.dragobj.x;
this.dragoffy = mousescreeny - this.dragobj.y;
this.scheduleEvent(0.05, "Drag", "");
}
function onDrag(){
if(!leftmousebutton){
this.dragobj.layer = this.draglayer;
return;
}
this.dragobj.x = min(max(0, mousescreenx - this.dragoffx), screenwidth - this.dragobj.dwidth);
this.dragobj.y = min(max(0, mousescreeny - this.dragoffy), screenheight - this.dragobj.dheight);
this.scheduleEvent(0.05, "Drag", "");
}