paragui-users
[Top][All Lists]
Advanced

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

Re: [paragui-users] Yet an other drawing question.


From: Andrew Ford
Subject: Re: [paragui-users] Yet an other drawing question.
Date: Mon, 5 Aug 2002 12:00:18 -0700 (PDT)

Hey Guillaume,
    You can ask for a widget with a surface using the
PG_Widget constructor argument for it.  Then the
constructor for your custom widget should be like:
customWidget() : PG_Widget( yes, I'd like a surface )
{ etc... }

Alternatively, if you aren't satisfied with the
blitting performance, there are a couple of things you
could do.
1) Use a separate widget for each board tile; then not
all of them will have to be redrawn.
2) Use the native SDL_Surface of the widget, and draw
it yourself with the PG_Draw functions.  I've done
this before, it's probably easiest.

Andrew

--- Guillaume Schmid <address@hidden> wrote:
> Well, I looked at the mailing list and saw that
> there was previously
> some questions about it but could not really
> anderstand the answers :)
> 
> I am doing a simple game, the playfield uses a big
> part of the screen
> and inherit from a PG_ThemeWidget.
> I have a small sprite to animate at regular period
> of time (for this, i
> plan to use a timer).
> I would like to fully anderstand what is involved in
> such a blitting
> operation. I think that this knowledge could benefit
> to other game
> writers.
> 
> 1 - If the playfield inherit from a widget with a
> surface.
> 
> An eventDraw will allow me to draw my tiles on the
> internal surface I
> draw my sprite as well.
> after the EventDrawMethod is called, the eventBlit
> is called which call
> the Redraw method that does the blitting of the
> surface on the parent
> widget. At this stage I dont know if the parent
> widget (in my case, the
> main screen) needs to be redrawn itself to be
> visible).
> So it is 1 drawing on a surface + 1 copy of the
> surface to the screen
> surface (and one more for the screen surface to be
> visible ?).
> 
> If I want just to draw a few pixels, The whole
> surface is being copied
> at least one time (or 2?). So, I anderstand that is
> might not be the
> most efficient way of doing it.
> 
> 2 - With a surface less widget.
> 
> The eventBlit method is called (not eventDraw). I
> noticed that the
> SDL_Surface parameter of eventBlit was null. So I
> use GetScreenSurface
> to draw. So, my tiles are being blitted dirrectly on
> the screen's
> surface and Redraw id called for it to updated and
> visible.
> If I draw a few pixels, I noticed that I have to
> manually call Redraw.
> This is where I am looking for explanations or
> advices.
> I would like manipulate dirrecly the visible screen
> surface. I would
> like the blittings to happen without the whole
> surface redraw overload.
> 
> First of all, does all my blablabla makes sense ?
> It it possible to achieve this with paragui
> elegantly ?
> 
> Thank you for your attention.
> a++
> Guillaume.
> PS: This will be a nice (i hope) GPL'ed 'connect 4'
> (or '4 in a row')
> game with theme and a strong AI opponent.
> 
> 
> 
> _______________________________________________
> paragui-users mailing list
> address@hidden
>
http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



reply via email to

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