Re: JFreeciv experiences

<braunsalexander-S0/[email protected]> Tue, 26 Mar 2002 09:57:57 +0100
Newsgroups gmane.games.freeciv.java
Organization http://freemail.web.de/
Message-ID <[email protected]>
Ben Hutchison <ben_hutchison-/[email protected]> schrieb am 25.03.02:
> --- Ben Mazur <[email protected]> wrote:
> > > 2. The binary ran fine first time from windows explorer (jdk1.4,
> > win98), and
> > > connected ok to a civ 1.12 server. However, I saw some problems with
> > graphics
> > > that made the game unplayable:
> > >   a) Cant access city screen at all
> > 
> > As jfreeciv has yet to implement a way to track mouse clicks on the
> > map, you can only access the city dialog from the "find city" dialog.
> > Sort of silly.
> 
> Could be better. 
> 
> Is what's needed is A) mouse click handler which can convert screen pixel
> coordinates to a map tile coordinate, B) find city Y at tile X method, and C)
> something to wire trigger an "open city Y" method somewhere?
> 
> If nobody is currently attemting this, Im willing to have a go and submit a
> patch back to the list or maintainer. 
> 
> If so, any advice on how to go about it, what in the code to look at, other
> issues to consider, pitfalls, etc would be welcomed.
> 
> Ben
> 
> 

Hi Ben,
as you probably noticed due to my absence (sorting out life, moving twice, started at PhD in Hamburg) I havent been following the list too busily myself as of late, so the following is a bit of a blind shot. Just going by the above comment though I do have an idea of how to relate clicks to certain tiles. I did a little board game in Java, where you click on the tile to move your figure. Instead of figuring out where you clicked and relating that to a tile, instead I had the tile itself do that stuff. So, simply have 

public class tile implements MouseListener {...}

and from here on you either do all the stuff in tile itself (is there a city sitting on me? Do I call the client??) or another possibility would be to create new events like TileEvent and have that propagate to the correct listener. 

Hope that helps,

ciao

Alex
________________________________________________________________
Keine verlorenen Lotto-Quittungen, keine vergessenen Gewinne mehr! 
Beim WEB.DE Lottoservice: http://tippen2.web.de/?x=13