Simple & Fast Game Engine

Pages: 12
RenderTarget and not RenderWindow


Well spotted, I'll change it.

Also, shouldn't I make the onDraw() function protected to ensure that users don't call it themselves.

Also, should I provide functionality like relative coordinates to the parent node?
Last edited on
Ended up implementing it like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace sfge
{
    class Node
    {
        public:
            Node(const std::string& name = "Node");
            virtual ~Node();

            std::string getName();

            void draw(sf::RenderTarget& target);
            void update(sf::Time delta);

            void addNode(Node* node);
            void removeNode(Node* node);

            Node* getParent();
            void setParent(Node* parentnode);

        protected:
            virtual void onDraw(sf::RenderTarget& target){}
            virtual void onUpdate(sf::Time delta){}
            Node* parent;
            std::vector<Node*> children;
            std::string name;
    };
}


Updated my test project and this works like a charm.
ConvexCollidable is now CollidableNode (it derives from Node)
Last edited on
Nice! :) I will definitely have it in mind next time I plan to create a game :P
Awesome!
If you have any questions or suggestions let me know ;)
MIT license? I like that :)!
Is there anything that explains the different licenses in lay-mens terms?
should I provide functionality like relative coordinates to the parent node?
I think yes. As this is one of main benefits of having parent child relationships. It shouldn't just be coordinates either but scale and rotation as well.
Last edited on
@BHXSpecter,
The FSF's free software licenses page might help: http://www.gnu.org/licenses/license-list.html
If you need more details you can e-mail them. Just take what they say with a grain of salt: they have a tendency to talk up the GNU GPL a little (mostly explaining why non-copyleft licenses are "inferior").

Alternatively, if there's a specific license, you can probably find a Wikipedia article about it. The benefit there is that it will be much more neutral. You can probably find a list of software licenses on Wikipedia too.

[edit] note: "MIT license" usually refers to the X11 license which is based on the one MIT used for the original X Window System.
Last edited on
Topic archived. No new replies allowed.
Pages: 12