1st Demo Using SFML - Only Get Console Window - HELPHi,
I am new to SFML.
I am using Microsoft Vista OS and my C++ IDE is Code::Blocks.
I followed the instructions properly to set up SFML with Code::Blocks.
I entered this simple demo from SFML web site:
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
int main()
{
// Create the main window
sf::RenderWindow App(sf::VideoMode(640, 640), "SFML window");
// Load a sprite to display
sf::Image Image;
if (!Image.LoadFromFile("cute_image.jpg"))
return EXIT_FAILURE;
sf::Sprite Sprite(Image);
// Create a graphical string to display
sf::Font Arial;
if (!Arial.LoadFromFile("arial.ttf"))
return EXIT_FAILURE;
sf::String Text("Hello SFML", Arial, 50);
// Load a music to play
sf::Music Music;
if (!Music.OpenFromFile("nice_music.ogg"))
return EXIT_FAILURE;
// Play the music
Music.Play();
// Start the game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear screen
App.Clear();
// Draw the sprite
App.Draw(Sprite);
// Draw the string
App.Draw(Text);
// Update the window
App.Display();
}
return EXIT_SUCCESS;
}
It builds OK, but when I run it, I only get one console window with no 640x640 window. Also I see no test sprite, text, and OGG music playing? (I do have the test sprite JPG, font, and OGG in the directory of the executable.)
When I build above source in Code::Blocks under Windows Vista, I get the follow output:
-------------- Build: Debug in SFML_Beginning ---------------
Compiling: main.cpp
Linking console executable: bin\Debug\SFML_Beginning.exe
Info: resolving sf::Font::ourDefaultCharset by linking to __imp___ZN2sf4Font17ourDefaultCharsetE (auto-import)
Info: resolving vtable for sf::Spriteby linking to __imp___ZTVN2sf6SpriteE (auto-import)
Info: resolving vtable for sf::Stringby linking to __imp___ZTVN2sf6StringE (auto-import)
C:\Program Files\CodeBlocks\MinGW\bin\ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
Output size is 67.00 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 1 warnings
Again I am new to SFML.
If you can help me make this work I would appreciate it greatly.
JeZ+LeeSLNTHERO@aol.com
Silent Hero Productions(R)Video Game Design Studio
http://www.SilentHeroProductions.com