Good evening all,
I am having trouble finding some stuff. for example:
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Sound.php#detailsI am using their code but nothing.
When I type sf::
i see a list of stuff I can use, but no "sound" or "music" in there.
Exactly the same for the sprite part.
I used the code given on the website to draw a block (black) but nothing.
// Create a 20x20 image filled with black color
sf::Image image;
if (!image.Create(20, 20, sf::Color::Black))
return -1;
Does anyone have any idea?
My code:
#include <SFML/Window.hpp>
int main()
{
// create a new window 800x600 resolution 32 bit
sf::Window App(sf::VideoMode(800, 600, 32), "Zombie Madnezz");
// disable vertical synchronization for max framerate
App.EnableVerticalSync(false);
// attach the GetInput function to our window
//const sf::Input& Input = App.GetInput();
// as long as this window is running
while( App.IsOpened())
{
sf::Event Event;
while (App.PollEvent(Event))
{
// if user closes the window stop running the program
if(Event.Type == sf::Event::Closed)
{
App.Close();
}
// if user presses ESC button stop running the program
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Keyboard::Escape))
{
App.Close();
}
// set the objects for keyboard and mouse input
bool LeftKeyDown = sf::Keyboard::IsKeyPressed(sf::Keyboard::Left); // left arrow key
bool RightKeyDown = sf::Keyboard::IsKeyPressed(sf::Keyboard::Right); // right array key
bool SpacebarDown = sf::Keyboard::IsKeyPressed(sf::Keyboard::Space); // spacebar
bool LeftMouseButton = sf::Mouse::IsButtonPressed(sf::Mouse::Left); // left mouse button
bool RightMouseButton = sf::Mouse::IsButtonPressed(sf::Mouse::Right); // right mouse button
//unsigned int MouseCoordsX = Input.GetMouseX(); // mouse position x-as
//unsigned int MouseCoordsY = Input.GetMouseY(); // mouse position y-as
// configure some character settings
const float Speed = 50.f;
float Left = 0.f; // only left and top are needed as we can
float Top = 0.f; // calculate all with those three numbers
/* CHECK OUT THIS PART WITH CLOCK FUNCTION TO HAVE THE SAME TIMING
ON EVERY HARDWARE COMPUTER */
///////////////////////////////////////////////////////////////////////
// http://www.sfml-dev.org/tutorials/1.6/window-time.php
// execute a action according to the boolean (keyboard)
if ( LeftKeyDown == true ) Left -= Speed;
if ( RightKeyDown == true ) Left += Speed;
} // checks for events with PollEvent
//##############################
// Create a sprite and add music, but aint workin
///////////////////////////////////////////////////////////////////////
// http://www.sfml-dev.org/tutorials/1.6/graphics-sprite.php
// display the window
App.Display();
} // end while app is opened
return EXIT_SUCCESS;
}
my .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2011-08-22T17:53:13
#
#-------------------------------------------------
QT += core gui
TARGET = game
TEMPLATE = app
SOURCES += main.cpp
HEADERS +=
FORMS +=
LIBS += -L"C:\Program Files (x86)\SFML\lib" -lsfml-window -lsfml-graphics -sfml-system -sfml-main -sfml-audio
INCLUDEPATH = "C:\Program Files (x86)\SFML\include"