Simple & Fast Game Engine

Pages: 12
May 22, 2012 at 8:11pm
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 May 22, 2012 at 8:13pm
May 22, 2012 at 9:03pm
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 May 22, 2012 at 9:04pm
May 23, 2012 at 3:02pm
Nice! :) I will definitely have it in mind next time I plan to create a game :P
May 23, 2012 at 3:11pm
Awesome!
If you have any questions or suggestions let me know ;)
May 23, 2012 at 7:29pm
MIT license? I like that :)!
May 23, 2012 at 10:37pm
Is there anything that explains the different licenses in lay-mens terms?
May 24, 2012 at 1:53am
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 May 24, 2012 at 1:54am
May 24, 2012 at 10:17am
@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 May 24, 2012 at 10:20am
Topic archived. No new replies allowed.
Pages: 12