Giter Site home page Giter Site logo

futile's Introduction

Futile (2021 Edition)

Futile is a code-centric 2D framework for Unity.

This is for those of you who want to do everything in code with as little editor integration as possible.

If you've used Cocos2D or Flash you should feel right at home.

It's in development and completely undocumented... but it works.

2021 note from Matt: Futile hasn't been updated a whole lot since I first released it, but it has been used (and continues to be used) in a bunch of real games


Go to http://struct.ca/futile for UnityPackages and instructional videos

Ask questions and share stuff you've made on http://reddit.com/r/futile

Submit bugs and feature requests to http://github.com/MattRix/Futile/issues

Futile works great with all versions of Unity (but let me know if you have any issues!)

How to try the demo project:

How to open the project

Third Party add-ons for Futile

Legal stuff

Futile contains many ideas from Prime 31's UIToolkit: github.com/Prime31/UIToolkit

The MiniJSON parser is by http://github.com/darktable

The demo project also uses Prime31's fantastic GoKit tweening library: github.com/Prime31/GoKit

The code and art assets (except for the font) can be used for anything, however the sound effects and music are not to be used in anything else

GoKit's license is here: https://github.com/prime31/GoKit

The font is Franchise

MIT License

Source code for Futile is Copyright © 2019 Matt Rix and contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

futile's People

Contributors

darktable avatar eeenmachine avatar hyakugei avatar jeffruediger avatar jpsarda avatar mattrix avatar pbhogan avatar philipludington avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

futile's Issues

Decide whether FButton isEnabled should eat touches

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.

Unity 4 code should use gameObject SetActive()

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.

Add support for trimmed and rotated atlas elements

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.

Use Futile on a 3D surface

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.

Let FButton hit rectangles be overriden

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.

Text is sometimes blurry

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.

Create FRenderTriLayer

This will allow layers made out of tris instead of just quads (the normal FRenderLayer will be renamed to FRenderQuadLayer).

Using extended/non-contiguous characters in GlyphBuilder results in IndexOutOfRange in FFont.cs

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.

FButton does not properly use expansionAmount

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;
    

UnityEngine.GameObject.active is obsolete: Unity 4

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!

FButton issue on Android with Unity 4

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.

Integrate physics with Futile

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.

Create a "wipeable" sprite

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).

FRepeatSprite / FSprite constructor bug w/ fix

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.