Giter VIP home page Giter VIP logo

rect-ex's Introduction

Rect Extensions

Read about RextEx on habr (ru). Extended docs at Documentation folder (according to Unity Package Layout).

RectEx is a tool that simplify drawing EditorGUI (not Layout) elements with Unity3d.

RectEx consists of a bunch of Rect extensions, which provides an interface to work with rects easier.

GitHub release GitHub Release Date Github commits (since latest release) GitHub last commit

Stop doing

rect.height = 18;
GUI.LabelField(rect, "First line");
rect.y += rect.height;
GUI.LabelField(rect, "Second line");
rect.y += rect.height;
rect.width = (rect.width - 5) / 2;
GUI.LabelField(rect, "Third line: left part");
rect.x += rect.width + 5;
GUI.LabelField(rect, "Third line: right part");

Use Column and Row instead:

using RectEx;
var rects = rect.Column(3);
GUI.LabelField(rects[0], "First line");
GUI.LabelField(rects[1], "Second line");

rects = rects[2].Row(2);
GUI.LabelField(rects[0], "Third line: left part");
GUI.LabelField(rects[1], "Third line: right part");

Why do you need it?

Because you don't want to get lost among all these rect.y += rect.height and rect.width = (rect.width - 5) / 2.

Because you want to draw your GUI elements easily and feel yourself comfortable.

Because you want to make your code readable.

Because you aren't afraid of trying new awesome things, are you?

Contributing

If you want to add a bug report or feature request, just add an issue or PR.

If you create a Pull Request with new feature or bugfix, please write tests.

If you find any errors in this text, feel free to fix it.

Installation

The preferrable way to install RectEx is Unity Package Manager.

To add RectEx to your Unity project, add following dependency to your manifest.json as described here and here. Use master or any version above v0.1.0 because v0.1.0 and previos versions are not compatible with Unity Package Manager.

{
  "dependencies": {
    "st.rect-ex": "https://github.com/slavniyteo/rect-ex.git#master"
  }
}

To be able to run tests add these lines:

{
  "dependencies": {
    "st.rect-ex": "https://github.com/slavniyteo/rect-ex.git#master"
  },
  "testables": [
    "st.rect-ex"
  ]
}

rect-ex's People

Contributors

slavniyteo avatar radomyrslaboshpytskyi avatar d4160 avatar

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.