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

Author Topic: Cant find lots of stuff in 2.0  (Read 1588 times)

0 Members and 1 Guest are viewing this topic.

GroundZero

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Cant find lots of stuff in 2.0
« on: August 22, 2011, 11:22:53 pm »
Good evening all,

I am having trouble finding some stuff. for example:

http://www.sfml-dev.org/documentation/2.0/classsf_1_1Sound.php#details

I 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.

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

Code: [Select]
#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:

Code: [Select]
#-------------------------------------------------
#
# 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"

Contadotempo

  • Full Member
  • ***
  • Posts: 167
  • Firelink Shrine
    • View Profile
Cant find lots of stuff in 2.0
« Reply #1 on: August 23, 2011, 12:26:36 am »
Are you including the correct Headers?
I.E. Sound.hpp for sf::Sound.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Cant find lots of stuff in 2.0
« Reply #2 on: August 23, 2011, 08:53:47 am »
Quote
When I type sf::

i see a list of stuff I can use, but no "sound" or "music" in there.

Not being in the auto-completion list doesn't mean that it doesn't exist, don't worry about that.

Quote
I used the code given on the website to draw a block (black) but nothing.

"Nothing" doesn't help much, can you describe what happens more precisely? Your complete code doesn't draw anything, so what do you expect?
Laurent Gomila - SFML developer

GroundZero

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Cant find lots of stuff in 2.0
« Reply #3 on: August 24, 2011, 09:50:43 pm »
Yeah I removed the sprite draw code but like I said, I used the code from the docs.

http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.php

I just copied their sample code and put it into mine but nothing is happening, not even when just trying to make a square or anything :D

Best regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Cant find lots of stuff in 2.0
« Reply #4 on: August 24, 2011, 10:41:28 pm »
Please show us your own complete code that doesn't work as expected ;)
Laurent Gomila - SFML developer

 

anything