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

Pages: [1]
1
General / How to draw to specific area of the window?
« on: March 15, 2021, 04:52:26 pm »
I want to draw to very specific area of the window (starting from (250, 20) to right lower corner of the window, window also can be resized). I know I have to use viewport on a window sized view, but how to calculate its FloatRect? Viewport will be set to the black rectangle area and view will be moved by mouse so I can see whole loaded texture when it is bigger than window. I aiming for something like TileSet Editor from Godot engine.

2
General / How to always draw texture in its original resolution?
« on: March 15, 2021, 12:47:10 am »
I want to draw texture always in its original resolution independent of resizing the window etc. Is it possible?

3
General / Re: How to draw grid using VertexArray?
« on: March 12, 2021, 02:27:59 am »
Yes, I know. I actually did it like this:
sf::Vertex line[2];
                for (int i = m_ViewDefaultCenter.y - m_MapHeight * m_TileSize; i <= m_ViewDefaultCenter.y + m_MapHeight * m_TileSize; i += m_TileSize)
                {
                        line[0] = sf::Vector2f(m_ViewDefaultCenter.x - m_MapWidth * m_TileSize, i);
                        line[1] = sf::Vector2f(m_ViewDefaultCenter.x + m_MapWidth * m_TileSize, i);
                        m_Window.draw(line, 2, sf::Lines);
                }

                for (int i = m_ViewDefaultCenter.x - m_MapWidth * m_TileSize; i <= m_ViewDefaultCenter.x + m_MapWidth * m_TileSize; i += m_TileSize)
                {
                        line[0] = sf::Vector2f(i, m_ViewDefaultCenter.y - m_MapHeight * m_TileSize);
                        line[1] = sf::Vector2f(i, m_ViewDefaultCenter.y + m_MapHeight * m_TileSize);
                        m_Window.draw(line, 2, sf::Lines);
                }
I thought there is a better, more optimized way because of this post: https://en.sfml-dev.org/forums/index.php?topic=22021.0

4
General / How to draw grid using VertexArray?
« on: March 12, 2021, 12:39:36 am »
 I realized that I must use VertexArray to draw grid overlay in my level editor but I can't get it right. Can I do it by using one VertexArray (if yes how?) or do I need to use more VertexArrays (perhaps std::vector)?

Pages: [1]
anything