yellowstonegames / SquidLib

Useful tools for roguelike, role-playing, strategy, and other grid-based games in Java. Feedback is welcome!
Other
448 stars 46 forks source link

setPosition on SquidPanel? #186

Closed Rakaneth closed 6 years ago

Rakaneth commented 6 years ago

I am not sure if I'm doing this incorrectly or if something is wrong, but SquidPanel.setPosition() does not seem to be placing the SquidPanel in the correct position.

    display.setBounds(0, msgHeight * cellHeight, gridWidth * cellWidth, gridHeight * cellHeight);
    msgs.setBounds(0, 0, msgWidth * cellWidth, msgHeight * cellHeight);
    statPanel = new SquidPanel(statWidth, statHeight, tcf.copy());
    statPanel.setPosition(960, 0);
    stage.addActor(display);
    stage.addActor(msgs);
    stage.addActor(statPanel);
    Gdx.input.setInputProcessor(new InputMultiplexer(stage, input));
    msgs.appendMessage(GDXMarkup
    .instance
    .colorString("[Green]Welcome[] to Wolf's Den II!"));
}

@Override
public void render()
{
    super.render();
    if (input.hasNext()) input.next();
    putCenter(display, "Play Screen", 10, SColor.MEDIUM_CRIMSON);
    putCenter(display, "[Esc] to return to title", 11, SColor.MEDIUM_CRIMSON);
    statPanel.put(0, 0, "Test String");
    stage.draw();
    stage.act();
}

This is the result:

image

I am expecting the Test String to be to the right of the Play Screen.

tommyettinger commented 6 years ago

I'll look into this; it looks like either a bug in SquidLib or one of the many quirks involved with using libGDX's scene2d.ui components. I think the code you supplied should be enough to figure this out, thanks.

tommyettinger commented 6 years ago

This should be fixed now; running the new PositionTest (based on your code to replicate the issue), I get a screen that looks like java_2017-11-03_14-57-39.

tommyettinger commented 6 years ago

Also, you should clear the screen if you don't already at the start of render(). Without that, the alpha-blended curves on text overlap many times, and look extremely thick and bold. This looks like: java_2017-11-03_17-05-27.