use of de.johni0702.minecraft.gui.utils.lwjgl.Point in project jGui by ReplayMod.
the class AbstractGuiHorizontalScrollbar method mouseDrag.
@Override
public boolean mouseDrag(ReadablePoint position, int button, long timeSinceLastCall) {
if (dragging) {
Point pos = new Point(position);
if (getContainer() != null) {
getContainer().convertFor(this, pos);
}
updateValue(pos);
}
return dragging;
}
use of de.johni0702.minecraft.gui.utils.lwjgl.Point in project jGui by ReplayMod.
the class AbstractGuiHorizontalScrollbar method draw.
@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
super.draw(renderer, size, renderInfo);
int width = size.getWidth();
int height = size.getHeight();
renderer.bindTexture(TEXTURE);
// Draw background
// We have to increase the border size as there is one pixel row which is part of the border while drawing
// but isn't during position calculations due to shadows
Utils.drawDynamicRect(renderer, width, height, TEXTURE_BG_X, TEXTURE_BG_Y, TEXTURE_BG_WIDTH, TEXTURE_BG_HEIGHT, BORDER_TOP + 1, BORDER_BOTTOM, BORDER_LEFT + 1, BORDER_RIGHT);
// Draw slider
int bodyWidth = size.getWidth() - BORDER_LEFT - BORDER_RIGHT;
int barOffset = (int) (bodyWidth * offset) + BORDER_LEFT;
int barWidth = (int) (bodyWidth * zoom);
Utils.drawDynamicRect(new OffsetGuiRenderer(renderer, new Point(barOffset, BORDER_TOP), size), barWidth, height - (BORDER_TOP + 1) - BORDER_BOTTOM, TEXTURE_FG_X, TEXTURE_FG_Y, TEXTURE_FG_WIDTH, TEXTURE_FG_HEIGHT, 2, 1, 1, 1);
}
use of de.johni0702.minecraft.gui.utils.lwjgl.Point in project jGui by ReplayMod.
the class AbstractGuiSlider method mouseRelease.
@Override
public boolean mouseRelease(ReadablePoint position, int button) {
if (dragging) {
dragging = false;
Point pos = new Point(position);
if (getContainer() != null) {
getContainer().convertFor(this, pos);
}
updateValue(pos);
return true;
} else {
return false;
}
}
use of de.johni0702.minecraft.gui.utils.lwjgl.Point in project jGui by ReplayMod.
the class AbstractGuiSlider method mouseClick.
@Override
public boolean mouseClick(ReadablePoint position, int button) {
Point pos = new Point(position);
if (getContainer() != null) {
getContainer().convertFor(this, pos);
}
if (isMouseHovering(pos) && isEnabled()) {
updateValue(pos);
dragging = true;
return true;
}
return false;
}
use of de.johni0702.minecraft.gui.utils.lwjgl.Point in project jGui by ReplayMod.
the class AbstractGuiColorPicker method draw.
@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
super.draw(renderer, size, renderInfo);
if (renderInfo.layer == 0) {
int width = size.getWidth();
int height = size.getHeight();
// Draw outline
renderer.drawRect(0, 0, width, height, OUTLINE_COLOR);
// Draw color
renderer.drawRect(1, 1, width - 2, height - 2, color);
} else if (renderInfo.layer == 1) {
ReadablePoint offsetPoint = new Point(0, size.getHeight());
ReadableDimension offsetSize = new Dimension(PICKER_SIZE, PICKER_SIZE);
OffsetGuiRenderer offsetRenderer = new OffsetGuiRenderer(renderer, offsetPoint, offsetSize);
offsetRenderer.startUsing();
try {
picker.draw(offsetRenderer, offsetSize, renderInfo);
} finally {
offsetRenderer.stopUsing();
}
}
}
Aggregations