Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (Grant), 999 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A question on layers.... #296518
11/01/09 14:43
11/01/09 14:43
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
How do you check the layer of a given panel?

For example, i trying to write a loop that looks at all panels in the game and tries to determine 1) was the mouse clicked over me? 2) was the mouse also clicked on a panel that has a higher layer than me?

Heres what im doing at present:

var mouse_click_x;
var mouse_click_y;
PANEL* curr_mouse_ptr;

function mouse_update_startup()
{ var mouse_click_flag;
mouse_map = mousepointer_bmap;
mouse_mode = 2;
enable_mouse = 1;
mouse_calm = 3;
while (mouse_mode>0)
{ mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
if(mouse_left&&mouse_click_flag==0)
{ mouse_click_flag = 1;
mouse_click_x = mouse_cursor.x;
mouse_click_y = mouse_cursor.y;
}
if(mouse_left==0)
{ mouse_click_flag = 0;
}
wait(1);
}
}

function mouse_left_overme(PANEL* panel)
{ if(mouse_click_x>panel.pos_x&&mouse_click_x<panel.pos_x+bmap_width(panel.bmap))
{ if(mouse_click_y>panel.pos_y&&mouse_click_y<panel.pos_y+bmap_height(panel.bmap))
{ curr_mouse_ptr = ptr_first(panel);
while(curr_mouse_ptr)
{ if(curr_mouse_ptr!=panel)
{ if(mouse_click_x>curr_mouse_ptr.pos_x&&mouse_click_x<curr_mouse_ptr.pos_x+bmap_width(curr_mouse_ptr.bmap))
{ if(mouse_click_y>curr_mouse_ptr.pos_y&&mouse_click_y<curr_mouse_ptr.pos_y+bmap_height(curr_mouse_ptr.bmap))
{ if(curr_mouse_panel.layer>panel.layer&&is(curr_mouse_panel,VISIBLE))
{ return(0);
}
}
}
}
curr_mouse_ptr = curr_mouse_ptr.link.next;
}
return(1);
}
}
return(0);
}

This all works fine except for "curr_mouse_panel.layer". This causes an engine crash. How do i find out what layer a panel is on?

Re: A question on layers.... [Re: Caermundh] #296523
11/01/09 15:17
11/01/09 15:17
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline
Senior Member
Razoron  Offline
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Have a look here. Hope this helps.

Re: A question on layers.... [Re: Razoron] #296532
11/01/09 15:47
11/01/09 15:47
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
Thank you, but thats not exacty what im looking for. mouse_panel tells me the current panel the mouse is over, but it does not tell me the layer of that panel.

Re: A question on layers.... [Re: Caermundh] #296553
11/01/09 17:53
11/01/09 17:53
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline
Senior Member
Razoron  Offline
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Code:
function xy()
{
	STRING*lyr=str_create("#20");
	str_for_num(lyr,mouse_panel.layer);
	error(lyr);
	str_remove(lyr);
}

.....

void main()
{
.....
on_j=xy;
.......
}



work for me fine.

Re: A question on layers.... [Re: Razoron] #296612
11/01/09 23:56
11/01/09 23:56
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
ok...so mouse_panel.layer works, but curr_mouse_ptr.layer doesnt....odd. Well I can work around it with mouse_panel.layer, i guess.

Thanks!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1