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

Pages: [1]
1
General discussions / Where can i get sprites/tiles?
« on: October 28, 2014, 09:45:38 am »
Hello everyone, as mentioned above, i'm wondering where can i find some tiles for my 2d game?
I found plenty sites but some ones offered only charakters and others only textures or whatever and they don't fit together.
I want to programm a RPG game or a jump an run, rather a RPG.
So, guys where i can find them, especially whole sets?

2
Graphics / [Solved]Line issue
« on: March 21, 2014, 10:21:32 pm »
I try myself on Vertexes.
I have wrote a class which have a rectangle inside and a border around.
The main porpose of the border to be kind of shadow around the box but that is not the problem.
When i display the border it have black lines like some lines is missing, and i make the border of lines(http://www.sfml-dev.org/documentation/2.1/classsf_1_1VertexArray.php)

In the first screenshot i have normal size window and there not so many black lines but in the second one maximized the window i got more of them.

code where i create the lines:

void Flat_Entity::create_border() //m_ is for member
{
            int points_count = m_border_thick*5;


            m_border.setPrimitiveType(sf::LinesStrip);
            m_border.resize(points_count);
            int increment_adress = 0; //increment for vector

            int x_near = m_x + m_border_thick;
            int y_near = m_y + m_border_thick;
            int x_far = m_x + m_width - m_border_thick;
            int y_far = m_y + m_height - m_border_thick;


            for(int size_thick = 0; size_thick < m_border_thick; ++size_thick) //size_thick represents px
            {
                    m_border[increment_adress++].position = sf::Vector2f(x_near-size_thick, y_near-size_thick); //for top-left corner
                    m_border[increment_adress++].position = sf::Vector2f(x_far+size_thick, y_near-size_thick);  //for top-right corner
                    m_border[increment_adress++].position = sf::Vector2f(x_far+size_thick, y_far+size_thick);   //for bottom-right corner
                    m_border[increment_adress++].position = sf::Vector2f(x_near-size_thick, y_far+size_thick);  //for bottom-left corner
                    m_border[increment_adress++].position = sf::Vector2f(x_near-size_thick, y_near-size_thick); //again for top-left, close the way
            }

            for(int i = 0; i < increment_adress; ++i)           //set color for border
                m_border[i].color = sf::Color(200, 150, 100);



}

thanks for help

3
Window / [SOLVED]Insert and remove text not working with Events
« on: February 10, 2014, 03:13:15 pm »
Hello everyone.
I'm trying to catch inputs from keyboard and save it to a string and also to remove the last char with backspace.
I can't get it working, i tried many possible combinations but no one worked.
In my aktual try i filter the backspace out on TextEntered event but then it don't consider my action with backspace.
while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
            else if(event.type == sf::Event::TextEntered)
            {
                if(event.text.unicode != 0x000008)
                {
                   insert_last_char(text, event.text.unicode);
                   showing_text.setString(text);
                }
            }
            else if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::BackSpace)
            {
                remove_last_char(text);
                showing_text.setString(text);
            }
        }

4
Graphics / [SOLVED]Set a defined size of textfield
« on: September 08, 2013, 11:25:21 pm »
Hello dear community. I have a problem which i tried to solve. I want define an area where sf::Text should be drawn with a constant size of the font, methods i've tried out:
count each character with a size of the font, when limit is reached insert newline "\n" isn't working because each character has diffirent size.
Draw each character with the font and then read the property width, very perfomance heavy and bad solvage, because each character in the line must be compared and add to the width at the line lenght, and this method isnt ready yet.
Well, maybe somebody knows a better method to do so.

sorry for bad english also  ;)

Pages: [1]
anything