Skip to main content
gamedev.net
🔒 Locked

Recursion problem...

Started by BenB Apr 22, 2002 at 1:36 PM 0 replies 500+ views
Original Post
BenB
BenB
Hey, I have a group of windows, where there''s a parent window, his children, and some of the childrens are parents to other windows too, etc. Anyway, I want to make the Render function, but I''m not sure of how to do that (Using Recursion, isn''t it?)... This is the code to render only the toppest window and its children, what should I add to render its children''s children too? for (int q = 0; q <= Top.sub.GetSize()-1; q++) { Window ww = Top.sub.GetAt(q); if (ww) { RenderWindow(ww); } } Thanks... Ben
Koen
Koen
The render-function should be something like this


Window::render(){
renderThisWindow();
for all children k do{
child[k].render();//recursive function call
}
}


[edited by - Koen on April 22, 2002 2:55:53 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.