Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: Nation Selection Dialog (Resubmit) [Patch] (PR#2057)
Home

[Freeciv-Dev] Re: Nation Selection Dialog (Resubmit) [Patch] (PR#2057)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Nation Selection Dialog (Resubmit) [Patch] (PR#2057)
From: Daniel L Speyer <dspeyer@xxxxxxxxxxx>
Date: Sat, 14 Sep 2002 11:26:41 -0400 (EDT)

On Sat, 14 Sep 2002, Mike Kaufman wrote:

> this is nice. couple of things:
> 
> o follow style guide (spaces between operators, etc).

Yeah, I'll do that -- it may take a while.  Somebody should write a perl
script to auto-stylify, so that all I'd need to do would be check it.

> o it'd be really nice if you could highlight the toggle button when a
>   nation is selected from the drop down box.

You mean it doesn't for you?  That's weird -- could you check that again?

> o could you take the flag code and put it in a separate function?
>   right now it's in 3 different places (4 when gtk2 gets it)

Um, I only see flag code once, though I do something similar for
city-styles, and the whole thing is copied out of the messagewin patch, so
yeah, a general crop-blankspace would be a good idea.  I'll do that. 

--Daniel Speyer
If you *don't* consider sharing information to be morally equivalent to 
kidnapping and murder on the high seas, you probably shouldn't use the
phrase "software piracy."

> 
> add a client/gui_stuff_common.c and put it there. I did a very similar
> thing for civworld, here's the function:
> 
> /**************************************************************************
> ...
> **************************************************************************/
> void build_flag_sprite(SPRITE **flag, struct player *pplayer, int height)
> {
>   int start_x, start_y, end_x, end_y, flag_h, flag_w, newflag_h, newflag_w;
>   SPRITE *origflag, *croped, *scaled;
> 
>   origflag = get_nation_by_plr(pplayer)->flag_sprite;
>   if (!origflag) {
>     flag = NULL;
>     return;
>   }
> 
>   /* calculate the bounding box ... */
>   sprite_get_bounding_box(origflag, &start_x, &start_y, &end_x, &end_y);
> 
>   assert(start_x != -1);
>   assert(start_y != -1);
>   assert(end_x != -1);
>   assert(end_y != -1);
> 
>   flag_w = (end_x - start_x) + 1;
>   flag_h = (end_y - start_y) + 1;
> 
>   /* if the flag is smaller then 5 x 5, something is wrong */
>   assert(flag_w >= MIN_DIMENSION && flag_h >= MIN_DIMENSION);
> 
>   /* croping */
>   croped = crop_sprite(origflag, start_x, start_y, flag_w, flag_h);
> 
>   /* scaling */
>   newflag_h = height;
>   newflag_w = ((double) newflag_h / flag_h) * flag_w;
> 
>   scaled = sprite_scale(croped, newflag_w, newflag_h);
>   free_sprite(croped);
> 
>   sprite_draw_black_border(scaled);
> 
>   /* and finaly store the scaled flagsprite in the static flags array */
>   *flag = scaled;
> }
> 
> -mike
> 



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