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

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

[Top] [All Lists]

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

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]