001package com.fs.starfarer.api.ui; 002 003import java.awt.Color; 004 005import org.lwjgl.util.vector.Vector2f; 006 007import com.fs.starfarer.api.Global; 008import com.fs.starfarer.api.campaign.LocationAPI; 009import com.fs.starfarer.api.campaign.econ.MarketAPI; 010import com.fs.starfarer.api.util.Misc; 011 012public class MarkerData { 013 public Vector2f coordinates; 014 public LocationAPI location; 015 public Color color; 016 public float scale = 1f; 017 public MarkerData(Vector2f coordinates, LocationAPI location) { 018 this(coordinates, location, Global.getSector().getPlayerFaction().getBaseUIColor()); 019 } 020 public MarkerData(Vector2f coordinates, LocationAPI location, Color color) { 021 if (color == null) color = Global.getSector().getPlayerFaction().getBaseUIColor(); 022 this.coordinates = coordinates; 023 this.location = location; 024 if (this.location == null) { 025 this.location = Global.getSector().getHyperspace(); 026 } 027 this.color = Misc.scaleColorOnly(color, 0.67f); 028 } 029 public MarkerData(Vector2f coordinates, LocationAPI location, Color color, float scale) { 030 this.coordinates = coordinates; 031 this.location = location; 032 this.color = Misc.scaleColorOnly(color, 0.67f); 033 this.scale = scale; 034 if (this.location == null) { 035 this.location = Global.getSector().getHyperspace(); 036 } 037 } 038 public MarkerData(Vector2f coordinates, LocationAPI location, float scale) { 039 this.coordinates = coordinates; 040 this.location = location; 041 this.scale = scale; 042 color = Global.getSector().getPlayerFaction().getBaseUIColor(); 043 this.color = Misc.scaleColorOnly(color, 0.67f); 044 if (this.location == null) { 045 this.location = Global.getSector().getHyperspace(); 046 } 047 } 048 public static float getScaleForMarket(MarketAPI market) { 049 float size = market.getSize(); 050 float scale = size / 8f; 051 if (scale < 0.33f) scale = 0.33f; 052 if (scale > 1f) scale = 1f; 053 return scale; 054 } 055 056}