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

Pages: [1]
1
General / Re: Keyboard not working
« on: September 06, 2018, 01:31:28 pm »
I moved it into the game loop and sure enough that fixed the problem, thank you for your time.

2
General / Keyboard not working
« on: September 06, 2018, 02:46:57 am »
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
        //Render Window
        sf::RenderWindow window(sf::VideoMode(200, 200), "Demo");
        //Render Objects
        sf::RectangleShape shape(sf::Vector2f(100,100));
        //Move code
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Right))
        {
                shape.move(1, 0);
        }
        //Window Stuff
        while (window.isOpen())
        {
                sf::Event evnt;
                while (window.pollEvent(evnt))
                {
                        if (evnt.type == sf::Event::Closed)
                                window.close();
                        switch (evnt.type)
                        {
                        case sf::Event::Closed:
                                window.close();
                                break;
                        case sf::Event::Resized:
                                printf("New Height: %i New Width: %i\n", evnt.size.height, evnt.size.width);
                                break;
                        case sf::Event::TextEntered:
                                if (evnt.text.unicode < 128)
                                {
                                        printf("%c", evnt.text.unicode);
                                }
                        }
                }

                window.draw(shape);
                window.display();
        }

   return 0;
}

It seems to skip the if statement on line 11
I've tried everything from fixing simple errors to completely reinstalling the library but nothing is working, any idea of what is going wrong?

Pages: [1]
anything