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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - BloodGod

Pages: [1]
1
General / [SOLVED] Visual Studio 2008 Professional Problem
« on: May 25, 2008, 10:02:24 pm »
Hi there =)

I've just installed VS 2008 Prof. and tried to make a Project with SFML...

Everything works find except, when starting the .exe, this message shows up and the programm terminates:





I try to run this code:
Code: [Select]

#include "stdafx.h" //stdafx: #include <SFML/System.hpp>

int main()
{
    sf::Clock Clock;
    while (Clock.GetElapsedTime() < 5.f)
    {
        std::cout << Clock.GetElapsedTime() << std::endl;
        sf::Sleep(0.5f);
    }

    return 0;
}


Did I forget something? :(

Sincerely,
BloodGod

EDIT:
Ok, I see....I have to build the libs my self! Seems to work now =D.
And again: SFML dominates!

2
Graphics / Little surface class
« on: May 22, 2008, 05:26:25 pm »
Hi =)

I've coded a little surface class, ok it's a class that stores a set of sf:Sprites  :roll: :

Code: [Select]

#include <vector>
#include <SFML/Graphics.hpp>

class Surface
{
      std::vector<sf::Sprite> m_sprites;
   public:
      void Add(sf::Sprite &s);
      void Clear();
      void Display(sf::RenderWindow& rw) const;
      Surface();
      Surface(int reserve);
};

Surface::Surface()
{
}

Surface::Surface(int reserve)
{
   m_sprites.reserve(reserve);
}

void Surface::Add(sf::Sprite &s)
{
   m_sprites.push_back(s);
}
void Surface::Clear()
{
   m_sprites.clear();
}

void Surface::Display(sf::RenderWindow& rw) const
{
   for(unsigned int i = 0;i < m_sprites.size();i++)
      rw.Draw(m_sprites[i]);

   rw.Display();
}


usage:
Code: [Select]

     sf::Image Image;
     if (!Image.LoadFromFile("image.jpg"))
         return EXIT_FAILURE;
     sf::Sprite Sprite(Image);
     Surface surf;

     surf.Add(Sprite);
/*......*/
     surf.Display(App); //App -> sf::RenderWindow


I thought it will might be useful for someone. Be careful, the sprites are copied. That makes it possible to "draw" 1 Sprite onto different surfaces...

Maybe it would be a nice idea to make real surfaces :/
Sicerely,
BloodGod

3
Audio / Stop() method
« on: May 20, 2008, 03:56:00 pm »
Hi there :)

Some days ago i made some tests with playing ogg files.

I stopped the music with the stop()-method. But after calling the play()-method the music didn't want to play. With pause() everything worked well, except the music was paused and not stopped ;)

Code: [Select]

if (Event.Type == sf::Event::KeyPressed)
{
if(Event.Key.Code == sf::Key::Left)
Music.Stop();
if(Event.Key.Code == sf::Key::Right)
Music.Play();
}


Sincerely,
BloodGod

EDIT:
System is Windows XP SP2 and OpenAL is installed...sound is playing without problems.

4
Graphics / [Solved] Opacity for Sprites?!
« on: May 20, 2008, 02:55:20 pm »
Sorry, i can't find something about opacity for sprites :/ Is this even supported by sfml? If yes, can someone give me a hint, how to change the opacity? :D  
Otherwise it would be great to find a method like setOpacity(int opacity) in one of the next versions =)

Btw: SFML is hardcore
Great work!!! =D

Sincerely,
BloodGod

Pages: [1]