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 - toglia

Pages: [1]
1
Graphics / Nested drawables to manipulate them toghether, sf hierarchy?
« on: September 26, 2009, 07:30:23 pm »
I downloaded the stable 1.5 like a month ago.

2
Graphics / Nested drawables to manipulate them toghether, sf hierarchy?
« on: September 26, 2009, 12:19:42 am »
I found a "layer" class in the wiki, which I copy pasted, and did some testing but I'm not getting the inherited translation.

This is layer class:
Code: [Select]
#include <vector>
#include <SFML/Graphics.hpp>

typedef std::vector<sf::Drawable*> FrameSet;
typedef FrameSet::const_iterator itFrame;

class Layer : public sf::Drawable, public FrameSet {
 public :
Layer(  const sf::Vector2f& Position = sf::Vector2f(0, 0),
                const sf::Vector2f& Scale = sf::Vector2f(1, 1),
                float Rotation = 0.f,
                const sf::Color& Col = sf::Color(255, 255, 255, 255));
virtual ~Layer();

virtual void Render(sf::RenderTarget& Target) const;
};

Layer::Layer(   const sf::Vector2f& Position,
                const sf::Vector2f& Scale,
                float Rotation,
                const sf::Color& Col) : sf::Drawable(Position,Scale,Rotation,Col) {
};
 
Layer::~Layer(){
};

void Layer::Render(sf::RenderTarget& Target) const {
    for( itFrame i = begin() ;i!=end();i++)
            Target.Draw(*(*i));
};


The main:
Code: [Select]

int main(){
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "X");

    sf::Image image;
    image.LoadFromFile("x.png");

    sf::Sprite * sp = new sf::Sprite();
    sp->SetImage(image);

    Layer layer;
    layer.push_back(sp);
    layer.SetPosition(10,10); //<-Should move the sprite right?

    while (true){
        App.Clear();
        layer.Render(App);        
        App.Display();
    }
}


The layer doesn't seem to move the sprite...

3
Graphics / Nested drawables to manipulate them toghether, sf hierarchy?
« on: September 25, 2009, 09:21:29 pm »
Thanks a lot. It was not even sfml related, just simple c++ inheritance feature... :oops:

4
Graphics / Nested drawables to manipulate them toghether, sf hierarchy?
« on: September 25, 2009, 10:09:45 am »
I'm trying to do some kind of generic class made of different sorts of drawables so I can manipulate them all at once, (like ogre's scenenodes that can be attached in a hierarchy way)

Example:
Child is attached to Father:
a) father moves/rotates/etc child moves/rotates/etc.
b) child moves/rotates/etc father doesn't move.

To keep it simple I've decided to do a vector of drawables, and to have an empty sprite to be the "father" of all, so the draw method is like:

Code: [Select]
   iterator = mDrawables.begin();
    while( iterator != mDrawables.end() ) {
        renderWindow->Draw(

            /*This is the messy part, how do I change its position/rotation to mantain the relative distance
            but adding its father position (without accumulating) (got it?)*/
            /*This obviously doesn't work but it shows the idea.*/
            (*mDrawables) + father->GetPosition()
            (*mDrawables) + father->GetRotacion()
        );
        ++iteradorDibujables;
    }

Can somebody help me with that?, the problem I'm getting is that I can't do a momentary change of position/rotation just to render...

Is there a better way of doing this supported by sfml?

Thanks

5
General discussions / animation library, spline, spring, keyframe tool
« on: September 15, 2009, 11:23:23 pm »
Ok, but I was looking for something like the keyframe tool of flash.
Say you wanted to do a " you win" text animation, normally in almost every game I know a cool text comes in, in a very dynamic way, changing its scale, opacity and moving. In flash I would normally do a keyframe of a small invisible sprite off the screen, move it to the position I want, and tell flash how do I want to do the interpolation, linear, smooth etc...
I'm finding myself doing animations by code which is not the most artistic way. I know this maybe is not called sprite animation but I don't know how to call that.
Doing one text animation, doesn't look hard enough, but when trying to do complex stuff with lots of moving things a tool like this is almost mandatory, or not?

6
General discussions / animation library, spline, spring, keyframe tool
« on: September 15, 2009, 10:35:02 pm »
bump  :P

7
General discussions / animation library, spline, spring, keyframe tool
« on: September 11, 2009, 07:48:18 pm »
Hi, I was wondering how do you guys do sprite animations? I want to start doing cool ui/sprite animations, with a keyframe system in which I can create custom interpolations, something like adobe flash. I imagine this is a need of many games, so which tools do you guys use to do this? Ive heard people doing custom tools with a xml file system accelerated with the gpu. What do you guys think?

8
General / Problems building "Using CEGUI In SFML" tutorial c
« on: July 29, 2009, 01:42:12 am »
I have made the sfml cegui tutorial work on vs2008 but my buffer is not cleaning up, so if I move the window I paint like millions of more windows, same happens with the mouse pointer...

EDIT: mWindow.Clear(); was missing...

Pages: [1]
anything