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

Pages: [1]
1
General / RenderManager, encapsulate sf::RenderWindow
« on: May 29, 2014, 05:02:18 pm »
Hi ! I'm currently thinking about a "RenderManager" for my game, it would encapsulate a sf::RenderWindow (with method to draw on it, etc, etc) and the video settings (whether the particles, vsync, fullscreen are enabled or not for example).

My question is: Am-I better to recode all access method of my sf::RenderWindow (draw, getView, setMaxFps, etc) and then when I'll draw my game I'll pass the RenderManager to the "object.draw(...)" method ? It's a lot of method to recode though, so I don't know if it's a good thing...

I'm also using TGUI for the controls and it needs the sf::RenderWindow for drawing and probably for other stuffs like cursor position on the window, so I suppose I'm better to code an access method to the sf::RenderWindow, then I'll be able to pass it directly to the tgui::gui ?

I have the felling my questions are a bit simple, but I want to be sure I'm doing it right.
If you have any suggestion, I'm open to it. Thanks ! :)

2
Graphics / Use sf::Shape or my own classes for textured shapes
« on: May 23, 2014, 05:27:25 pm »
Hello ! :D
I want to have a textured shape (circle and convex) and I wonder if I am better to use the derived types of sf::Shape or to implement my own classes (with vertices, yeah I know sf::Shape make use of vertices too).

I ask that because I read on another topic that there's advantages to use sf::Sprite instead of sf::RectangleShape (A little precision about that would be appreciated  ;D ).

Thanks for your answers !

3
General / [SOLVED] Some questions about Scenegraph
« on: March 28, 2014, 03:26:00 pm »
Hi ! I'm actually coding a little game and I have some problem with scenegraph implementation.
Here's my base Node class:

class Node: public sf::Drawable, public sf::Transformable
{

public:

    Node(const sf::Vector2f & origin, const sf::Vector2f & pos,
               const std::string & id, bool drawnAbove = true);

    virtual void Step(sf::Time frametime);

    //Add a new child to the node.
    bool BindNode(std::unique_ptr<Node> & node);
    //Remove a child and get it.
    std::unique_ptr<Node> UnbindNode(const std::string & id);

    //Get a child with it ID.
    Node * GetChild(const std::string & id);
    unsigned int GetChildCount() const;

    const std::string & GetId() const;

    void SetDrawnAboveParent(bool drawnAbove);
    bool IsDrawnAboveParent() const;

    virtual void OnDraw(sf::RenderTarget & target, const sf::Transform & trans) const;

protected:

    virtual void draw(sf::RenderTarget &target, sf::RenderStates States) const;

    //Childs.
    std::map<std::string, std::unique_ptr<Node> > m_childs;

    std::string m_id;

    bool m_drawnAboveParent;

};

I also implemented a spriteNode and an animationNode which have Node as base class. My question is:

If I use those classes to create an animated character (for example): Every part of the character would be a spriteNode which has as parent an animationNode (walk animation, attack animation, etc...).  How can I access the animation node and modify them effectively to the animation I want ?

Thanks for your answer !  ;)

Pages: [1]
anything