Code Monkey home page Code Monkey logo

hitboxbuilder-2d's Introduction

logo

Introduction

Hitbox Builder is a lightweight C++ library aiming to automatizing the process of generating hitboxes composed by only convex polygons.

It was originally designed for 2D games, but it could also serve different purposes.

License

Hitbox Builder is distributed under the MIT License

Requirements

Features

Below is a representation of each stage of transformation of the data.

logo

Usage

// Initialize the builder.
HitboxBuilder::init();

// Create a hitbox for the given sprite with an accuracy of 70%.
const auto hitbox = HitboxBuilder::make(sprite, 70, false);

const auto& convexPolygons = hitbox.body();
const auto& boundingBox = hitbox.bound();

// Use these data as you like.

Demos

To run the demos, execute the configure script with the option '-t'.

Execute the target HitboxBuilder-tester located in the build directory.

Some test bed commands are:

  • keys to slide between the images.
  • keys to increase/decrease the accuracy of the algorithm.
  • Space key to toggle the display of the sprite.

You can load your own images by adding them to the TestBed/assets/ directory. You will just need to restart the program as they are loaded at the beginning.

Output:
Input Output
silhouette Accuracy gif
Accuracy = 100 Accuracy = 66
Italy 100 Italy 66

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.