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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Aqua_coder

Pages: [1]
1
Graphics / How to color the lines of a Vertex Array
« on: March 03, 2022, 10:13:04 am »
Recently I was making a Maths Plotter on SFML, and I have done the basic core features like Drawing the animations and input.

But I wanted to know if I can change the color of a vertex array.
Here is the code for reference


void drawFunction(sf::RenderWindow &window)
        {
            while(x < 30 && drawing == true)
            {
                aq::sleep(0.01);
                x += 0.1;
                std::cout << x << std::endl;
                window.clear();
                curve.setPosition(sf::Vector2f(x*20.f + window.getSize().x/2,  
                    -1*(sin(x))*20.f + window.getSize().y/2));
                function.append(
                    sf::Vertex(curve.getPosition()));
               
                window.draw(function);
                window.draw(curve);
                window.draw(sprite);
                window.draw(x_axis);
                window.draw(y_axis);
                window.display();
            }
            if(x > 15 || drawing == false || (x > 15 && drawing == false))
            {
                drawing = false;
                window.clear();
                window.draw(function);
                window.draw(sprite);
                window.draw(x_axis);
                window.draw(y_axis);
                window.display();
            }
        }

2
SFML projects / How to change a string to a function name
« on: February 06, 2022, 10:29:44 am »
soo recently I was making a math plotter, and I managed to make functions like the parabola, the sine function and something like that. But I don't know how to change the string into a desiarable function type,

For example If I want a function of x^2 and enter a string through the function parameter, How do I interpret it through the vertex array?

Pages: [1]