Full Thrust Java test list -- March 2006

Number 10 of 25 messages in this Archive
[Date Prev] Main Index [Date Next]
[Thread Prev] Thread Index [Thread Next]

FTJava FAQ: Searching for a ship icon



VinsFullThrust@xxxxxxx wrote:

> Now that I am home again from Army duty, I began working on PBEM items 
> for FT.
>  
> I am once more lost in making GIFs working with the xml files when 
> creating games.
> Can you give me a run down please?
>  
> Vince


FTJava uses a variety of methods to find the icon for the ship or object 
based on its
name or an optional property called IconFamily.

Ship icons belong in the FTJava\Images\ShipIcons directory, and need to 
be available
to all players to see the same images.

Subdirectories under ShipIcons include:
EFSB
Standard
Generic

The following order is used to find a ship icon.

If the IconFamily property exists for a ship, it will be searched first.

An XML line of <IconFamily value="Generic\Kilo"/> will use the set of 
icons in the
FTJava\Images\ShipIcons\Generic\Kilo directory.  The search is conducted 
based
on the ship's name ("Felix.gif") , the ship class ("Ranger.gif") or the 
class abbreviation
("DD.gif").

If IconFamily doesn't exist, the Variant\Race directories are searched.

If the icon is not found the Generic\Race directory is searched.

If not found, a generic ship icon is used.

Code follows:

     // Search the Icon Family if not null
    if ( iconPath != null ) {
        String baseIconPath = BasePath + iconPath + "/";
        Path = baseIconPath + shipName;
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );

        if ( Icon == null ) {
        Path = baseIconPath + shipClass;
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );
        }

        if ( Icon == null ) {
        Path = baseIconPath + ship.getClassAbbrev();
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );
        }
    }

    // Variant/Race/ShipName.gif
    if ( Icon == null ) {
        Path = BasePath + GameOptions.getVariant() + "/" +
        shipRace + "/" + shipName;
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );
        }

    // Variant/Race/ClassName.gif
    if ( Icon == null ) {
        Path = BasePath + GameOptions.getVariant() + "/" +
        shipRace + "/" + shipClass;
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );
    }

        // Check Variant/Race/ClassAbbrev.gif
        if ( Icon == null ) {
        Path = BasePath + GameOptions.getVariant() + "/" +
        shipRace + "/" + ship.getClassAbbrev();
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );
        }
       
        // Check Variant/Generic/Class.gif
        if ( Icon == null ) {
        Path = BasePath + GameOptions.getVariant() +
        "/Generic/" + ship.getClassAbbrev();
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );        
        }
       
        // Check Generic/Race/Class.gif
        if ( Icon == null ) {
        Path = BasePath + "/Generic/" +
        shipRace + "/" + ship.getClassAbbrev();
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );        
        }
       
        // Check Generic/Class.gif
        if ( Icon == null ) {
        Path = BasePath + "Generic/" + ship.getClassAbbrev();
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );        
        }
       
        // Check Generic/GenericShipIcon.gif
        if ( Icon == null ) {
        Path = BasePath + "Generic/GenericShipIcon";
        Icon = ImageUtilities.getShipImage ( Path, 
ship.getPlayer().getColor() );        
        }
    }







  • Prev by Date: Re: Random Rolls
  • Next by Date: Game 959 done and comments

  • Previous by thread: Re: FighterGroup-less FighterBays
  • Next by thread: Game 950

  • Main Index | Thread Index | Author Index | Archive Index

    roger@nospam.firedrake.org
    Generated: Sat Apr 01 01:07:20 GMT 2006