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.


Messages - somerandompiggo

Pages: [1]
1
General / Re: Making and handling entities dynamically
« on: February 17, 2021, 11:01:18 am »
Thank you! I never really understood why variables weren't passed over between functions.

2
General / Making and handling entities dynamically
« on: February 16, 2021, 08:06:37 pm »
I'm not really sure how to word the question, so I can't really get any answers from Google, but it goes like this.

For a screen-capture program I'm working on, I'm making a custom UI library for it written in C++/SFML. I want to have a function that creates a RectangleShape and Text entities for each button, but I'm not sure how to change the name so it comes from the function call, an example would be makeButton("buttonname", 25, 10);

I don't really have any code since I have no way to implement it, but here is kind of what I want.

int makeButton(string name, int x, int y) {
        sf::RectangleShape button;
        sf::Text buttonText;
        button.setSize(sf::Vector2f(25.f, 5.f));
        button.setFillColor(sf::Color::Blue);
        // other code here
}
 

Thanks!

3
Graphics / Window acting extremely glitchy on Ubuntu
« on: February 05, 2021, 12:20:41 pm »
I'm new to SFML! Coming from OpenGL to make smaller projects. I was following this tutorial, but when I got it semi-working, it looked like a strobe light:

It kept alternating between the result I actually wanted and this mess. My freind thinks its some kind of memory leak. I have no idea. Just to clarify, I'm new to SFML, but not other graphical APIs like GLFW. Thanks for your help!


Screenshots (it keeps alternating between these): https://i.imgur.com/ROqplyc.png | https://i.imgur.com/y0Pb484.png

Tutorial: https://www.sfml-dev.org/tutorials/2.5/graphics-text.php

Code: https://nekobin.com/hepunuwayu

Pages: [1]