@Override public void setCursor (Cursor cursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", ((GwtCursor)cursor).cssCursorProperty); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY (NativeEvent e, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop())); }
protected int getRelativeX (Touch touch, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * touch.getRelativeX(target)); }
protected int getRelativeY (Touch touch, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * touch.getRelativeY(target)); }
@Override public int getBackBufferWidth () { return canvas.getWidth(); }
@Override public int getBackBufferHeight () { return canvas.getHeight(); }
@Override public void setCursor (Cursor cursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", ((GwtCursor)cursor).cssCursorProperty); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY (NativeEvent e, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop())); }
protected int getRelativeX (Touch touch, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * touch.getRelativeX(target)); }
protected int getRelativeY (Touch touch, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * touch.getRelativeY(target)); }
@Override public int getBackBufferWidth () { return canvas.getWidth(); }
@Override public int getBackBufferHeight () { return canvas.getHeight(); }
@Override public void setSystemCursor (SystemCursor systemCursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", GwtCursor.getNameForSystemCursor(systemCursor)); }
@Override public int getWidth () { return canvas.getWidth(); }
@Override public int getHeight () { return canvas.getHeight(); }
@Override public void setSystemCursor (SystemCursor systemCursor) { ((GwtApplication)Gdx.app).graphics.canvas.getStyle().setProperty("cursor", GwtCursor.getNameForSystemCursor(systemCursor)); }
@Override public int getWidth () { return canvas.getWidth(); }
@Override public int getHeight () { return canvas.getHeight(); }