-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add formspec toolkit and refactor mainmenu to use it #1241
Conversation
This makes the main menu much cleaner. |
-- | ||
--You should have received a copy of the GNU Lesser General Public License along | ||
--with this program; if not, write to the Free Software Foundation, Inc., | ||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lua files don't normally have full license headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lua files have grown to an extent where headers are reasonable
refused due to silly naming dogmas closing |
dofile(scriptpath .. DIR_DELIM .. "fst" .. DIR_DELIM .. "dialog.lua") | ||
dofile(scriptpath .. DIR_DELIM .. "fst" .. DIR_DELIM .. "tabview.lua") | ||
dofile(scriptpath .. DIR_DELIM .. "fst" .. DIR_DELIM .. "ui.lua") | ||
dofile(scriptpath .. DIR_DELIM .. "ngmm" .. DIR_DELIM .. "common.lua") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ngmm
and fst
shouldn't be so abbreviated, you can't tell what they are without looking at the doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding a folder formspectoolkit as well as nextgenerationmainmenu is nonsense too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! So that's what ngmm
means. I'd suggest formspec_toolkit
. I don't see why there's a separate "next generation" menu folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what ide you use, not even if you use them but having foldernames as long as formspec_toolkit does waste tremendous amount of screen space for nothing.
the ng is because it's a total refactoring and not same as previous, if you wanna move all the mainmenu code to a separate folder you're free to do so.
Wontfix issues: |
deleted comments not related to this commit. Well I've been told not to delete offtopic comments: here we go: --------xxyz:-------- --------sfan5:-------- --------ShadowNinja:-------- local formspec = {
width = 5, -- Optional
height = 5, -- Optional
{type="button", name="tstbtn", text="Test"},
"\n",
"Here are some elements in tabs:\n",
{
type = "tabs",
tabs = {
["Table"] = {
type = "table",
elements = {
{"Test 1", ">>>>>>>>>", {type="button", name="clickme", text="Click me!"}},
{{type="image", src="test.png"}, "/////////", "^^^^^^^^^"},
},
},
["List"] = {
type = "list",
elements = {
"These are a few",
"lines of text that",
"you can select.",
{
type = "button",
name = "list button"
text = "Along with a button.",
},
},
},
},
},
} This could be sent over the network as JSON (or Lua, via Another option would be using a already proven format, it may be hard to convert it to a Irrlicht GUI though. --------sfan5:-------- --------MetaDucky:-------- I like the idea of Lua tables for forms, for mods it would be more convenient to update parts without recreating a huge form string. --------ShadowNinja:-------- |
Ah yes, using self looks much more like Lua now ;) (I think I still spotted a this here and there...) But, I think you should reconsider using metatables: You had some speed comparison referenced in one of the comments (can't find it anymore right now), which IMO is deceiving about the actual performance impact. Of course, with a hundred million calls one can measure that the extra metatable access doesn't come for free: With your test, the metatable version runs about 20% slower (ymmv).
|
MetaDucky, the only non "style" relate reason for metatables was "it's faster", I prooved this reason is wrong. And to be honest, I even consider this performance discussion to be absolutely nonsense, none of those things will have any practical difference. But as this was the only technicaly valid reason I tested it anyway. Edit1: |
fixes #1284 too |
Performance-wise, that was what I was trying to say.
I may not be too way off when I assume that most Lua developers will find the prototype pattern a plain simple understandable solution - but when you say that it's not worth the additional time then it is irrelevant anyway - I was thinking that was at least a part of the idea (still a bit confused about code quality requirements). |
MetaDucky looking at most mod's code you're most likely way of reality. And to be honest I don't think metatables to be more understandable too. Especally as they don't exactly fit to c++ vtable concept too. Code quality requirements? You're kidding, you're really questioning this commit as of code quality especially comparing it to current code? Edit1: And btw It's not gonna be you or ShadowNinja having to fix the bugs caused by things like that, by now it's always been me to fix the issues as everyone else told "fix it" |
Sorry - my confusion is about the different standards applied on different ends of the project, where things are rather left broken because of abstruse structural requirements for contributions on one end, and "don't bother me with that"-attitudes on the other end. This makes it pretty hard to provide contributions in form that is helpful, or at least, expected, if there isn't even a consensus amongst the maintainers about what they want. But that's going off-topic (again), and I don't really need far fetched reasons that justify a particular decision, either - I won't bother you again with it. |
MetaDucky you claim this to be broken, for what I see it works just fine. The only thing is you/ShadowNinja believe your style of coding is the one and only correct way of doing. Edit1: |
Fix crash on using cursor keys in client menu without selected server Add support for non fixed size tabviews
it's quite a lot of copy n paste, major changes are in fst subfolder,
the formspecs itself haven't been changed except of button bar which now does support scrolling for those of you having to many games installed
fstk api is first draft, if you have suggestions how to improve you're welcome