@Override public boolean setWindowedMode (int width, int height) { if (isFullscreenJSNI()) exitFullscreen(); canvas.setWidth(width); canvas.setHeight(height); return true; }
@Override public boolean setWindowedMode (int width, int height) { if (isFullscreenJSNI()) exitFullscreen(); canvas.setWidth(width); canvas.setHeight(height); return true; }
private void fullscreenChanged () { if (!isFullscreen()) { canvas.setWidth(config.width); canvas.setHeight(config.height); if (config.fullscreenOrientation != null) unlockOrientation(); } else { /* We just managed to go full-screen. Check if the user has requested a specific orientation. */ if (config.fullscreenOrientation != null) lockOrientation(config.fullscreenOrientation); } }
private void fullscreenChanged () { if (!isFullscreen()) { canvas.setWidth(config.width); canvas.setHeight(config.height); if (config.fullscreenOrientation != null) unlockOrientation(); } else { /* We just managed to go full-screen. Check if the user has requested a specific orientation. */ if (config.fullscreenOrientation != null) lockOrientation(config.fullscreenOrientation); } }
public GwtGraphics (Panel root, GwtApplicationConfiguration config) { Canvas canvasWidget = Canvas.createIfSupported(); if (canvasWidget == null) throw new GdxRuntimeException("Canvas not supported"); canvas = canvasWidget.getCanvasElement(); root.add(canvasWidget); canvas.setWidth(config.width); canvas.setHeight(config.height); this.config = config; WebGLContextAttributes attributes = WebGLContextAttributes.create(); attributes.setAntialias(config.antialiasing); attributes.setStencil(config.stencil); attributes.setAlpha(config.alpha); attributes.setPremultipliedAlpha(config.premultipliedAlpha); attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer); context = WebGLRenderingContext.getContext(canvas, attributes); context.viewport(0, 0, config.width, config.height); this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context); String versionString = gl.glGetString(GL20.GL_VERSION); String vendorString = gl.glGetString(GL20.GL_VENDOR); String rendererString = gl.glGetString(GL20.GL_RENDERER); glVersion = new GLVersion(Application.ApplicationType.WebGL, versionString, vendorString, rendererString); }
public GwtGraphics (Panel root, GwtApplicationConfiguration config) { Canvas canvasWidget = Canvas.createIfSupported(); if (canvasWidget == null) throw new GdxRuntimeException("Canvas not supported"); canvas = canvasWidget.getCanvasElement(); root.add(canvasWidget); canvas.setWidth(config.width); canvas.setHeight(config.height); this.config = config; WebGLContextAttributes attributes = WebGLContextAttributes.create(); attributes.setAntialias(config.antialiasing); attributes.setStencil(config.stencil); attributes.setAlpha(config.alpha); attributes.setPremultipliedAlpha(config.premultipliedAlpha); attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer); context = WebGLRenderingContext.getContext(canvas, attributes); context.viewport(0, 0, config.width, config.height); this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context); String versionString = gl.glGetString(GL20.GL_VERSION); String vendorString = gl.glGetString(GL20.GL_VENDOR); String rendererString = gl.glGetString(GL20.GL_RENDERER); glVersion = new GLVersion(Application.ApplicationType.WebGL, versionString, vendorString, rendererString); }
@Override public CanvasBuilder width(int width) { assertCanAddAttribute().setWidth(width); return this; } }
/** * Sets the width of the internal canvas coordinate space. * * @param width the width, in pixels * @see #getCoordinateSpaceWidth() */ public void setCoordinateSpaceWidth(int width) { getCanvasElement().setWidth(width); }
/** * Sets the width of the internal canvas coordinate space. * * @param width the width, in pixels * @see #getCoordinateSpaceWidth() */ public void setCoordinateSpaceWidth(int width) { getCanvasElement().setWidth(width); }
@Override public CanvasBuilder width(int width) { assertCanAddAttribute().setWidth(width); return this; } }
@Override public CanvasBuilder width(int width) { assertCanAddAttribute().setWidth(width); return this; } }
public final void setPixelSize(final int wide, final int high) { m_element.setWidth(m_wide = wide); m_element.setHeight(m_high = high); }
public final void setPixelSize(final int wide, final int high) { m_element.setWidth(m_wide = wide); m_element.setHeight(m_high = high); }
@Override public boolean setWindowedMode (int width, int height) { if (isFullscreenJSNI()) exitFullscreen(); canvas.setWidth(width); canvas.setHeight(height); return true; }
@Override public void setSize(int width, int height) { super.setSize(width, height); canvas.setWidth(width); canvas.setHeight(height); ctx.setSize(width, height); }
private HtmlCanvas(CanvasElement canvas, float width, float height) { this(canvas.getContext2d(), canvas, width, height); canvas.setWidth(MathUtil.iceil(width)); canvas.setHeight(MathUtil.iceil(height)); }
private void fullscreenChanged () { if (!isFullscreen()) { canvas.setWidth(config.width); canvas.setHeight(config.height); if (config.fullscreenOrientation != null) unlockOrientation(); } else { /* We just managed to go full-screen. Check if the user has requested a specific orientation. */ if (config.fullscreenOrientation != null) lockOrientation(config.fullscreenOrientation); } }
@Override public void setSize(int width, int height) { int swidth = scale.scaledCeil(width), sheight = scale.scaledCeil(height); super.setSize(swidth, sheight); elem.setWidth(swidth); elem.setHeight(sheight); rootWidth = swidth; rootHeight = sheight; }
@Override protected Canvas createCanvasImpl(Scale scale, int pixelWidth, int pixelHeight) { CanvasElement elem = Document.get().createCanvasElement(); elem.setWidth(pixelWidth); elem.setHeight(pixelHeight); return new HtmlCanvas(this, new HtmlImage(this, scale, elem, "<canvas>")); }
@Override protected Pattern toSubPattern(AbstractImageGL<?> image, boolean repeatX, boolean repeatY, float x, float y, float width, float height) { CanvasElement canvas = Document.get().createElement("canvas").<CanvasElement>cast(); canvas.setWidth(MathUtil.iceil(width)); canvas.setHeight(MathUtil.iceil(height)); canvas.getContext2d().drawImage(img, x, y, width, height, 0, 0, width, height); ImageElement subelem = canvas.cast(); return new HtmlPattern(image, subelem, repeatX, repeatY); }