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

### Author Topic: Arc Library  (Read 5997 times)

0 Members and 1 Guest are viewing this topic.

#### Kan

• Newbie
• Posts: 3
• I like fried chicken
##### 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.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: 10194
##### 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: 3
• I like fried chicken
##### 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.

#### Kan

• Newbie
• Posts: 3
• I like fried chicken
##### Re: Arc Library
« Reply #3 on: January 23, 2022, 01:49:08 pm »
This update to the library has been long overdue. I meant to update this a few months ago but I had other duties I needed to attend to. Regardless I managed to release an update to the Arc library.

A few changes that should be noted in this update:

1) There is now a list of functions that would indicate what functions are available in the header file. this can be found just under the license text

2) More organized code. When I uploaded the library to github I was actually dissatisfied with the code of the library. Way too wordy. So I made some efforts to clean up and now it looks like something that I actually like.

3) I removed some functions that I thought was just plain unnecessary Arc::ReflectQuad() for example. I'm not sure if this may break other peoples code but I think that the more organized code and easier navigation of the code would make up for that

4) new functions and classes such as a random number generator and a resource manager class

5) new examples to demonstrate some features of Arc

That about summarizes the updated library which should be available on github right now. Thank you for taking the time to read this