project-navigation
Personal tools

Author Topic: GUIs  (Read 23680 times)

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: GUIs
« Reply #15 on: September 30, 2008, 03:31:03 pm »
I look at more specifically the "src/client/menu" code last weekend and i think i understand it sufficiently to know how to clean up; to allow next time the possibility to expand it. I propose only a code restructuration for the first time, because currently this code look to me very hard to maintain.

If you think you will continue to use your "menu" code, without changing it for a third party, maybe i can help you by working a little on it.

This aim to create "real" componants by removing dependancy from the core (mn_input, mn_display...) to the nodes. All this steps can be done transparentelly for the global architecture, i think.

  • Move node function (event, call) into node file (foobar_diplay, foobar_click functions -> node_foobar.c)
  • Normalize all node function. Example: only foobar_clickright(menu, node, x, y), instead of both clickright(x, y) or some clickright(menu, node)
  • Create a node object. Something look like struct node_object{void clickright(menu, node, x, y);void display(menu, node);...} And create one instance by beaviour node existing
  • Remove simple switch from the core. Something look like switch(node->type) can now be remplaced by something look like node_object_list[node->type].clickright(menu,node,x,y) where node_object_list contain all node beaviour
  • Remove last use of MN_CONTAINER, MN_CHECKBOX... from the core, by adding new function/var/returnValue into the node beaviour structure.
  • Thinking about cleaning the node structure of node instance data (for example the node->height). Iv got simple idea to do it without changing a lot of thing.

The core can now work with only a node description, without special case (no use of MN_...).
Its more easy to add new component, and to change beavious. We can easilly create new componants, more complex, or adding new events (mouseover?)... and thinking as an OO program.

Are you interested by that? I dont think its a too much long work, but i realy think it's
a need (if i dont missed a big thing). But its important to understand its only a code
restructuration. At the end of all this thing, there are no more functionality, but, i hope
a more extenssible code. I can work on this part of the code if you want... but i am very slow and i dont have access to the svn (access restricted).

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: GUIs
« Reply #16 on: September 30, 2008, 04:09:56 pm »
Thanks for offering help, it's always appreciated.

btw We don't wanna make it OO, AFAIK, notihng is OO in ufo (but It's rather for Mattn).

I'm working on "floating menus" so we'll have to coordinate it not messing eachother's work. I have only some (2-3) bugs left maybe you could help fixin' them. Join on IRC in the evening (CEST) if possible. :)

-geever

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: GUIs
« Reply #17 on: September 30, 2008, 06:38:22 pm »
I dont talk about C++.

Hard to me to explain that. You can architecture a C for something like OO (as i say, a struct for behavior of your "node"). I can say it with a draw if it need. struct behavior for your node is the same as an object for an instance in OO. Its just a code architecture.

The only need i understand is the use of C (i dont understand very well why, but its not a problem for me). Not spending time into a better architecture (reducing dependency) is a non sens (you think it slower? you think its over complex?). In this perspective, i am not interested, because while you will add thing into your code, more you will spend time in maintenance and repair.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GUIs
« Reply #18 on: October 01, 2008, 07:41:30 am »
cleanup is always welcome. feel free to start it. in general you have to provide one or two patches in order to get write access to the svn.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: GUIs
« Reply #19 on: October 01, 2008, 11:26:58 am »
Ok, i can test that.

I work a little on a tab header. I can send a little patch about it in a few day to test (because i never use sourceforge or diff), and why not, a bigger one next time. But, went it need a big work, I prefer talking, thinking about change, and problems with every body, instead of spend a long time for nothing.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GUIs
« Reply #20 on: October 01, 2008, 07:02:09 pm »
for those cases you should join our irc channel at irc.freenode.org #ufo:ai

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: GUIs
« Reply #21 on: October 03, 2008, 02:29:06 pm »
unfortunaltly i surf throug an HTTP proxy, i dont think i can connect to IRC freenode :/

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: GUIs
« Reply #22 on: October 06, 2008, 11:00:46 am »
I send a patch about tab, but i v got a little question.

I use a png texture, it look to me the texture use something like a lossy based compression ?! When i change the texture resolution with the game option, some transparent effect, or stretching look strange. For a GUI, its very important to use a "pixel precision" (at least for the 1024x7xx version :D).

Anybody know how work the caching process of textures? Because I am not sure about what i say. And is it technically possible to force a loseless caching texture for loseless format of GUI (for example, all PNG/TGA of the /pics/menu directory)

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GUIs
« Reply #23 on: October 06, 2008, 07:06:17 pm »
have a look at r_image.c: R_UploadTexture, R_FindImage and R_LoadImageData

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GUIs
« Reply #24 on: October 06, 2008, 07:09:08 pm »
btw. i've applied your patch to trunk

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: GUIs
« Reply #25 on: October 07, 2008, 10:34:55 am »
I already look at that, but i dont understand very well all this thing :D

Now, i am working around the GUI code architecture. More i look at the code, more i think it need to change a lot of thing. I never contribute to an open source projet by sending patch, so i realy dont know. Do you want i send you often little patch, or a few big?

With little, its maybe easy to see that the code dont change at all, there are only "refactoring" (extract method, move code and method, change param...), it maybe more easy to apply it. With a big, it will not be so easy, maybe, but at the end, it the same result.

Offline Kildor

  • Project Artist
  • Captain
  • ***
  • Posts: 757
  • Project mapper and some other stuff`er
    • View Profile
    • http://ufoai.nx0.ru
Re: GUIs
« Reply #26 on: October 07, 2008, 04:00:53 pm »
May be some small patches, and after it -- direct access to SVN?

But I`m not a coder and not a "power-SVN-user"

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: GUIs
« Reply #27 on: October 07, 2008, 05:04:21 pm »
yes, what about svn access? if you want it, let me know.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: GUIs
« Reply #28 on: October 08, 2008, 11:08:53 am »
Sure, it will be a nice help, but you are very confidant :o i hope i will not broke your trunk.

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: GUIs
« Reply #29 on: October 08, 2008, 11:12:28 am »
It's not like other people aren't breaking trunk all the time anyway, including mattn.