SFML community forums
Help => General => Topic started by: AbuIbrahim 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.
////////////////////////////////////////////////////////////
// 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;
}
-
How do you launch your app? What's your OS?
-
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
-
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.
-
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.
#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;
}
-
Oh, so that's a very different problem. SFML 1.6 doesn't work with ATI cards on Windows with dynamic SFML libraries.
-
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.
-
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.