Old 07-24-2015, 09:46 AM   #1
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default JSFX - gfx_showmenu

gfx_showmenu works in JSFX :

Code:
desc:Show menu at mouse cursor

@init
last_clicked_item = -1;

@gfx
RMB_state = mouse_cap&2 == 2;

gfx_set(1,1,1,1);
gfx_x = 10;
gfx_y = 10;
gfx_drawnumber(last_clicked_item, 0); 

!last_RMB_state && RMB_state ? (
  gfx_x = mouse_x;
  gfx_y = mouse_y;
  last_clicked_item = gfx_showmenu("Top level - Item 1|>Submenu 1|SM 1 - Item 1|<>SM 2 - Last item of SM 1|SM 2 - Item 1|SM 2 - Item 2||<SM 2 - Item 3|Top level - Item 2||Top level - Item 3|");
);

last_RMB_state = RMB_state;
(I posted this because it isn't documented anywhere)





Here's the "gfx_showmenu" -function description (EEL)
Code:
EEL: gfx_showmenu("str")

Shows a popup menu at gfx_x,gfx_y. str is a list of fields separated by | characters. Each field represents a menu item.
Fields can start with special characters:

# : grayed out
! : checked
> : this menu item shows a submenu
< : last item in the current submenu

An empty field will appear as a separator in the menu. gfx_showmenu returns 0 if the user selected nothing from the menu, 1 if the first field is selected, etc.
Example:

gfx_showmenu("first item, followed by separator||!second item, checked|>third item which spawns a submenu|#first item in submenu, grayed out|<second and last item in submenu|fourth item in top menu")
spk77 is offline   Reply With Quote
Old 07-24-2015, 01:56 PM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: Holland
Posts: 2,926
Default

Hehe, cool!
Tale is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.