Dragble GUI code for your game

Posted By: Sader

Dragble GUI code for your game - 01/07/07 13:45

http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/718253/an/0/page/0#Post718253
Posted By: Anonymous

Re: Dragble GUI code for your game - 01/07/07 13:52

Thanx a lot!
It's very usefull and well coded!
Also with snapping - wow!

thanx, mercuryus
Posted By: Germanunkol

Re: Dragble GUI code for your game - 01/07/07 14:12

Amen... this is great!
Posted By: HeelX

Re: Dragble GUI code for your game - 01/07/07 14:37

Nicely done.

One thing which I dont like is that you have to register these drag functions inside buttons or in the on_click function. It would be more useful and dynamic if you would register the panels like that with different modes and or additional panels (groups of panels). So, even if you have to write all the button-drag stuff in the button/panel definition you could leave out the registering and vice versa.

Try to improve it!
Posted By: Sader

Re: Dragble GUI code for your game - 01/07/07 15:25

You are saying that you would love to
assign drag function for panels not by changing panel descriptionbut but assign it by some another function for example like
function addDragFuncToPanel(panel_name)
{
}
?

I just have tryed some trick with this code of line
r.on_click = panelDragBgr;
and it worked
the problem is that panel on_click event should be empty becouse it will be overwrited, but this registration realy is pasible and it may be that it's realy more comfortable than changeing panel object manualy

it is better than r.on_click = panelDragBgr; ???
addDragFuncToPanel(r); // now can be draged if you will click on it's background

It look's that in 6.40v=> is possible add elements to panel dinamicly
if answer is yes than it's worth to try write funciion which add full panel.width button add the top of panel (like window caption bar) and will execute panelDragBtn()

can you explane this idea a bit
Quote:

different modes and or additional panels (groups of panels)



Posted By: HeelX

Re: Dragble GUI code for your game - 01/07/07 15:47

I dont like the idea to intermingle things. There I have my panel definitions with assigned functions for the game and there I have my GUI manager and there would be the "drag" manager which will be called each frame by my GUI system.

So I simply want to write into the init function of my GUI system drag_register(panel); and I'm ready. The idea of groups is a bit bigger: in window forms you've got usually the title bar to move around a window. So _I_ would register all panels belonging to a window (title bar, icons un the upper right resize panel, subelements like lists, checkboxes, whatever) into one window group ("all items belong to window Nr. X").
So, I would register then the title bar as drag source and if I move the title bar x=+10,y=+20 to the lower right corner, all group elements move the same. So I would register several panels first as a group and THEN I register one panel as drag panel.. all by function calls, because it could be that I want own functions inside buttons or on on_click
© 2024 lite-C Forums