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

Pages: [1]
1
General / Re: RenderManager, encapsulate sf::RenderWindow
« on: May 29, 2014, 05:44:49 pm »
Quote
If you build a wrapper that provides all the methods of sf::RenderWindow, then you're not really encapsulating it, so why not use it directly?
That was my worry. I'm going to rethink about that. If I have any questions I'll post them here.

Quote
There have been a lot of threads on separation between graphics and logics in this forum, you might be interested in them.
Yeah, that's a good idea. I'll be looking for it.

Edit: Just as an help for future viewers of this thread, I found this project on Nexus's git: https://github.com/Bromeon/TemporaryOutbreak

2
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 ! :)

3
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 !

4
General / Re: Some questions about Scenegraph
« on: March 30, 2014, 10:35:42 pm »
Yeah, in this example it represent different character parts.

I think that I have all that I needed to continue. Thanks again, I'll mark my topic as solved ;)

5
General / Re: Some questions about Scenegraph
« on: March 30, 2014, 09:48:49 pm »
Hello ! Thanks for your answer :P
I was very busy this week-end, so I didn't have the time to look back for the answer.

I had a doubt too on that way of doing it, but I was not sure about storing the instance that's responsible of the animation in the node.

I suppose that the best way to change the animation is to set the playing animation (animator.playAnimation(...) ) in the parent and apply it for every childs ?

6
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