1
我使用以下代碼創建了一個小測試,並嘗試執行這些步驟以使用熱交換功能。在libGDX中使用Java的HotSwap功能
- 運行使用Debug按鈕
- 創建渲染功能一個破發點,暫停該程序的程序。
- 變化rectangle.width
- 價值編譯程序
- 讓重裝的IntelliJ的代碼。
但是,這似乎並沒有改變屏幕上矩形的大小。
public class HotSwapTest extends ApplicationAdapter {
OrthographicCamera camera;
ShapeRenderer shapeRenderer;
private static final int SCREEN_WIDTH = 800;
private static final int SCREEN_HEIGHT = 480;
Rectangle rectangle;
@Override
public void create() {
shapeRenderer = new ShapeRenderer();
camera = new OrthographicCamera();
camera.setToOrtho(false, SCREEN_WIDTH, SCREEN_HEIGHT);
rectangle = new Rectangle();
rectangle.x = SCREEN_WIDTH/2 - 64/2;
rectangle.y = 20;
rectangle.width = 100;
rectangle.height = 30;
}
@Override
public void render() {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
shapeRenderer.setProjectionMatrix(camera.combined);
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
shapeRenderer.setColor(1, 1, 0, 1);
shapeRenderer.rect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
shapeRenderer.end();
camera.update(); // only if we're moving the screen though
}
}