mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-14 04:59:57 +00:00
PanelActiveFrame WIP
This commit is contained in:
1 parent
cb8a78e82b
commit
1f44ea5987
3 files changed
+107
-3
No files matched your search
@@ -2,6 +2,7 @@ package noppes.npcs.client.gui.util.animation;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiUtil;
|
||||
import noppes.npcs.client.gui.util.animation.panel.PanelActiveFrame;
|
||||
import noppes.npcs.client.gui.util.animation.panel.PanelFrameType;
|
||||
import noppes.npcs.constants.animation.EnumFrameType;
|
||||
|
||||
@@ -9,6 +10,7 @@ public class AnimationGraphEditor extends ViewportGraphEditor {
|
||||
|
||||
public GridPointManager pointManager;
|
||||
public PanelFrameType frameTypePanel = new PanelFrameType(this);
|
||||
public PanelActiveFrame activeFramePanel = new PanelActiveFrame(this);
|
||||
|
||||
public AnimationGraphEditor(GuiNPCInterface parent) {
|
||||
super(parent);
|
||||
@@ -18,13 +20,13 @@ public class AnimationGraphEditor extends ViewportGraphEditor {
|
||||
|
||||
public void initGui(int startX, int startY, int endX, int endY) {
|
||||
super.initGui(startX, startY, endX, endY);
|
||||
frameTypePanel.initGui(startX - 70, startY, startX, endY);
|
||||
frameTypePanel.initGui(startX - 70, startY, startX, startY + 78);
|
||||
activeFramePanel.initGui(startX - 70, startY + 79, startX, endY-1);
|
||||
}
|
||||
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks, int wheel) {
|
||||
GuiUtil.drawGradientRect(startX, startY, endX, endY, 0xFF303030, 0xFF303030);
|
||||
|
||||
frameTypePanel.draw();
|
||||
activeFramePanel.draw();
|
||||
grid.draw(mouseX, mouseY, partialTicks, wheel);
|
||||
pointManager.draw(mouseX, mouseY, partialTicks);
|
||||
presetOverlay.draw(mouseX, mouseY, wheel);
|
||||
@@ -33,18 +35,21 @@ public class AnimationGraphEditor extends ViewportGraphEditor {
|
||||
public void mouseClicked(int mouseX, int mouseY, int button) {
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
frameTypePanel.mouseClicked(mouseX, mouseY, button);
|
||||
activeFramePanel.mouseClicked(mouseX, mouseY, button);
|
||||
pointManager.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
frameTypePanel.keyTyped(c, i);
|
||||
activeFramePanel.keyTyped(c, i);
|
||||
pointManager.keyTyped(c, i);
|
||||
}
|
||||
|
||||
public EnumFrameType getSelectedType() {
|
||||
return frameTypePanel.selectedElement.type;
|
||||
}
|
||||
|
||||
public void setSelectedType(EnumFrameType type) {
|
||||
frameTypePanel.list.forEach(element -> {
|
||||
if(element.type == type)
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package noppes.npcs.client.gui.util.animation.panel;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import noppes.npcs.client.gui.util.GuiUtil;
|
||||
import noppes.npcs.client.gui.util.animation.AnimationGraphEditor;
|
||||
import noppes.npcs.client.gui.util.animation.OverlayKeyPresetViewer;
|
||||
import noppes.npcs.client.utils.Color;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class PanelActiveFrame {
|
||||
public AnimationGraphEditor graph;
|
||||
|
||||
public int startX, startY, endX, endY, width, height;
|
||||
public float scale = 0.6f;
|
||||
public int elementHeight = 11, elementSpacing = 2;
|
||||
|
||||
public PanelTextBox frame = new PanelTextBox(), value = new PanelTextBox();
|
||||
|
||||
public PanelActiveFrame(AnimationGraphEditor graph) {
|
||||
this.graph = graph;
|
||||
}
|
||||
|
||||
public void initGui(int startX, int startY, int endX, int endY) {
|
||||
this.startX = startX;
|
||||
this.startY = startY;
|
||||
this.endX = endX;
|
||||
this.endY = endY;
|
||||
this.width = endX - startX;
|
||||
this.height = endY - startY;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
int mouseX = graph.parent.mouseX, mouseY = graph.parent.mouseY;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(startX, startY + 1, 0);
|
||||
// GuiUtil.drawRectD(0, 0, width - 1, height, 0xff3d3d3d);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
new Color(0X2D2D2D,0.75F).glColor();
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(OverlayKeyPresetViewer.TEXTURE);
|
||||
GuiUtil.drawTexturedModalRect(0, -38, 88, 77, 44, 435);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, 1);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(-90,0,0,1);
|
||||
graph.getFontRenderer().drawString("Active frame", -62, -14, 0xdddddd);
|
||||
GuiUtil.drawHorizontalLine(-6,-62,-2,0xffdddddd);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
// GL11.glTranslatef(0, 17, 0);
|
||||
graph.getFontRenderer().drawString("Easing", 9, 3, 0xb1b1b1);
|
||||
GL11.glTranslatef(0, 17, 0);
|
||||
graph.getFontRenderer().drawString("-Type", 9, 0, 0xb1b1b1);
|
||||
GL11.glTranslatef(0, 18, 0);
|
||||
graph.getFontRenderer().drawString("Frame", 9, 0, 0xb1b1b1);
|
||||
|
||||
GL11.glTranslatef(0, 15, 0);
|
||||
graph.getFontRenderer().drawString("Value", 9, 0, 0xb1b1b1);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
frame.screenX = 29; //remove scaling from maxStringWidth
|
||||
frame.screenY = 11;
|
||||
frame.boxScaleX = 1.2f;
|
||||
frame.textScale = scale;
|
||||
|
||||
boolean isAboveFrame = frame.isMouseAbove(mouseX - startX, mouseY - startY);
|
||||
frame.boxColor = new Color(isAboveFrame ? 0x797979 : 0x545454);
|
||||
frame.draw(graph.mc.fontRenderer);
|
||||
|
||||
value.screenX = 29; //remove scaling from maxStringWidth
|
||||
value.screenY = 20;
|
||||
value.boxScaleX = 1.2f;
|
||||
value.textScale = scale;
|
||||
boolean isAboveValue = value.isMouseAbove(mouseX - startX, mouseY - startY);
|
||||
value.boxColor = new Color(isAboveValue ? 0x797979 : 0x545454);
|
||||
value.draw(graph.mc.fontRenderer);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i) {
|
||||
|
||||
}
|
||||
|
||||
public void mouseClicked(int mouseX, int mouseY, int button) {
|
||||
|
||||
}
|
||||
|
||||
public boolean isMouseAbove(int mouseX, int mouseY) {
|
||||
return mouseX >= startX && mouseX < endX && mouseY >= startY && mouseY < endY;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Reference in new issue
Block a user