/** * Returns the {@link Graphics} service. */ public static Graphics graphics() { return platform.graphics(); }
/** Returns the size of this screen, for use by transitions. * Defaults to the size of the entire view. */ public IDimension size () { return _game.plat.graphics().viewSize; }
public Hud (SceneGame game) { _game = game; layer = new CanvasLayer(game.plat.graphics(), 1, 1); }
/** Returns the size of this screen. This is used for transitions. * Defaults to the size of the entire view. */ public IDimension size () { return game().plat.graphics().viewSize; }
public void update () { _layout = _game.plat.graphics().layoutText(String.valueOf(label.get()), _fmt); } public float labelWidth () { return 0; }
/** * Creates a menu host using the given values. The root layer is set to the layer of the given * root and the stylesheet to its stylesheet. */ public MenuHost (Interface iface, Elements<?> root) { this(iface, root.layer); _stylesheet = root.stylesheet(); _screenArea.setSize(iface.plat.graphics().viewSize); }
/** Called when this screen will potentially be shown. * Should create main UI and prepare it for display. */ public void wake () { _flags |= AWAKE; closeOnSleep(_game.plat.graphics().deviceOrient.connectNotify( new Slot<Graphics.Orientation>() { public void onEmit (Graphics.Orientation orient) { _sizeValue.updateForce(size()); } })); }
/** Returns the stylesheet to use for this screen. */ protected Stylesheet stylesheet () { return SimpleStyles.newSheet(game().plat.graphics()); }
/** Returns the stylesheet to use for this screen. */ protected Stylesheet stylesheet () { return SimpleStyles.newSheet(game().plat.graphics()); }
@Override public void init (Platform plat, Screen oscreen, Screen nscreen) { super.init(plat, oscreen, nscreen); nscreen.layer.setDepth(-1); _obatch = new RotateYBatch(plat.graphics().gl, 0.5f, 0.5f, 1); oscreen.layer.setBatch(_obatch); _nbatch = new RotateYBatch(plat.graphics().gl, 0.5f, 0.5f, 1); nscreen.layer.setBatch(_nbatch); }
protected ImageImpl (Platform plat, boolean async, Scale preScale, int preWidth, int preHeight, String source) { this(plat.graphics(), async ? plat.exec().<Image>deferredPromise() : RPromise.<Image>create(), preScale, preWidth, preHeight, source); }
protected ImageImpl (Platform plat, boolean async, Scale preScale, int preWidth, int preHeight, String source) { this(plat.graphics(), async ? plat.exec().<Image>deferredPromise() : RPromise.<Image>create(), preScale, preWidth, preHeight, source); }
public SceneGame (Platform plat, int updateRate) { super(plat, updateRate); GL20 gl = plat.graphics().gl; gl.glDisable(GL20.GL_CULL_FACE); gl.glEnable(GL20.GL_BLEND); gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA); defaultBatch = createDefaultBatch(gl); viewSurf = new Surface(plat.graphics(), plat.graphics().defaultRenderTarget, defaultBatch); rootLayer = new RootLayer(); paint.connect(new Slot<Clock>() { public void onEmit (Clock clock) { paintScene(); } }).atPrio(scenePaintPrio()); }
public void update () { _vlayout = _game.plat.graphics().layoutText(String.valueOf(value.get()), _fmt); _size.setSize(llayout.size.width() + GAP + _vlayout.size.width(), Math.max(llayout.size.height(), _vlayout.size.height())); } public float labelWidth () { return llayout.size.width(); }
@Override public Root setSize (float width, float height) { super.setSize(width, height); // update the image to the new size, if it's changed Texture old = _texture.get(); if (old == null || old.displayWidth != width || old.displayHeight != height) { _texture.update(iface.plat.graphics().createTexture(width, height, textureConfig())); } return this; }
public DebugDrawBox2D(Platform plat, float width, float height) { super(new OBBViewportTransform()); this.plat = plat; viewportTransform.setYFlip(true); strokeWidth = 1.0f; strokeAlpha = 255; fillAlpha = 150; canvas = plat.graphics().createCanvas(width, height); canvas.setStrokeWidth(strokeWidth); setStrokeColorFromCache(); setFillColorFromCache(); }
@Override protected void layout (LayoutData ldata, float left, float top, float width, float height) { super.layout(ldata, left, top, width, height); // prepare the glyph if (width == 0 && height == 0) { _glyph.close(); return; } _glyph.prepare(root().iface.plat.graphics(), width, height); _glyph.layer().setTranslation(left, top); render(); }
@Override public void setPosition (float x, float y) { Root root = root(); if (root != null) { Scale scale = root.iface.plat.graphics().scale(); if (hrange.active()) x = scale.roundToNearestPixel(x); if (vrange.active()) y = scale.roundToNearestPixel(y); } Scroller.this.content.layer.setTranslation(x, y); } };
@Override public void layout () { super.layout(); Texture texture = _texture.get(); TextureSurface surf = new TextureSurface(iface.plat.graphics(), _defaultBatch, texture); surf.begin().clear(); layer.paint(surf); surf.end().close(); }
/** Called when a screen becomes the top screen, and is therefore made visible. */ public void wasShown () { closeOnHide(game().update.connect(update.slot())); closeOnHide(game().paint.connect(paint.slot())); closeOnHide(game().plat.graphics().deviceOrient.connectNotify( new Slot<Graphics.Orientation>() { public void onEmit (Graphics.Orientation orient) { _sizeValue.updateForce(size()); } })); }