Hello all,
based on this thread
http://www.giderosmobile.com/forum/discussion/1777/comparison-report-battle-of-the-lua-game-engines#Item_5got an idea to create small init.lua file which would load different hacks and extensions to Gideros objects we all have used before. I'm not talking about plugins, but pure lua based extensions, and even not about lua classes as Button class or TextWrap, but extensions to current classes, which would enhance the usability of Gideros. Basically some abstraction to mainly used functionality
Here are some things I have in mind:
So what do you find relevant, what should be needed and what you have up on your sleeves to share?
And if someone wants to get their hands dirty, here's a bunch of stuff you can research and provide code for, that would help us a lot.
Some tasksShow child behind the parent or not inherit alphaExplanation:
Shadows for TextField is implemented making real textfield act as shadow and it's child as real displayable text, making shadow the parent of real text. This gives two disadvantages, a little more complex to implement, but we handled that, and inability to set alpha transparency to shadow, because real text automatically inherits it.
So what could be the solution to this: making shadow child of a real text, but make it appear and real text, not on top of it or do not let real text inherit alpha from parent.
I thought of other possible implementations, as adding shadow as a brother of textfield (setting it before textfield) under same parent, but this raised many unwanted scenarios, where original textfield changes z-index, or parent, which would require a lot of additional code to bypass this scenarios. But I'll hear any ideas you might have
Determine the font typeExplanation:
To implement shorthand for TextField similar to Bitmap, there is a need to understand if user wants to load Font or TTFont object. In ideal situtions only one parameter should be passed, as value "tahoma". Then maybe inside constructor we could check if file tahoma.txt available, then it's a Font, if tahoma.ttf is available, then it's a TTFont. What would be the most efficient way to do it and what filetypes are supported by which object
Chain everythingExplanation:
Right now most of the methods are chained, meaning they return they object (if not returning anything else) for shorter code writing. But still not all possible methods are chained. So the task is, either come up with set of keywords inside methods' name, that would cover up most of the methods (but will not cover methods that actually return something) and chain others manually.
Or come up with different approach how this can be done, for example, checking bytecode in function body for return command
RGB to hex conversion and vice versaExplanation:
Now this might be to obvious thing to do, but I'm too tired right now to try and figure it out, so I'll post it here.
If we want to, for example, support HSL color model, there is a need to be able to convert 255, 255, 255 to 0xffffff and back, since Gideros accepts color in 0xffffff format.
Taking and implementing any feature of the listExplanation:
There are features list in the first post, that should be included in init.lua. Implement them, share the code, or extend existing features
Test, test, testExplanation:
While writing I do some initial test if this works at all or not. But more thorough testing is needed. For example, including this init.lua should not only provide additional functionality, which works properly, but also not to mess up with existing code, aka, provide full backwards compatibility
Provide feedbackExplanation:
Provide feedback on existing implementations, if many of you say something is needed, it will be included, if many says it's not needed it can be removed. But that's not all. Also consider function names, optimizations and other aspects, for example, creating abstraction layer for physics, in many cases I need to think for user and make decisions for them, just to make code shorter and easier. I'm not a dictator and don't want to make decision for all, let's make it more democratic and let's hear your thoughts
Suggest new featuresExplanation:
This lib will be as good as there are features in it. If there is something you use, or something you think would ease the development or simply some functionality that would have helped you, please post. Provide idea and we will be grateful, provide also a code and you will be my hero (
@atilim already is
)
TLDR; aka GimmeDaCode: Github Repo
Comments
It can come with Gideros Community Libs [1] I think (when Atilim had packaged the latest version, I forgot to remind him that it'll be included in the package).
Your initial list can get longer easily, so I propose to open a wiki page that includes a table with responsibility matrix. This way, anyone can step up and say "I am taking eg HSL color format support and here's the code". Especially the physics wrapper that helps programmers develop physics based games using fewer lines of code would really be great.
Many items in your list can be coded and documented in a couple of hours I think, so why dont we get the ball running?
[1] https://github.com/gideros/gideros-community-libs
Likes: fxone
I think many features would be removed when Gideros implements them internally and that is completely OK
Likes: atilim
sprite:setPosition("left", "bottom")
So I thought that I should rewrite Sprite.set method as Sprite.setX/Sprite.setY and Sprite.setPosition use it internally, but it seems that they still require a number as argument.
So do I have to override all of these methods, or is there another way?
Thank you
- Name of function
- What it does
- Link to source code
- Author
Is that ok? Any other good name you can think of?
Here's what I've got so far:
https://github.com/ar2rsawseen/GiderosInit
Of course this all needs more thorough testing.
But combining it all in one project would make it possible to create separate scenes as test cases and to show how this works.
Will add sprite anchorpoint, curves for shapes and some other stuff soon. It's getting late here, where I am
But about wiki, then it stays the same, we should list all additional functionalities provided, so yes it is ok.
Likes: atilim
best regards
@bowerhandy but then you need to modify every mouse event handler. I was doing it the same way before @atilim suggested implementation I used. But it does not really matter, because it will be removed, cause it will be implemented in next version of Gideros
Got couple of other ideas:
I really hope someone will come up with better chaining implementation, right now I'm simply rewriting methods by hand, can't come up with anything better for now, if anyone has any suggestions, I'm all ears
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Still, I haven't sent anything there yet either. I'll try an think up something soon.
best regards
Are you really sure the chaining of functions is worth it? Seems to add a lot of code for not much gain. Still, I guess you've done all the hard work now but it is an extra level of function call for virtually every method in the system.
BTW, you're welcome to take anything you want out of BhHelpers". In particular, isVisibleDeeply is quite useful, I think.
best regards
About chaining methods, well it just so much easier to write with them, but if I won't find better implementation for them, then it is possible that chaining won't be included. Just need some time to think now. How would it be possible to define class method dynamically from string, if only something like this
Likes: ar2rsawseen, techdojo
Is not it easier to use the following syntax?:
Colors = {
["Black"] = 0x000000,
["Blue"] = 0x0000ff,
....}
application: setBackgroundColor (Colors.Black)
When you add another function that takes color parameter, you will not need to override this function, as it will have to do in your case.
I was totally missing part of passing instance as an argument
@asakharov agree you'll need to override another method, but you do it only once, but otherwise you will have to write a longer color name every time.
But in this configuration, I see no reason why we could not do it both ways
edit: forget about middle. we want to visit Latvia.
To cover even more methods I've added also keywords "add", "remove" and "clear" to auto chaining method. Need to check other keywords to cover more methods, but not accidentally override methods that actually returns something
Which get's me to other idea. Maybe it is possible to check function's body for return keyword, to check if method returns anything )
You can use string.dump http://pgl.yoyo.org/luai/i/string.dump to get binary representation of a function and the value of opcode RETURN is.. uhmm.. just kidding :-\"
Cheers
evs
Likes: atilim, OZApps
@evs, yes. And I think my keyboard input routine was at CD 00 OA :-)
BTW @atilim
is it legit to modify table you are looping in?