Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Script Menus - Preliminary Documentation
1 2 Previous Next
Parent - By Sven2 Date 2014-02-15 16:55
I'm all for floats there. Why would they be counterintuitive?

Formatting is only slightly more difficult (e.g.: Format("%d.%dem", foo/10, foo%10)). But even there I doubt fractional values occur very often. If you need dynamically sized menus, the size dynamics will probably be multiples of whole lines of text or icon sizes.
Parent - - By Zapper [de] Date 2014-02-14 12:40
PS: the not-pixels-as-absolute-unit thing has another drawback: stuff won't interact as good with menu decoration as it does now, because the menu decoration will always use pixel-graphics.
Suggestions?

Also, what should be the standard icon sizes we aim for? 4 * font size? In what size should be graphics be drawn? Just use 128x128?
Parent - By Newton [th] Date 2014-02-14 14:07
Like everything else, the menu decoration has to scale as well. We will have to make another menu decoration in higher resolution.
Parent - - By Sven2 Date 2014-02-14 14:31
Menu decoration would be zoomed with the font just like anything else.

In fact, I would implement this using the GUIZoom feature, which already exists for exactly this purpose. It zooms the coordinate system of GUI elements just like the game coordinate system is zoomed with the GameZoom setting.
Parent - By Zapper [de] Date 2014-02-14 17:06
Sounds good
Parent - - By Newton [th] Date 2014-02-14 07:28

> Margins


I understand it now. The implementation of the custom GUI currently has no notion of margins. Instead, margins are defined manually by
1. offsetting the Left+Top corner and
2. by subtracting double that offset from the width+height / by offsetting the Right+Bottom corner.
by the GUI designer.

I suspect that margins will be used almost in every menu, so it is something that might make sense to streamline. As I noted in the above post, it looks very unclean, unclear (especially if in this mixed relative+absolute syntax) and is thus quite error prone as one needs to repeat specifying the margin all the time (for each coordinate / size).
If such an implementation is left out however, I agree with you that using Left, Right, Top, Bottom is the clearer option.

I see the custom GUI implementation from the user's side (the GUI designer's side) and I would like to have it as easy to use as possible. Would you comment on the example syntax I gave here? In my eyes, it is easier to write/read while it does not take away flexibility.
Parent - By Zapper [de] Date 2014-02-14 09:22

>Would you comment on the example syntax I gave here?


I really have nothing against adding an exclusive notation for margins. But I think that the array notation for positions is only helpful in one case - when you have plain, relative coordinates like in your example.
- I don't feel that using nested arrays is the right thing to do when we want readability (Pos = [[500, -20], [23, -453]]). Especially if someone gets the idea to tag their positions.
- That way you would always have to give both coordinates. Currently, you can use the defaults (0, 0, 100%, 100%) a lot. I don't think I have many window definitions that define all four coordinates at the moment - especially if you ignore margins.
- You couldn't just do foo.X = 123; later in script. You would have to do foo.Pos[0]. And for that you'd have to make sure, that Pos is set: if (!foo.Pos) foo.Pos = [123, 0]; else foo.Pos[0] = 213;
The minimal gain we get in simple examples (Pos = [50, 420] instead of X = 50, Y = 420) does imo not make up the downsides coming from that notation.

Nevertheless, even with an extra margin-notation, I still favour the Left/Top/Right/Bottom notation. Not only because you have to do less manual math and at least I find it really comfortable to work with, but also because you can provide the scripter with sensible default values.
Parent - By Zapper [de] Date 2014-02-17 23:17
Parent - - By Zapper [de] Date 2014-02-15 17:22 Edited 2014-02-26 22:37
Okay, a write-up about some changes that I think are either necessary or at least pretty good ideas:

- change position syntax from X/Y/Wdt/Hgt = [<rel>, <abs>]  to Left/Top/Right/Bottom = "<rel>%+<abs>em"[DONE]
     - this of course includes changing the absolute position from pixels to em (1em = font height)[DONE]
     - also this would allow decimal values (f.e. Top = "1.5em")[DONE]

- add "Player" property for visibility (currently solved via "Target" property + Visibility for target object) [DONE]
- make the naming of the Gui functions consistent
- get rid of "CreateCustomMenu"[DONE - use CreateObject now]
- add a "Margin" property as described by Newton[DONE]
- change order of parameters of GuiAction_SetTag to be more intuitive[DONE]
Parent - - By Zapper [de] Date 2014-02-15 17:22

>- make the naming of the Gui functions consistent


Poll: Gui_Update or GuiUpdate? (With or without underscore?)
Parent - - By Newton [th] Date 2014-02-15 18:02
What all functions are there? Are the Gui-function in any way special that warrants a pseudo-namespace?
Parent - - By Zapper [de] Date 2014-02-15 18:21
engine functions:
Gui_Open
Gui_Close
Gui_Update
Gui_SetTag
Helper functions (probably more to come):
Gui_AddSubwindow
Gui_AddMargin
Gui_AddCloseButton
Gui_UpdateText
"Actions":
GuiAction_Call
GuiAction_SetTag

There is probably nothing "special". Only that there are more functions than with comparable things (CreateParticle etc.)
Parent - - By Newton [th] Date 2014-02-16 07:41
I'd go with GuiXYZ, without the underscore as we don't have this style anywhere else.

Where is the difference between GuiSetTag and GuiActionSetTag, GuiUpdate and GuiUpdateText?
Parent - By Zapper [de] Date 2014-02-16 08:47

>I'd go with GuiXYZ, without the underscore as we don't have this style anywhere else.


sounds sensible

GuiSetTag is a normal function that you call to update an UI. GuiAction_ are those things that you put into the menu definition: OnMouseIn = GuiAction_SetTag("Hover")
I guess I will rename all functions that do something with existin GUIs to start with GuiUpdate (f.e. GuiUpdateTag).

The text updating function is just a wrapper for the normal one, that updates the Text property (because that's a common task)
Parent - - By Maikel Date 2014-02-15 18:21
If they are engine functions, without.
Parent - By Zapper [de] Date 2014-02-15 18:22
They are both and I want to unify the naming between both (the scripter does not care whether GuiUpdate is an engine function and Gui_UpdateText is a System.ocg function or not)
Parent - By Newton [th] Date 2014-02-15 18:13
      |▔\
      )  )
     /  /▂▂
▂▂╱ ▕▂▂▂▏
▉      ▕▂▂▂▏
▉     ▕▂▂▂▏
▔▔╲▂▕▂▂▏
Up Topic Development / Developer's Corner / Script Menus - Preliminary Documentation
1 2 Previous Next

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill