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 - dogunbound

Pages: [1]
1
I would say that since https://github.com/SFML/SFML/pull/2611 is up, there is some sort of guarantee that this will happen.

2
On ArchLinux kde plasma + x11, I noticed that if you call setSize, then poll for events, a Resized event gets polled.

I was just curious if it is guaranteed that this will happen. I'm pretty sure it's a side-effect of the event being propagated from the underlying API (window's API, x11, etc...). Is there some sense of guarantee this will happen?

3
SFML development / Re: Allow for Limiting (Max & Min) Window Size
« on: March 21, 2023, 03:43:32 am »
The real issue is that X11 refuses to resize the window if the user is still dragging it. This is how the control flow works:

This all happens in milliseconds:
X11 performs a window resize when a user drags the window borders. Then X11 puts a resized event onto the event queue. SFML puts that event onto its own event queue. The program polls for events from SFML's event queue. The program notices that the resize made the window too small; therefore, it will send a set size to SFML. SFML sends the set size parameters to X11. X11 tries to set the size of the window, but can't because the user is still holding onto the window border.

If we could force the user to not grab onto the border, the set size function would work seamlessly. Hypothetically speaking if the user lets go of the window between the time the window actually gets resized and X11 trying to set the size of the window with X11ResizeWindow, it would work fine.

Overall, the real solution is to have a min size and max size function. All other window APIs do this (godot, sdl, etc...)

4
A simple question just reworded:

Is it possible for a MouseButtonPressed event to have different x, and y positions for the mouse's coordinates than the previous MouseMove event?




Answer: Yes

5
I wrote this small bit of code to familiarize myself with C++ again:

int main() {
  // Crashes if font fails to load
  const sf::Font font = load_font().value();
  sf::RenderWindow window(sf::VideoMode(800, 600), "Game Of Life");
  window.setVerticalSyncEnabled(false);
  const sf::Vector2u window_size = window.getSize();

  // UI
  sf::Text title = center_text_origin(sf::Text("Game of Life", font, FONT_SIZE));
  title.setStyle(sf::Text::Bold);
  const auto set_title_position = [](sf::Text &title, sf::Vector2u window_size) {
    float amt_push_downwards = title.getLocalBounds().height / 2 + 10;
    sf::Vector2f pos = sf::Vector2f(
        window_size.x / 2.0,
        amt_push_downwards
        );
    title.setPosition(pos);
  };

  while (window.isOpen()) {
    sf::Event event;
    while (window.pollEvent(event)) {
      switch (event.type) {
        case sf::Event::Closed:
          window.close();
          break;
        case sf::Event::Resized:
          {
            const sf::FloatRect new_window_area(0.f, 0.f, event.size.width, event.size.height);
            const sf::Vector2u new_window_size(rect_size(new_window_area));
            window.setView(sf::View(new_window_area));

            set_title_position(title, new_window_size);
          }
          break;
        default:
          break;
      }
    }

    window.clear();
    window.draw(title);
    window.display();
  }

  return 0;
}
 

I noticed that my title text does not need to have an initialized position set, as the resize event gets triggered when RenderWindow is initialized. Is this guaranteed? Is this a quirk that may or may not be prevalent in future versions of SFML?

6
C / When will setSmooth be implemented for Fonts?
« on: July 04, 2022, 08:21:18 am »
What I want is the ability to disable set_smooth in rust-sfml. That's three jumps away from the main repository, but the main repository, thankfully, already has the setSmooth functionality for Fonts https://github.com/SFML/SFML/pull/1690

I read into CSFML, and I'll be honest. I have no clue what is going on. I want to know how doable it is to possibly implement setSmooth for CSFML that way I can help move it to rust-sfml.

Thank you.

7
Graphics / What is sfml sprite default behavior with undefined texture rect
« on: December 30, 2021, 05:51:04 am »
Here is the example code of what I am curious about:
sprite = sf::Sprite(*assets::missingTexture));
sprite.getLocalBounds();

sprite.getLocalBounds() should return a FloatRect with a width and height corresponding to the size of the missingTexture, correct?
Wiki doesn't explain something as specific as this, so I want some confirmation whether this is true or false.

Thank you.

Pages: [1]
anything