use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class TiledMapObjectLoadingTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 100, 100);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
map = new TmxMapLoader().load("data/maps/tiled-objects/test-load-mapobjects.tmx");
MapProperties properties = map.getProperties();
shapeRenderer = new ShapeRenderer();
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class SpriteBatchOriginScaleTest method create.
@Override
public void create() {
region = new TextureRegion(new Texture("data/badlogicsmall.jpg"));
batch = new SpriteBatch();
renderer = new ShapeRenderer();
renderer.setProjectionMatrix(batch.getProjectionMatrix());
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class PolygonSpriteTest method create.
@Override
public void create() {
texture = new Texture(Gdx.files.internal("data/tree.png"));
PolygonRegionLoader loader = new PolygonRegionLoader();
region = loader.load(new TextureRegion(texture), Gdx.files.internal("data/tree.psh"));
renderer = new ShapeRenderer();
camera = new OrthographicCamera(480, 320);
camera.position.x = 240;
camera.position.y = 160;
camera.update();
batch = new PolygonSpriteBatch();
for (int i = 0; i < 50; i++) {
PolygonSprite sprite = new PolygonSprite(region);
sprite.setPosition(MathUtils.random(-30, 440), MathUtils.random(-30, 290));
sprite.setColor(MathUtils.random(), MathUtils.random(), MathUtils.random(), 1.0f);
sprite.setScale(MathUtils.random(0.5f, 1.5f), MathUtils.random(0.5f, 1.5f));
sprites.add(sprite);
}
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project Catacomb-Snatch by Catacomb-Snatch.
the class Monitoring method render.
public static void render(Batch batch) {
if (font == null) {
font = Art.skin.get(Label.LabelStyle.class).font;
}
if (renderer == null) {
renderer = new ShapeRenderer();
}
renderer.setProjectionMatrix(batch.getProjectionMatrix());
renderer.begin(ShapeRenderer.ShapeType.Filled);
int y = 1, base;
for (Property property : PROPERTIES.values()) {
renderer.setColor(property.color);
base = y;
for (int x = 64, i = 0; i < SAMPLES; i++) {
renderer.rectLine(x, y, x += 2, y = Math.max(base, base + Math.round(property.values[i] / property.maximum * 36)), 2);
}
y = base + 48;
}
renderer.end();
batch.begin();
y = 10;
Property property;
for (Map.Entry<String, Property> entry : PROPERTIES.entrySet()) {
property = entry.getValue();
font.draw(batch, entry.getKey(), 2, y + 30);
font.draw(batch, "max:", 2, y + 20);
font.draw(batch, "" + property.maximum, 26, y + 20);
font.draw(batch, "min:", 2, y + 10);
font.draw(batch, "" + property.minimum, 26, y + 10);
font.draw(batch, "val:", 2, y);
font.draw(batch, "" + property.values[SAMPLES - 1], 26, y);
y += 48;
}
batch.end();
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project Alkahest-Coffee by AlkahestDev.
the class MainGame method create.
@Override
public void create() {
Gdx.graphics.setCursor(Gdx.graphics.newCursor(new Pixmap(Gdx.files.internal("mouseCursorTemp.png")), 0, 0));
assetManager = new AssetManager();
queueLoading();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.translate(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
camera.update();
//viewport = new FitViewport(1920, 1080, camera);
fontCaches = new Array<BitmapFontCache>();
BitmapFont dagger20 = new BitmapFont(Gdx.files.internal("fonts/dagger20.fnt"));
BitmapFont dagger30 = new BitmapFont(Gdx.files.internal("fonts/dagger30.fnt"));
BitmapFont dagger40 = new BitmapFont(Gdx.files.internal("fonts/dagger40.fnt"));
BitmapFont dagger50 = new BitmapFont(Gdx.files.internal("fonts/dagger50.fnt"));
dagger20.getData().markupEnabled = true;
dagger30.getData().markupEnabled = true;
dagger40.getData().markupEnabled = true;
dagger50.getData().markupEnabled = true;
fontCaches.add(new BitmapFontCache(dagger20));
fontCaches.add(new BitmapFontCache(dagger30));
fontCaches.add(new BitmapFontCache(dagger40));
fontCaches.add(new BitmapFontCache(dagger50));
shapeRenderer = new ShapeRenderer();
gameMain = new MainMenu(fontCaches, assetManager, camera);
loadingMenu = new LoadingMenu(fontCaches, assetManager, camera);
connectingMenu = new ConnectingMenu(fontCaches, assetManager, camera);
serverBrowser = new ServerBrowser(fontCaches, assetManager, camera);
settingsMenu = new SettingsMenu(fontCaches, assetManager, camera);
pickingInfoMenu = new ClientPickingInfoMenu(fontCaches, assetManager, camera);
lobbyMenu = new ClientLobbyMenu(fontCaches, assetManager, camera);
// loadingmenu is the only one that is setup before anything else is loaded, background frames are loaded and added to it here
setupLoadingMenu();
scW = Gdx.graphics.getWidth();
scH = Gdx.graphics.getHeight();
//System.out.println(new Pixmap(Gdx.files.internal("pixmapTest.png")).getPixel(0,0)>>8);//since gimp doesn't do alpha in a friendly way, I'll bitshift right 8 bits to ignore alpha
state = GameState.State.LOADINGGAME;
batch = new SpriteBatch();
client = new MultiplayerClient();
clientSoldier = new PlayerSoldier(new Rectangle(0, 0, 1, 2), 0, "");
client.startClient();
shapeRenderer.setProjectionMatrix(camera.combined);
batch.setProjectionMatrix(camera.combined);
menu = new UniversalClientMenu(fontCaches, assetManager, camera);
Gdx.input.setInputProcessor(this);
}
Aggregations