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

Author Topic: Prblem with creating a window  (Read 3021 times)

0 Members and 1 Guest are viewing this topic.

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
Prblem with creating a window
« on: September 07, 2008, 11:44:12 am »
i tried to create a window using an examplecode:

#include <SFML/System.hpp>

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


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(1000, 600, 64), "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;
}


but the window doesnt really look good, instead of a black window i have many how should i say... many pixels   a graphic error

why is this and how can i correct it?
  i use version 1.3
  code::blocks with mingw
 i think all compiler/linker ... options are correct

Phoenix

  • Newbie
  • *
  • Posts: 27
    • View Profile
Prblem with creating a window
« Reply #1 on: September 07, 2008, 06:31:53 pm »
Quote from: "Tutorial"
At this point, you may see anything on the screen (maybe black color, maybe not) as we don't draw anything into our window.


glClear(GL_COLOR_BUFFER_BIT); after the creation of the window.