Giter VIP home page Giter VIP logo

apos.shapes's Introduction

Notable projects

Gamedev

Research

  • Texo - Music composition software.
  • BinaryInput - Proof of concept for writing text on limited devices.
  • Vyne language - Vyne programming language.

Games

Other

  • Mitten - Infinite canvas drawing application.
  • apos-docs - Documentation static site generator.
  • MotivationTracker - Simple application to track days working on something.

Socials

apos.shapes's People

Contributors

apostolique 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

apos.shapes's Issues

Add DrawEllipse

I used this for my own needs and I think it would be a good fit to add to the library. It's a copy-paste of DrawCircle with different radii for horizontal and vertical.

public void DrawEllipse(Vector2 center, float radiusHorizontal, float radiusVertical, Color c1, Color c2, float thickness = 1f)
{
    // Account for AA.
    radiusHorizontal += _pixelSize;
    radiusVertical += _pixelSize;

    var topLeft = center + new Vector2(-radiusHorizontal, -radiusVertical);
    var topRight = center + new Vector2(radiusHorizontal, -radiusVertical);
    var bottomRight = center + new Vector2(radiusHorizontal, radiusVertical);
    var bottomLeft = center + new Vector2(-radiusHorizontal, radiusVertical);

    var ps = _pixelSize / (Math.Max(radiusHorizontal, radiusVertical) * 2);

    var u = 1.0f;

    _vertices[_vertexCount + 0] = new VertexShape(new Vector3(topLeft, 0), new Vector2(-u, -u), 0f, c1, c2, thickness, ps);
    _vertices[_vertexCount + 1] = new VertexShape(new Vector3(topRight, 0), new Vector2(u, -u), 0f, c1, c2, thickness, ps);
    _vertices[_vertexCount + 2] = new VertexShape(new Vector3(bottomRight, 0), new Vector2(u, u), 0f, c1, c2, thickness, ps);
    _vertices[_vertexCount + 3] = new VertexShape(new Vector3(bottomLeft, 0), new Vector2(-u, u), 0f, c1, c2, thickness, ps);

    _triangleCount += 2;
    _vertexCount += 4;
    _indexCount += 6;

    if (_triangleCount >= MAX_TRIANGLES)
    {
        Flush();
    }
}

Rounded shapes

Since the shapes are drawn with SDF, it's possible to round them.

Gradients

Would be nice to allow picking two colors to define a gradient. I'm guessing you could pick a position to place color1, then place color2 and the shader could interpolate between the two to fill the shape.

How to make borders thinner?

Hello!
Thank you for your work and your library.
When I draw:
_sb.DrawCircle(new Vector2(120, 120), 75, new Color(96, 165, 250), new Color(191, 219, 254), 1f);
I still have a thick border that I would like to make much thinner.
Decreasing 0.1f for thickness has no effect.
Is it possible to make the border lines thinner? Thank you!

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.