Skip to content

Commit

Permalink
made TAB player list customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
EnderCrypt committed May 26, 2017
1 parent 6f120bc commit b862fad
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
Binary file modified cs2d/sys/lua/Cs2dSpy/Cs2dSpy.jar
Binary file not shown.
1 change: 1 addition & 0 deletions cs2d/sys/lua/Cs2dSpy/Settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Client.UpdateCheck = True
Client.FontName = DEFAULT_FONT
Client.FontSize = 13
Client.DisplayFps = True
Client.TabBgColor = 200, 200, 200, 200

// Cs2d
Cs2d.UpdateFrequency = 1
Expand Down
3 changes: 2 additions & 1 deletion src/com/endercrypt/cs2dspy/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ public void accept(SpyPlayer player)

private void drawPlayerList(Graphics2D g2d)
{
PlayerListOverlay tabList = new PlayerListOverlay();
Color backgroundColor = Settings.get().key("Client.TabBgColor").colorArgs(200);
PlayerListOverlay tabList = new PlayerListOverlay(backgroundColor);
tabList.addValue(PlayerValueType.ID, 1);
tabList.addValue(PlayerValueType.NAME, 15);
tabList.addValue(PlayerValueType.USGN, 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ public class PlayerListOverlay
private static final int PADDING = 20;

private List<Column> columns = new ArrayList<>();
private Color backgroundColor;

public PlayerListOverlay()
public PlayerListOverlay(Color backgroundColor)
{
// TODO Auto-generated constructor stub
this.backgroundColor = backgroundColor;
}

public void addValue(PlayerValueType playerValue, int weight)
Expand All @@ -36,7 +37,7 @@ public void draw(Graphics2D g2d, SpyPlayer[] players, Dimension screenSize)
{
int totalWidht = screenSize.width - (PADDING * 2);
// full rect
g2d.setColor(new Color(200, 200, 200, 200));
g2d.setColor(backgroundColor);
g2d.fillRect(PADDING, PADDING, totalWidht, screenSize.height - (PADDING * 2));
// row lines
for (int i = 0; i < players.length; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/com/endercrypt/cs2dspy/setting/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class Settings
{
private static final Settings instance = new Settings("Settings.txt");
private static final boolean PRINT_SETTINGS = false;
private static final boolean PRINT_SETTINGS = true;

public static Settings get()
{
Expand Down

0 comments on commit b862fad

Please sign in to comment.