public void draw(_Graphics g, String str, float x, float y, float targetWidth, int horizontalAlignment, bool wrap) { var graphics = (MonoGameGraphics)g; draw(graphics._spriteBatch, str, targetWidth, horizontalAlignment, wrap, new Vector2(x, y), new Microsoft.Xna.Framework.Color { R = (byte)(graphics._tint.R / 255.0f * _color.R), G = (byte)(graphics._tint.G / 255.0f * _color.G), B = (byte)(graphics._tint.B / 255.0f * _color.B), A = (byte)(graphics._tint.A / 255.0f * _color.A) }); }
public override void render(_Graphics g) { g.setColor(Mdx.graphics_.newColor(255, 255, 255, 255)); var gameWidth = g.getViewportWidth(); var gameHeight = g.getViewportHeight(); g.setTint(Mdx.graphics_.newColor(32, 32, 32, 255)); g.drawTilingDrawable(sampleTilingDrawable, gameWidth / 8f, gameHeight / 8f, 3 * gameWidth / 4f, 3 * gameHeight / 4f); g.setTint(Mdx.graphics_.newColor(255, 255, 255, 255)); g.drawRect(gameWidth / 8f, gameHeight / 8f, 3 * gameWidth / 4f, 3 * gameHeight / 4f); g.fillRect(400, 300, 32, 32); g.drawCircle(200, 200, 40); g.fillCircle(300, 300, 20); g.setColor(Mdx.graphics_.newColor(255, 0, 255, 255)); g.drawLineSegment(100, 100, 260, 340); g.fillTriangle(250, 74, 222, 108, 314, 147); g.drawTriangle(150, 74, 122, 108, 214, 147); g.drawTexture(sampleTexture, 200, 100); g.drawTextureRegion(sampleRegion, 500, 300); var prevShader = g.getShader(); g.setShader(sampleShader); g.drawTextureRegion(sampleAtlasRegion, 400, 200); g.setShader(prevShader); g.drawTextureRegion(sampleRegion2, 600, 150, 100, 100); g.drawSprite(sampleSprite); g.setColor(Mdx.graphics_.newColor(0, 255, 0, 255)); g.drawNinePatch(sampleNinePatch, 150, 300, 100, 100); g.fillTriangle(mousePosition.X, mousePosition.Y, mousePosition.X + 10, mousePosition.Y + 20, mousePosition.X, mousePosition.Y + 20); g.drawRect(400, 65, 100, 100); g.drawRect(500, 65, 100, 100); g.drawRect(600, 65, 100, 100); g.drawString("Hello!\nBonjour!\nCiao!\nGuten tag!\nNamaste!", 400, 65, 100, Align.LEFT_); g.drawString("Hello!\nBonjour!\nCiao!\nGuten tag!\nNamaste!", 500, 65, 100, Align.CENTER_); g.drawString("Hello!\nBonjour!\nCiao!\nGuten tag!\nNamaste!", 600, 65, 100, Align.RIGHT_); g.drawRect(400, 165, 100, 100); g.drawRect(500, 165, 100, 100); g.drawRect(600, 165, 100, 100); g.drawFontCache(sampleFontCache); //sampleMap.draw(g, (int) (gameWidth / 2), (int) (gameHeight / 4)); }
public void draw(_Graphics g, String str, float x, float y) { _sharedFontGlyphLayout.setText(str); draw(g, str, x, y, _sharedFontGlyphLayout.getWidth()); _sharedFontGlyphLayout.reset(); }
public void draw(_Graphics g, String str, float x, float y, float targetWidth) { draw(g, str, x, y, targetWidth, Align.LEFT_, true); }