Complete.Org: Mailing Lists: Archives: freeciv-java: November 2001:
[FreeCiv-Java] Re: scrollable map component & painting units, goto-lines
Home

[FreeCiv-Java] Re: scrollable map component & painting units, goto-lines

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Luke Lindsay" <LUKE@xxxxxxxxxxxxxxxxxxxxxx>
Cc: <freeciv-java@xxxxxxxxxxx>
Subject: [FreeCiv-Java] Re: scrollable map component & painting units, goto-lines etc
From: "Brian Duff" <Brian.Duff@xxxxxxxxxx>
Date: Tue, 13 Nov 2001 13:07:06 -0000

It's going to be initially hard to do this, since the code I'm using to
build up the list of sprites for a particular tile came directly from the C
version of Freeciv, and it just paints unit / city sprites to the background
buffer on top of the terrain. I haven't quite figured out how it does
animation and flashing yet.

I need to do some make sure the parts of this code which deal with unit
sprites (and their various overlays and indicators) is separated out
properly. Likewise with the goto lines, which I'm not handling at all yet,
and I think this may also apply to text overlays, such as city names and
production captions. In any event, I want to tidy up the class that handles
sprites (TileSpec.java), because it's a bit ugly on account of the fact that
it's based around C code.

Presumably, it only makes sense to paint the active unit in this way, since
it's the only thing on the map that will be "on the move" or flashing at any
given point?

Looking at this stuff is pretty much the next thing on my list (I want to
get the game to a stage where you can actually start moving units around
again :) ). I'm busy next weekend, but I should have a chance to look at
this in the next couple of weeks, unless somone else beats me to it :)

Brian

> -----Original Message-----
> From: freeciv-java-bounce@xxxxxxxxxxx
> [mailto:freeciv-java-bounce@xxxxxxxxxxx]On Behalf Of Luke Lindsay
> Sent: 13 November 2001 07:25
> To: Brian Duff
> Cc: freeciv-java@xxxxxxxxxxx
> Subject: [FreeCiv-Java] scrollable map component & painting units,
> goto-lines etc
>
>
> Brian,
>
> How are you intending to handle the painting of active units, goto lines
> etc?
>
> The scrollable map component code I wrote was designed to paint a static
> background.  To get the best perfomance, graphics elments that
> tend to move
> or are animated should be drawn separately.  (I.e. the offscreen buffer,
> TiledPainter.m_backgroundBuffer, should only store the graphics of terrain
> tiles, cities, and perhaps inactive units; other elements should
> be painted
> directly to the screen.) A good way to do this might be in the
> paint method
> of MapComponent.java, e.g.
>
> public void paint( Graphics g )
>   {
>     Graphics2D g2 = (Graphics2D)g;
>     Rectangle r = getVisibleRect();
>     m_painter.paint( g2, r );
>       //Now paint units etc here.
>   }
>
> Luke
>
>
>
>



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