List of usage examples for com.badlogic.gdx.graphics Color Color
public Color(float r, float g, float b, float a)
From source file:de.gebatzens.meteva.MarketLevel.java
License:Open Source License
public MarketLevel(float x, float y, String id, int mlevel) { this.x = x;// www.j a va 2s . com this.y = y; this.id = id; this.mlevel = mlevel; color = new Color(252f / 255f, 70f / 255f, 10f / 255f, 0.35f); //color = GScout.guiColor.cpy(); //color.a = 0.3f; }
From source file:de.gebatzens.meteva.MarketLevel.java
License:Open Source License
public void render() { Color nc = new Color(1, 1, 1, 1).sub(color); nc.a = 0.6f;//from w w w. ja va 2 s . com GScout.drawBoxBorder(x, y, GScout.width * 0.25f, GScout.height * 0.08f, GScout.width * 0.005f, color, color.cpy().mul(new Color(0.5f, 0.5f, 0.5f, 1f))); GScout.batch.setColor(nc); GScout.drawBoxBorder(x, y, GScout.width * 0.25f * ((float) GScout.mprof.get(id) / (float) mlevel), GScout.height * 0.08f, GScout.width * 0.005f, nc, nc.cpy().mul(new Color(0.5f, 0.5f, 0.5f, 1f))); GScout.survivant.setColor(Color.BLACK); GScout.setFontSize(GScout.width * 0.04f); GScout.drawText(GScout.mprof.get(id) + "", x, y + GScout.height * 0.1f, true); }
From source file:de.gebatzens.meteva.MarketState.java
License:Open Source License
@Override public void render() { GScout.batch.setColor(1, 1, 1, 0.1f); float t = GScout.width * 0.005f; GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f - t), (float) (Gdx.graphics.getHeight() * 0.85f), (int) (Gdx.graphics.getWidth() * 0.72f + 2 * t), (int) (t)); GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.86f), (float) (Gdx.graphics.getHeight() * 0.15f), (int) t, (int) (Gdx.graphics.getHeight() * 0.7f)); GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f - t), (float) (Gdx.graphics.getHeight() * 0.15f - t), (int) (Gdx.graphics.getWidth() * 0.72f + 2 * t), (int) (t)); GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f - t), (float) (Gdx.graphics.getHeight() * 0.15f), (int) t, (int) (Gdx.graphics.getHeight() * 0.7f)); GScout.batch.setColor(0.7f, 0.7f, 0.7f, 0.3f); GScout.batch.draw(GScout.whiteTexture, (float) (Gdx.graphics.getWidth() * 0.14f), (float) (Gdx.graphics.getHeight() * 0.15f), (int) (Gdx.graphics.getWidth() * 0.72f), (int) (Gdx.graphics.getHeight() * 0.7f)); GScout.batch.setColor(new Color(1, 1, 1, 0.1f)); GScout.batch.draw(GScout.whiteTexture, Gdx.graphics.getWidth() * 0.14f, Gdx.graphics.getHeight() * 0.15f, Gdx.graphics.getWidth() * 0.72f, GScout.height * 0.55f); laser.render();//from ww w. java 2s . c o m leben.render(); spaceships.render(); back.render(); switch (state) { case LASER: laserb.render(); break; case LEBEN: break; case SPACESHIPS: break; } GScout.batch.setColor(Color.WHITE); float titleWidth = Gdx.graphics.getWidth() * 0.23f; GScout.batch.draw(shop, (float) (Gdx.graphics.getWidth() * 0.40), (float) (Gdx.graphics.getHeight() * 0.87), (int) titleWidth, (int) ((titleWidth / (float) shop.getRegionWidth()) * (float) shop.getRegionHeight())); }
From source file:de.gebatzens.meteva.PlayerSpaceship.java
License:Open Source License
public boolean laser(float tx, float ty) { if (miningLaser == 0) return false; if (ice != 0) return false; if (miningLaserTarget != null) return false; for (GameObject g : state.objects) if (g instanceof Meteor) { Meteor m = (Meteor) g;// www.j a va2 s. c o m if (m.getLaserRect().contains((int) tx, (int) ty)) { miningLaserTarget = m; miningLaserTarget.color = new Color(0.8f, 0.8f, 1f, 1f); return true; } } return false; }
From source file:de.gebatzens.meteva.ScoreState.java
License:Open Source License
@Override public void init() { back = new Button(0, 0, new Color(0, 102f / 255f, 188f / 255f, 200f / 255f), GScout.getString("back_button"), GScout.getRegion("button2"), (int) (0.2f * Gdx.graphics.getWidth())); back.x = Gdx.graphics.getWidth() / 2f - back.width / 2f; back.y = Gdx.graphics.getHeight() * 0.04f; back.updateRect();//from w w w. j a va 2 s . c o m highscoretitle = GScout.getRegion("highscoretitle"); fast = new GamemodeButton(GScout.width * 0.1, GScout.height * 0.03, GScout.getString("fast_gm")); normal = new GamemodeButton(GScout.width * 0.65, GScout.height * 0.03, GScout.getString("normal_gm")); db = new DeleteButton(GScout.width * 0.03f, GScout.height * 0.03f, GScout.getRegion("trash"), GScout.width * 0.06f); }
From source file:de.hasait.tanks.app.common.ConnectingScreen.java
License:Apache License
public ConnectingScreen(final TanksScreenContext pContext, final GameConfig pConfig) { super(pContext, 800, 600); _config = pConfig;//from w w w . ja va 2 s . c o m _world = new DistributedWorld(); setBackgroundColor(new Color(0.0f, 0.2f, 0.0f, 1.0f)); addInputProcessor(_inputProcessor); final Label titleLabel = createLabel("Connecting...", 2.0f); final Table layout = addLayout(); layout.setFillParent(true); layout.add(titleLabel); }
From source file:de.hasait.tanks.app.common.GameScreen.java
License:Apache License
public GameScreen(final TanksScreenContext pContext, final DistributedWorld pWorld) { super(pContext, pWorld.getWorld().getWorldW(), pWorld.getWorld().getWorldH()); _world = pWorld;/*from w w w . j a v a2s . c om*/ addDisposable(_world); _tanksLogic = new TanksLogic(_world, _callback); _tankTexture = loadTexture("Tank.png"); _turretTexture = loadTexture("Turret.png"); _bulletTexture = loadTexture("Bullet.png"); _rockTexture = loadTexture("Rock.png"); _shotSound = Gdx.audio.newSound(Gdx.files.internal("Shot.wav")); addDisposable(_shotSound); setBackgroundColor(new Color(0.4f, 0.4f, 0.1f, 1.0f)); setBackgroundMusic("Music.mp3"); setTextMargin(10.0f); addInputProcessor(_inputProcessor); for (final LocalTank tank : _world.getWorld().getLocalLocalTanks()) { tank.getPlayerConfig().initActions(this); } }
From source file:de.hasait.tanks.app.common.MainMenuScreen.java
License:Apache License
public MainMenuScreen(final TanksScreenContext pContext) { super(pContext, 800, 600); setBackgroundColor(new Color(0.0f, 0.0f, 0.2f, 1.0f)); addInputProcessor(_inputProcessor);/*from www . j av a2s.c om*/ final Table layout = addLayout(); layout.setFillParent(true); layout.defaults().pad(5.0f).align(Align.left).fill(); final Label titleLabel = createLabel("Welcome to Tanks", 2.0f); layout.add(titleLabel).colspan(2).padBottom(20.0f); final Preferences preferences = obtainPreferences(); layout.row(); layout.add(createLabel("Room")); _roomNameField = createTextField(preferences.getString(PREFKEY__ROOM_NAME, "Default")); layout.add(_roomNameField); for (int i = 0; i < 2; i++) { layout.row(); layout.add(createLabel("Player " + (i + 1))); final TextField playerNameField = createTextField(); layout.add(playerNameField); _playerNameFields.add(playerNameField); PlayerConfig playerConfig = null; final String preferencesString = preferences.getString(PREFKEY__PLAYER_CONFIG + i); if (!Util.isEmpty(preferencesString)) { try { playerConfig = (PlayerConfig) Util.serializeFromString(preferencesString); Gdx.app.log("PlayerConfig", "Read for player " + i); } catch (final RuntimeException pE) { Gdx.app.error("PlayerConfig", "Cannot read for player " + i, pE); } } if (playerConfig == null) { Gdx.app.log("PlayerConfig", "New for player " + i); playerConfig = new PlayerConfig(); if (i == 0) { playerConfig.setName("Player " + (i + 1)); setActionSet1(playerConfig); } else if (i == 1) { setActionSet2(playerConfig); } } playerNameField.setText(playerConfig.getName()); playerNameField.setUserObject(playerConfig); layout.add(actionConfig("Fire", playerConfig::getFire, playerConfig::setFire)); layout.row(); layout.add(createLabel(Util.EMPTY)); layout.add(actionConfig("Move Forward", playerConfig::getMoveForward, playerConfig::setMoveForward)); layout.add(actionConfig("Move Backward", playerConfig::getMoveBackward, playerConfig::setMoveBackward)); layout.row(); layout.add(createLabel(Util.EMPTY)); layout.add(actionConfig("Rotate Left", playerConfig::getRotateLeft, playerConfig::setRotateLeft)); layout.add(actionConfig("Rotate Right", playerConfig::getRotateRight, playerConfig::setRotateRight)); layout.row(); layout.add(createLabel(Util.EMPTY)); layout.add(actionConfig("Turret Left", playerConfig::getTurrentRotateLeft, playerConfig::setTurrentRotateLeft)); layout.add(actionConfig("Turret Right", playerConfig::getTurrentRotateRight, playerConfig::setTurrentRotateRight)); } layout.row(); _connectButton = createTextButton("Connect"); layout.add(_connectButton).colspan(2); _connectButton.addListener(pEvent -> { if (pEvent instanceof ChangeListener.ChangeEvent) { _connect = true; } return false; }); }
From source file:dk.sidereal.lumm.architecture.LummScene.java
License:Apache License
/** * Base constructor for LummScene. Nor this or {@link LummScene#LummScene()} * should be overriden, as the native backend might not be started if done * to the first scene. Because of this, use {@link #onCreate()} for * instantiation of {@link LummObject} instances and everything else. *//*from www . jav a 2s . c o m*/ public LummScene(Object... params) { this.sceneLayers = new ArrayList<LummSceneLayer>(); this.sceneLayerComparator = new Comparator<LummSceneLayer>() { @Override public int compare(LummSceneLayer o1, LummSceneLayer o2) { return o1.priorityLevel - o2.priorityLevel; } }; this.toAdd = new ArrayList<LummObject>(); this.toRemove = new ArrayList<LummObject>(); this.objectsMap = new HashMap<String, HashMap<String, LummObject>>(); this.toKeepForNextScene = new ArrayList<LummObject>(); this.bgColor = new Color(1, 1, 1, 1); this.runParameters = params; }
From source file:dk.sidereal.lumm.components.input.Clickable.java
License:Apache License
@Override protected void initialiseClass() { if (!Lumm.debug.isEnabled()) return;//w ww . ja v a 2 s .com if (debugSpriteSource == null) { debugSpriteSource = new Sprite( Lumm.assets.get(Lumm.assets.frameworkAssetsFolder + "White.png", Texture.class)); debugSpriteSource.setColor(new Color(218 / 255f, 165 / 255f, 32 / 255f, 0.5f)); } }