MatthiasM, I understand your concern for not wanting me to scale the entire UI, but this seems like the best option for me to get the look and feel of my game consistent across all resolutions. I do have my sliders set up with 9-way split graphics, but font sizes and the game's aspect ratio are causing problems, and my button graphics are textures and are already being scaled. I'm going to at least give TWL scaling a try, with or without your help, but I would be hugely grateful if you would lend me your knowledge.
So far I've got TWL widgets to scale by modifying TWL's LWJGLRenderer like this:
Code:
@Override
public boolean startRenderering() {
if(width <= 0 || height <= 0) {
return false;
}
hasScissor = false;
tintStack = tintStateRoot;
clipStack.clearStack();
// GL11.glPushAttrib(GL11.GL_ENABLE_BIT|GL11.GL_TRANSFORM_BIT|GL11.GL_HINT_BIT|
// GL11.GL_COLOR_BUFFER_BIT|GL11.GL_SCISSOR_BIT|GL11.GL_LINE_BIT|GL11.GL_TEXTURE_BIT);
// GL11.glMatrixMode(GL11.GL_PROJECTION);
// GL11.glPushMatrix();
// GL11.glLoadIdentity();
// GL11.glOrtho(0, width, height, 0, -1.0, 1.0);
// GL11.glMatrixMode(GL11.GL_MODELVIEW);
// GL11.glPushMatrix();
// GL11.glLoadIdentity();
// GL11.glEnable(GL11.GL_TEXTURE_2D);
// GL11.glEnable(GL11.GL_BLEND);
// GL11.glEnable(GL11.GL_LINE_SMOOTH);
// GL11.glDisable(GL11.GL_DEPTH_TEST);
// GL11.glDisable(GL11.GL_LIGHTING);
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
return true;
}
@Override
public void endRendering() {
if(swCursor != null) {
tintStack = tintStateRoot;
swCursor.render(mouseX, mouseY);
}
// GL11.glPopMatrix();
// GL11.glMatrixMode(GL11.GL_PROJECTION);
// GL11.glPopMatrix();
// GL11.glPopAttrib();
}
This is most likely not the correct way to do things, but it at least partially works, which is better than what I started with. I'm now having issue with buttons not receiving mouse clicks at low resolutions (even though the on-hover effect works fine?). Also, the clipping rectangles seem to not be scaled properly, so some Widgets are only partially visible.
Any ideas on how to do this properly or how to fix my issues would be greatly appreciated. Thanks!