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

Pages: 1 [2]
16
Window / Re: how to create "input fields/ text fields"
« on: March 19, 2016, 05:45:38 am »
 Good Gracious!!! Thank you for your support.
i did move it in that area. but still it didnt work. only then when i defined

sf::Text playerText;

to

sf::Text playerText(''',font,size);

im really sorry, that should have been obvious to me. grateful for your help guys. sky five!

17
Window / Re: how to create "input fields/ text fields"
« on: March 18, 2016, 04:27:54 am »
"move  window.draw(playerText); so that it is directly before window.draw(playerText);"

Hi there Hapax, im really new to this, so where should i put window.draw(playerText);?

tried to move it before the poll event but no luck.


18
Window / Re: how to create "input fields/ text fields"
« on: March 18, 2016, 04:10:32 am »
Hi Laurent, im sorry im here to bug you again. my program is working, but it does not display the characters typed on the window. here's my code. Can you please go over it and see what may i be doing wrong?

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>

int entername()
{
            sf::RenderWindow window(sf::VideoMode(1180, 600), "PANZER_WAR:TPL_GAME", sf::Style::None);
            sf::Font font;
            if (!font.loadFromFile("emulogic.ttf"))
            return EXIT_FAILURE;

            sf::Event event;
            sf::String playerInput;
            sf::Text playerText;
            playerText.setPosition(60,300);
            playerText.setColor(sf::Color::Red);

    while (window.isOpen())
        {
             while(window.pollEvent(event))
                {
                        if (event.type == sf::Event::TextEntered)
                            {
                                if(event.text.unicode < 128)
                                    {
                                        playerInput +=event.text.unicode;
                                        playerText.setString(playerInput);
                                    }
                            }
                            window.draw(playerText);
                }
        window.display();
        }
    return 0;
}

19
Window / Re: how to create "input fields/ text fields"
« on: March 17, 2016, 08:59:32 pm »
Thank you so much. you're my savior laurent.. ;D ;D ;D ;D

20
Window / how to create "input fields/ text fields"
« on: March 13, 2016, 08:00:41 am »
Hello everyone, i am an absolute beginner with c++ and sfml, i was tasked to create an Artillery Game, 2 player.
i really need help on how to create a Text field area where a player will enter their name, ive seen tutorials read docs, and forums, but still i am not able to do this. i really need some help.

how should i display the TextEntered on the window?
for example: Player presses 'J', that 'J' is immediately drawn on screen..

any help??if this is even possible??

Pages: 1 [2]
anything