I have done some improvement on the slider class and hope it can be included in the next released. Basically it controls the display of the ticks and the offset of the ticks in the slider.
public class Slider extends Widget {
private boolean showMarking = true;
private int MarkingOffset = 1;
@Override
protected void drawWidget(Texture2DCanvas texCanvas, int offsetX,
int offsetY, int width, int height, boolean drawsSelf) {
if (drawsSelf)
texCanvas.getImage().clear(offsetX, offsetY, width, height, true,
null);
int leftWidth = HUDTextureUtils.getTextureWidth(leftTex);
int rightWidth = HUDTextureUtils.getTextureWidth(rightTex);
int bodyWidth = width - leftWidth - rightWidth;
DrawUtils.drawImage(null, leftTex, null, texCanvas, offsetX, offsetY,
width, height);
DrawUtils.drawImage(null, bodyTex, TileMode.TILE_X, texCanvas, offsetX
+ leftWidth, offsetY, bodyWidth, height);
DrawUtils.drawImage(null, rightTex, null, texCanvas, offsetX + width
- rightWidth, offsetY, rightWidth, height);
if (showMarking == true) {
if (valueMarkTex != null) {
int valueMarkWidth = HUDTextureUtils
.getTextureWidth(valueMarkTex);
int valueMarkHeight = HUDTextureUtils
.getTextureHeight(valueMarkTex);
/* Eltekon
int n = getMaxValue() - getMinValue();
for (int i = 0; i <= n; i++) {
int pos = bodyWidth * i / n;
DrawUtils.drawImage(null, valueMarkTex, null, texCanvas,
offsetX + leftWidth + pos - (valueMarkWidth / 2)
- 1, offsetY + height - valueMarkHeight,
valueMarkWidth, valueMarkHeight);
}
*/
[color=red]int n = ( getMaxValue() - getMinValue() )/ MarkingOffset;[/color]
for (int i = 0; i <= n; i++) {
int pos = bodyWidth * i / n;
DrawUtils.drawImage(null, valueMarkTex, null, texCanvas,
offsetX + leftWidth + pos - (valueMarkWidth / 2)
- 1, offsetY + height - valueMarkHeight,
valueMarkWidth, valueMarkHeight);
}
}
}
if (getMaxValue() > getMinValue()) {
this.currentHandlePosPx = leftWidth
+ drawHandle(texCanvas, offsetX + leftWidth, offsetY, width
- leftWidth - rightWidth, height, handleTex,
isSliding ? forcedHandlePosPx - leftWidth : -1);
}
}
public void showMarking(boolean flag) {
showMarking = flag;
}
public void setMarkingDivider( int nDivider ){
MarkingOffset = nDivider;
}
}