package com.demez.ui;


import com.demez.Client;
import com.demez.module.impl.HudOpener;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;

public class InGame extends GuiIngame{
	protected Minecraft mc = Minecraft.getMinecraft();

	public InGame(Minecraft mcIn) {
		super(mcIn);
	}
	
	
	public void renderGameOverlay(float p_175180_1_){
	     super.renderGameOverlay(p_175180_1_);
	     
	     
	     if(!mc.gameSettings.showDebugInfo) {
	    	 
		     renderArrayList();
	     }
	     
	     if (!(mc.currentScreen instanceof HUDConfigScreen))
	     {
	    	 Client.moduleManager.renderMods();
	     }
	}
	
	private void renderArrayList() {
		int yCount = 0;
		int index = 0;
		long x = 0;
		for(com.demez.module.Module m : Client.moduleManager.getModules()) {
			m.onRender();
			
			ScaledResolution sr = new ScaledResolution(mc);
			double offset = yCount*(mc.fontRendererObj.FONT_HEIGHT + 6);
			
			if(m.isToggled()) {
				Gui.drawRect(sr.getScaledWidth() - mc.fontRendererObj.getStringWidth(m.getName()) - 15, offset, sr.getScaledWidth(), 6 + mc.fontRendererObj.FONT_HEIGHT + offset, 0x80000000);
	            mc.fontRendererObj.drawString("- " + m.getName(), sr.getScaledWidth() - mc.fontRendererObj.getStringWidth(m.getName()) - 13 , 4 + offset , -1);
					yCount ++;
					index++;
					x++;

			}
		}
	}
}


