Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#2941) RFC: canvas_put_sprite
Home

[Freeciv-Dev] Re: (PR#2941) RFC: canvas_put_sprite

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2941) RFC: canvas_put_sprite
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Sat, 1 Feb 2003 03:13:55 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, Jan 31, 2003 at 06:34:02PM -0800, Jason Short via RT wrote:
> 
> [jdorje - Thu Jan 30 06:32:34 2003]:
> 
> > 3.  Introduce a single function, canvas_put_sprite(), that takes a
> > void*
> > (or a struct canvas *) as a parameter.  Now the function just draws
> > the
> > sprite onto the canvas that is specified.  In the case of the void*,
> > this will probably just point to the pixmap/surface onto which the
> > sprite will be drawn.  The problem here is that since the high-level
> > mapview drawing routines are only designed for one mapview, we would
> > need to introduce the hack that NULL refers to the "default" map
> > canvas.
> >   Later we can work to have all of these functions be passed (by the
> > GUI) the parameter that specifies which map canvas.  (The city dialog
> > functions will always be called by the GUI, so there is no trouble
> > there
> > for any of these 3 ideas.)  Using a struct canvas * instead means an
> > additional level of indirection, but is slightly more type-safe (the
> > NULL special case would still apply).  We might even be able to use a
> > struct Sprite * that specifies the drawing target (again, with a NULL
> > special-case).

> This patch implements it this way, using a void*.  This is significantly
> better IMO.  I could have introduced a struct canvas, but chose not to yet.
> 
> Does anybody have an opinion on this?

Yes. Don't use void *. Both of "struct canvas { char dummy;};" or
"typedef void *canvas_t." are better.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "With a PC, I always felt limited by the software available.
   On Unix, I am limited by my knowledge."
    -- Peter J. Schoenster <pschon@xxxxxxxxxxxxxxxxx>




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