paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re[2]: [paragui-users] PAraGUI loading time


From: Andrew Ford
Subject: Re: Re[2]: [paragui-users] PAraGUI loading time
Date: Fri, 14 Jun 2002 11:51:01 -0700 (PDT)

1050 widgets is too many widgets :)
What I would suggest doing is instead of creating a
widget for each square of your map editor and putting
them in a container, subclass PG_Widget, make sure the
constructor asks for the parent to have a surface
(i.e. when you declare myWidget::myWidget( whatever )
: PG_Widget( make sure we ask for an SDL_Surface here
) ).  Now you have a widget with a canvas to play
with.  Blit your tiles in whatever pattern you're
using, and handle the mouse-clicks manually by
computing which tile was clicked.  Obviously I don't
know what exactly you're doing, but I think this will
be much faster, even if it's a little more work.  This
is what I do for my minesweeper
(www.geocities.com/andrewhford).  I think you'll also
be saving a lot of memory.

Good luck,

Andrew.

--- Alexander Pipelka <address@hidden> wrote:
> Am Fre, 2002-06-14 um 16.15 schrieb taurus:
> <snip>
> > I have an array of widget pointers, which is
> filled before to show
> > them all.
> 
> Ok.
> 
> > 
> > AP> Are they shown immediately after creation ?
> > 
> > No, I create them before, then I show them, as I
> mentioned it above.
> > 
> > AP> I will try this and look for any performance
> traps.
> > 
> > Thanks! Some kind of crash test :)
> 
> I added 2 more test-apps to the CVS "devel-1-0" tree
> (stress1, stress2).
> These create 1024 PG_ThemeWidget objects and show
> them.
> 
> stress1 shows them immediately after creation ->
> ~2500 ms
> stress2 adds them to a PG_Widget container -> ~2000
> ms
> 
> (on my rather slow Celeron 300)
> But i found that the most time consuming part is the
> creation of the
> widgets. Displaying them is rather fast. I guess the
> slow part is
> "LoadThemeStyle". 
> 
> Maybe you should check the drawing code of your
> widget.
> 
> 
> > >> I can see only gradient background of the
> parent
> > >> widget, child widget are not shown. I tried to
> use WidgetList,
> > >> the same :( What can be wrong?
> > AP> Do you use AddChild ? - Don't use it.
> > 
> > No.
> > 
> > AP> Always specify the parent in the constructor
> of the child.
> > 
> > That`s the way I do it.
> > Sorry, I didn`t mention before - those 1050 widget
> have parent -
> > background widget. It works correct, but when I`m
> trying to create
> > another widget container - child widgets are not
> shown, and I do all
> > the same way - I`ve checked it thousand times.
> 
> Hmm. Strange.
> Can you create some minimal sample app showing that
> behaviour ?
> 
> > Maybe there is a constrain for the total amount of
> widget?
> 
> No.
> 
> Alex



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]