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

Author Topic: Program not working properly?  (Read 2575 times)

0 Members and 1 Guest are viewing this topic.

AbuIbrahim

  • Newbie
  • *
  • Posts: 5
    • View Profile
Program not working properly?
« on: August 05, 2011, 03:52:25 am »
I have read over the TUT and did everything it wanted me to do. How ever when ever I put in the code to close a window by hitting escape it does not work, and all I get is a console window with a blinking white insertion point.


Code: [Select]
////////////////////////////////////////////////////////////
// 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;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Program not working properly?
« Reply #1 on: August 05, 2011, 08:08:10 am »
How do you launch your app? What's your OS?
Laurent Gomila - SFML developer

AbuIbrahim

  • Newbie
  • *
  • Posts: 5
    • View Profile
Program not working properly?
« Reply #2 on: August 05, 2011, 08:12:48 am »
Quote from: "Laurent"
How do you launch your app? What's your OS?


Thank you for your quick reply, it's much appreciated.

My Graphic Card is a ATI  5750
My OS is a Windows 7 64 bit

I go to code blocks

1.) New Project
2.) Put in a CPP file
3.) I enter the code stated above
4.) I hit build and run.

This is how my linker settings look



-lsfml-graphics
-lsfml-window
-lsfml-system
-lopengl32
-lglu32


C:\Users\Ibrahim\Pictures\SFML-1.6\include

C:\Users\Ibrahim\Pictures\SFML-1.6\lib

SFML_DYNAMIC

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Program not working properly?
« Reply #3 on: August 05, 2011, 08:17:34 am »
Sometimes IDEs leave the console alive at the end of the program. Try to run your program directly by double-clicking it, and see if it still happens.
Laurent Gomila - SFML developer

AbuIbrahim

  • Newbie
  • *
  • Posts: 5
    • View Profile
Program not working properly?
« Reply #4 on: August 05, 2011, 08:23:53 am »
Quote from: "Laurent"
Sometimes IDEs leave the console alive at the end of the program. Try to run your program directly by double-clicking it, and see if it still happens.


double clicked the program in my debug folder of my project and same thing happend. The Insertion point is blinking and I can't close the window with my escape key.

Also I have tried telling SFML to display a rectangle but the same thing happens


***IMPORTANT**

I would also like to add that I can only get one window to display, and their are suppose to be 2 windows displaying. The window that does display itself is the console window but not the other window.


Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
 sf::RenderWindow App(sf::VideoMode(400, 300, 32), "Pokemon Prototype");  //render window
 sf::Shape Rect   = sf::Shape::Rectangle(100, 100, 200, 200, sf::Color::White);

 while (App.IsOpened()){

  sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
   if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();

        }
  App.Draw(Rect);
        App.Display();
 }

    return 0;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Program not working properly?
« Reply #5 on: August 05, 2011, 08:48:18 am »
Oh, so that's a very different problem. SFML 1.6 doesn't work with ATI cards on Windows with dynamic SFML libraries.
Laurent Gomila - SFML developer

AbuIbrahim

  • Newbie
  • *
  • Posts: 5
    • View Profile
Program not working properly?
« Reply #6 on: August 05, 2011, 08:51:42 am »
Quote from: "Laurent"
Oh, so that's a very different problem. SFML 1.6 doesn't work with ATI cards on Windows with dynamic SFML libraries.


Alright so I will link them  Staticly Tommorow.

Thank you for all your help and taking your time and helping me.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Program not working properly?
« Reply #7 on: August 05, 2011, 10:34:15 am »
Quote from: "AbuIbrahim"
Quote from: "Laurent"
Oh, so that's a very different problem. SFML 1.6 doesn't work with ATI cards on Windows with dynamic SFML libraries.


Alright so I will link them  Staticly Tommorow.

Thank you for all your help and taking your time and helping me.
Or you could do the smart thing and update to SFML 2, since 1.6 technically isn't stable compared to 2.0.
I use the latest build of SFML2

 

anything