Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Getting Memory Error  (Read 1827 times)

0 Members and 1 Guest are viewing this topic.

Hamza.Arshad

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Getting Memory Error
« on: February 28, 2013, 09:27:33 am »
AOA! I have Copied this code from the tutorial of this site ( http://www.sfml-dev.org/tutorials/1.6/sources/window-events.cpp ) and it runs good but when i close the window by pressing ESC key, it gives me a error of memory, The code is:

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Events");

    // Get a reference to the input manager associated to our window, and store it for later use
    const sf::Input& Input = App.GetInput();

    // Start main loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
        }

        // Get some useless input states, just to illustrate the tutorial
        bool         LeftKeyDown     = Input.IsKeyDown(sf::Key::Left);
        bool         RightButtonDown = Input.IsMouseButtonDown(sf::Mouse::Right);
        bool         JoyButton1Down  = Input.IsJoystickButtonDown(0, 1);
        unsigned int MouseX          = Input.GetMouseX();
        unsigned int MouseY          = Input.GetMouseY();
        int          JoystickX       = Input.GetJoystickAxis(1, sf::Joy::AxisZ);
        int          JoystickY       = Input.GetJoystickAxis(1, sf::Joy::AxisY);
        int          JoystickPOV     = Input.GetJoystickAxis(1, sf::Joy::AxisPOV);

        // Display window on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}

Any help will be Appreciated. Thanks in Advance.
« Last Edit: February 28, 2013, 10:46:15 am by Laurent »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Getting Memory Error
« Reply #1 on: February 28, 2013, 09:31:29 am »
The exacte error message would be essential for such a post.

My guess is that's a SFML 1.6 problem. You should use SFML 2, see the FAQ on the GitHub wiki. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hamza.Arshad

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Getting Memory Error
« Reply #2 on: February 28, 2013, 10:19:38 am »
 :o Anyways Thanks  :)

 

anything