001package com.fs.starfarer.api.combat; 002 003import java.util.EnumSet; 004 005public class BaseCombatLayeredRenderingPlugin implements CombatLayeredRenderingPlugin { 006 007 protected CombatEngineLayers layer = CombatEngineLayers.BELOW_INDICATORS_LAYER; 008 protected CombatEntityAPI entity; 009 010 public BaseCombatLayeredRenderingPlugin() { 011 super(); 012 } 013 014 public BaseCombatLayeredRenderingPlugin(CombatEngineLayers layer) { 015 this.layer = layer; 016 } 017 018 019 public void advance(float amount) { 020 } 021 022 public void cleanup() { 023 } 024 025 public EnumSet<CombatEngineLayers> getActiveLayers() { 026 return EnumSet.of(layer); 027 } 028 029 public float getRenderRadius() { 030 return 100; 031 } 032 033 public void init(CombatEntityAPI entity) { 034 this.entity = entity; 035 } 036 037 public boolean isExpired() { 038 return false; 039 } 040 041 public CombatEntityAPI getEntity() { 042 return entity; 043 } 044 045 public void render(CombatEngineLayers layer, ViewportAPI viewport) { 046// float x = 0; 047// float y = 0f; 048// float w = 100; 049// float h = 100; 050// Color color = Color.cyan; 051// float a = 0.25f; 052// if (layer == CombatEngineLayers.BELOW_INDICATORS_LAYER) { 053// x = 50; 054// y = 50; 055// w = 100; 056// h = 100; 057// color = Color.cyan; 058// } else if (layer == CombatEngineLayers.BELOW_PHASED_SHIPS_LAYER) { 059// x = -50; 060// y = 120; 061// w = 50; 062// h = 50; 063// color = new Color(150, 150, 0, 255); 064// a = 1f; 065// } else if (layer == CombatEngineLayers.BELOW_SHIPS_LAYER) { 066// x = -100; 067// y = -100; 068// w = 200; 069// h = 200; 070// color = Color.ORANGE; 071// } 072// 073// float alphaMult = viewport.getAlphaMult(); 074// 075// GL11.glDisable(GL11.GL_TEXTURE_2D); 076// GL11.glEnable(GL11.GL_BLEND); 077// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); 078// 079// 080// GL11.glColor4ub((byte)color.getRed(), 081// (byte)color.getGreen(), 082// (byte)color.getBlue(), 083// (byte)(color.getAlpha() * alphaMult * a)); 084// 085// GL11.glBegin(GL11.GL_QUADS); 086// { 087// GL11.glVertex2f(x, y); 088// GL11.glVertex2f(x, y + h); 089// GL11.glVertex2f(x + w, y + h); 090// GL11.glVertex2f(x + w, y); 091// } 092// GL11.glEnd(); 093 } 094 095} 096 097 098