mattrix / futile Goto Github PK
View Code? Open in Web Editor NEWA super simple Unity 2D framework
Home Page: http://struct.ca/futile
A super simple Unity 2D framework
Home Page: http://struct.ca/futile
Hey Matt, switched to your development branch and noticed a possible bug in FSprite that crashes FRepeatSprite
FRepeatSprite's constructor calls the empty base constructor in FSprite. This prevents _localVerticies from being allocated and causes UpdateLocalVertices in FRepeatSprite to crash.
I've fixed this in my fork by changing the constructor to this..
protected FSprite() : base() //for overriding{
_localVertices = new Vector2[4];
}
I'm not 100% how to put in a pull request for this fix from my fork, but wanted to give you the heads up.
This will lower the amount of confusion people have between single image assets and atlas assets.
It'd be neat if you could add material properties (perhaps as a dictionary?) to FShaders, to allow for more complex materials.
Integrate with the built-in Unity physics engine. Create a separate physics library/engine/thing to do this so that it doesn't overcomplicate the normal Futile stuff. It'll probably be stored as a separate github project.
It'll save significant texture space if we can use the trimmed and rotated atlas elements that TexturePacker can output.
For the most part it shouldn't be too tricky, but there might be some issues if the font atlas gets trimmed or rotated.
expansionAmount was being applied in HandleSingleTouchMoved and
HandleSingleTouchEnded but not HandleSingleTouchBegin.
This change to HandleSingleTouchBegin in FButton.cs corrects the issue.
@@ -98,7 +98,11 @@ public class FButton : FContainer, FSingleTouchableInterface
{
Vector2 touchPos = _bg.GlobalToLocal(touch.position);
- if(_bg.textureRect.Contains(touchPos))
//expand the hitrect so that it has more error room around the edges
//this is what Apple does on iOS and it makes for better usability
Rect expandedRect = _bg.textureRect.CloneWithExpansion(expansionAmount);
if(expandedRect.Contains(touchPos))
{
_bg.element = _downElement;
Use this as a reference, see if it's possible:
http://www.starscenesoftware.com/stuff/unity/CircularHealthBar.html
This may also lead to enhancements on modifiable FShaders.
Here is the info I was given:
The problem is that the FButton will become untouchable after the app entered to the background and then goes back. I've recorded a small video about this. http://sound.bai-hua.org/temp/IMG_0107.mov
The banana project is running under Galaxy Nexus, and built with Unity 4. And it seems is an Android only issue, everything is alright on iPhone.
The solution I found is set shouldMouseEmulateTouch to true for all platforms. Just not sure if it's the proper way for this case.
Figure out what needs to be changed/tweaked so that it's easy to use Futile as UI for 3D games. Also, make a quick under-10-minute video showing how to create text atlases and stuff to make it work.
It'd be nice if the FLabel could do automatic line breaks based on a certain max label width.
Some sort of simple UV wipe/mask should work, somewhat like scrollRect in Flash.
From what I've heard, dynamic meshes will behave better in Unity 4 with MarkDynamic() set, especially on iOS.
An idea from Owen, pretty straightforward, just a handy thing to have.
I think this means the quads aren't getting measured correctly, but it's worth looking into. I noticed it with the "GO!" button in Madness.
Just installed Unity 4. Everything seems to be working fine with Futile except for this warning:
Assets/Plugins/Futile/Core/FRenderLayer.cs(110,29): warning CS0618: UnityEngine.GameObject.active' is obsolete:
GameObject.active is obsolete. Use GameObject.SetActive(), GameObject.activeSelf or GameObject.activeInHierarchy.'
Just thought I would give you a heads up!
Make sure the units it uses for the slice insets are always correct.
Either use Unity's built in particles, or a custom built Futile-specific particle engine, or both!
I mistakenly used gameObject.activeSelf as a setter instead of using gameObject.SetActive() in the new Unity 4 code in the FRenderLayer.
It should just be a simple matter of search and replace, not a big deal at all.
Check the hash algorithm and make sure it's not dumb, maybe some other things could cause it too, so some tests are necessary.
See this issue: #39
Basically it'd be really useful to allow the option of FButtons getting passed a custom rect to use as the hit area instead of always using the bitmap's texture rectangle.
See, my issue here: http://www.reddit.com/r/futile/comments/yqhl7/a_message_to_those_using_futile_for_ludum_dare/c5ykllw
I'm confident that part of the problem is me, but I think there is a bug here too.
Here is the pertinent part of the GlyphBuilder output:
page id=0 file="Andika.png"
chars count=189
char id=210 x=2 y=2 width=34 height=49 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0 letter="Ò"
char id=211 x=38 y=2 width=34 height=49 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0 letter="Ó"
char id=212 x=74 y=2 width=34 height=49 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0 letter="Ô"
The problem appears to happen in FFont.cs, from the following lines:
lines 231 - 235:
else if(words[0] == "chars") //chars count=92
{
int charCount = int.Parse(words[1].Split('=')[1]);
_charInfos = new FCharInfo[charCount+1]; //gotta add 1 because the charCount seems to be off by 1
}
The above code should determine the maximum charID but instead uses a count. This is not valid if there are characters missing from the GlyphBuilder set.
line 333:
_charInfosByID[charInfo.charID] = charInfo;
In this case the charID
of 210 is immediately larger than the character count, which causes OutOfRange. For this case I am able to just change line 191 to _charInfosByID = new FCharInfo[256];
and comment out the updating based on count.
Perhaps a better solution would be to use a HashMap or similar for _charInfosByID
.
Right now the FButtons are very touch focused, so there is no hover/rollover state when you move the mouse over them.
I wrote a small tutorial with the goal of minimizing the steps need to get Futile up and running. So, I use the LoadImage method instead of taking all the steps need to set up an Atlas. In my example, the image is rendered distorted. Here's the tutorial: http://www.mrphilgames.com/futile-quick-start/ and here's the code: https://gist.github.com/3521647
In some scenarios, you'll want a disabled FButton to still "eat" touches so that they don't go through to other buttons. I should figure out a way to allow both possibilities, and have a sensible default.
This will allow people to make whatever kind of render layers they want.
Fix the font kerning, which is awful and broken right now.
Use CCProgressTimer (from Cocos2D) as a reference for the radial stuff. (Note that FWipeSprite can already do the horizontal and vertical wipe stuff).
https://github.com/cocos2d/cocos2d-iphone/blob/master-v2/cocos2d/CCProgressTimer.m
Might just need a function that gets the mouse position in Futile units.
http://www.reddit.com/r/futile/comments/11lg4t/bug_incorrect_scaling_at_the_edges_of_a_sprite/
Perhaps the camera can be offset? Or perhaps we can offset just the y by and incredibly small amount?
Create a sprite that allows itself to be wiped, somewhat like a rectangular masked. Ideally it'll be wipeable in all 4 cardinal directions (including multiple directions simultaneously).
In Unity 3.*, we may need to add a toggle that lets a user "ping pong" between two different meshes to avoid the CreateVBO problem. In Unity 4 we should use mesh.MarkDynamic().
All of this may be overkill for certain situations, so we should make it optional.
We need some kind of FMouseableInterface that gets mouse move events.
This probably solves the FButton issue as well.
See if Futile can be used in 3D, or rendered onto a 3D surface as a texture... it might require doing raytests with touches and turning them back into touch events, or something like that.
This is actually a really tricky problem to solve properly, but I've got some ideas for how to figure it out. It's especially important to get it working crisp on iOS at non-retina resolutions.
https://github.com/imkira/unity-sysfont
Implementing this will allow people to use system fonts, including rendering foreign characters and other fun things... could be very handy.
http://www.reddit.com/r/futile/comments/102nsz/little_crash/
Make sure to look into how the indexes change when an atlas has been unloaded/reloaded.
Also, maybe see if we can use the ~ deconstructor to keep a list of whether all the old atlaselements have truly been removed?
This will allow layers made out of tris instead of just quads (the normal FRenderLayer will be renamed to FRenderQuadLayer).
This will help those who have many different foreign characters in their font files:
Look into how easy or hard this will be to integrate.
Support for Spriter, the animation editor.
Could use this as a base for the data parsing: https://github.com/Thinksquirrel-Software/spriterdapi-unity
Whit had an issue where when objects that were off-screen were later moved on screen, they wouldn't show up until a depth change happened: https://www.youtube.com/watch?v=O4CeCvzdjng&feature=player_embedded
I'm guessing it has to do with Mesh.Clear() in the renderlayers. There are probably some other ways I could solve it though...
Right now the FButtons are very touch focused, so there is no hover/rollover state when you move the mouse over them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.