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.


Messages - 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 23, 2008, 04:51:27 pm »
Hi =)

Thanks for the tip(I've changed the first post), but
Code: [Select]
void Surface::Display([color=red]const[/color] sf::RenderWindow& rw) const

does not work:
Code: [Select]

error: no matching function for call to `sf::RenderWindow::Display() const'


this works:
Code: [Select]
void Surface::Display(sf::RenderWindow& rw) const

Did I oversight something?

Sincerely,
BloodGod[/code]

3
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

4
Graphics / Drawing Everything
« on: May 22, 2008, 03:02:41 pm »
Hi =)



At the bottom are the conditions that have to be true!

And here is an example function which determines whether the mouse is over a sprite or not:

Code: [Select]

inline bool Overlap(sf::Sprite s,const sf::Input& input)
{
if((input.GetMouseX() >= s.GetLeft() && input.GetMouseY() >= s.GetTop()) &&
(input.GetMouseX() <= s.GetLeft()+s.GetWidth() && input.GetMouseY() <= s.GetTop()+s.GetHeight()))
return true;
else
return false;
}


usage:
Code: [Select]

if(Overlap(Sprite, App.GetInput()) == true)
     std::cout << "yeah" << std::endl;


Sincerely,
BloodGod

5
Audio / Stop() method
« on: May 21, 2008, 06:11:13 pm »
Hi =)

Quote
or try the latest svn Wink


That's a good idea, i'll try it and report possible success =D Maybe I should try this on Linux, too...

Sincerely,
BloodGod

6
Graphics / [Solved] Opacity for Sprites?!
« on: May 21, 2008, 06:08:33 pm »
Hi workmad3 :),

My program must handle jpeg etc... it has something to to with ergonomics, cause some users rather like to use JPEG instead of PNG (It will be some kind of HTML parser ;) )

I think I should never use the term alphachannel again  :?  I always barter this term with simple opacity. Of course I would use png, i think using greyscale images for alphachannel infos with e.g. jpeg is (in this case) a waste of time. But thank you for the advice =) I'll store this function in my little coding DB hehe :D

Sincerely,
BloodGod

7
Audio / Stop() method
« on: May 20, 2008, 05:54:21 pm »
Hi,

ok, thank you =) This will goad me to improve my waiting skills :roll:

Sincerely,
BloodGod

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

9
Graphics / [Solved] Opacity for Sprites?!
« on: May 20, 2008, 03:11:33 pm »
OMG, right -.- Thank you very much!!! =D
But what about images without an Alphachannel, does it work anyway? I mean does the sprite class handle it somehow?
Can't test it right now, i'm not at home :/

Thanks a million =D

Sincerely,
BloodGod

EDIT: Ok ok...sorry now i know :) Read faster than my brain could understand -.-

10
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]
anything