Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Arc Library  (Read 741 times)

0 Members and 1 Guest are viewing this topic.

Kan

  • Newbie
  • *
  • Posts: 2
  • I like fried chicken
    • View Profile
    • Email
Arc Library
« on: October 03, 2021, 03:18:20 pm »
Hi. I would like to share a small project that I've been working on for a while. The project is called Arc and it is a header only library that contains vertex array utilities for use with SFML.

Even though the focus is on vertex arrays there are a bunch of extra stuff there as well such as vector utilities and matrix transformations on 2d points and I am also keen on adding more stuff to it in the future.

Here is some sample code to give a short demonstration of how to use it
#include <Arc/Arc.hpp> // include all of Arc's features
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window({ 800, 600 }, "Demo");
    window.setFramerateLimit(60);
   
    sf::VertexArray vertices;
    vertices.setPrimitiveType(sf::Quads);
    vertices.resize(4);
   
    // functions like this are templated on what container you are using for holding an array of sf::Vertex
    // such as sf::VertexArray or std::vector<sf::Vertex>
    Arc::MakeQuad(vertices, 0, { 400.0f, 300.0f }, { 200.0f, 200.0f });
   
    sf::Clock clock;
    while (window.isOpen())
    {
        sf::Event evt;
        while (window.pollEvent(evt))
        {
            if (evt.type == sf::Event::Closed)
            {
                window.close();
            }
        }
       
        const float dt = clock.restart.asSeconds();
        Arc::RotateQuad(vertices, 0, dt * 180.0f); // rotate the quad 180 degrees per second
       
        window.clear();
        window.draw(vertices);
        window.display();
    }
   
    return 0;
}
 

If anyone is interested in other stuff you can do, there is an examples that you can either build using cmake or just directly placing it in your own project similar to ImGui::ShowDemoWindow().

I think this will be useful for people who want some form of batch rendering in their SFML applications.

The link to the github repository is here for those who are interested but please note that this library makes use of some C++17 features which means that C++17 or higher is a requirement.
https://github.com/kan-xyz/Arc

That is all I have for now, I hope people will have fun with this.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9944
    • View Profile
    • development blog
    • Email
Re: Arc Library
« Reply #1 on: October 10, 2021, 06:05:10 pm »
Do you have somewhere a list of all the functions/classes provided, so one doesn't have to check the headers directly? :)
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Kan

  • Newbie
  • *
  • Posts: 2
  • I like fried chicken
    • View Profile
    • Email
Re: Arc Library
« Reply #2 on: October 13, 2021, 08:15:12 am »
Do you have somewhere a list of all the functions/classes provided, so one doesn't have to check the headers directly? :)

If you're talking about a literal list of functions/classes then maybe I could make something like a simple text file that people could refer to. Or perhaps another approach would just be to use header and .inl files in a similar way that SFML is using. You may be still looking at headers but at least that way looking at the available features would be more bearable than viewing both the function names and source code all in one file.

 

anything