List of usage examples for com.badlogic.gdx.graphics Color Color
public Color(float r, float g, float b, float a)
From source file:ateamproject.kezuino.com.github.render.screens.CreditsScreen.java
private void singleStep(Label label, float x, float y) { Gdx.app.postRunnable(() -> {/*from w w w . j a va 2 s . com*/ label.setPosition(x, y); Color initRandomColor = new Color(rand.nextFloat(), rand.nextFloat(), 255, 1); label.setColor(initRandomColor); }); }
From source file:aurelienribon.texturepackergui.Canvas.java
License:Apache License
@Override public void create() { Assets.loadAll();//from ww w . jav a2 s.co m Texture.setEnforcePotImages(false); batch = new SpriteBatch(); font = new BitmapFont(); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.update(); infoLabel = new Sprite(Assets.getWhiteTex()); infoLabel.setPosition(0, 0); infoLabel.setSize(140, 80); infoLabel.setColor(new Color(0x2A / 255f, 0x3B / 255f, 0x56 / 255f, 180 / 255f)); int lblH = 25; Color lblC = new Color(0x2A / 255f, 0x6B / 255f, 0x56 / 255f, 180 / 255f); lblNextPage = new Label(10 + lblH, 120, lblH, "Next page", font, lblC, Anchor.TOP_RIGHT); lblPreviousPage = new Label(15 + lblH * 2, 120, lblH, "Previous page", font, lblC, Anchor.TOP_RIGHT); lblNextPage.setCallback(new Label.TouchCallback() { @Override public void touchDown(Label source) { nextPageRequested = true; } }); lblPreviousPage.setCallback(new Label.TouchCallback() { @Override public void touchDown(Label source) { previousPageRequested = true; } }); lblNextPage.show(); lblPreviousPage.show(); bgTex = Assets.getTransparentLightTex(); bgTex.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat); inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(new PanZoomInputProcessor(this)); inputMultiplexer.addProcessor(buttonsInputProcessor); Gdx.input.setInputProcessor(inputMultiplexer); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.GameOverScreen.java
License:Open Source License
@Override public void show() { super.show(); // Set Background addBackGroundShift("GdxMenus/gameover/gameoverbg.jpg"); //Add buttons addBackGround("GdxMenus/gameover/gameoverbuttons.png"); // Create all Buttons - Play Button Button restartButton = GlobalSettings.ISHD ? createButton("transparent", 475, 147, 103, 814) : createButton("transparent", 290, 90, 63, 497); Button menuButton = GlobalSettings.ISHD ? createButton("transparent", 475, 147, 734, 814) : createButton("transparent", 290, 90, 448, 497); restartButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { setScreenWithFading(new WorldScreen()); }//from w w w . j a va2 s.c o m }); menuButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { setScreenWithFading(new MenuScreen()); } }); // Set Font for end Score float fScaleFont = GlobalSettings.ISHD ? 1f : 0.7f; int iY = GlobalSettings.ISHD ? 1130 : 650; int endScore = GlobalSettings.PROFILE.getEndGameScore(); String text = endGame ? "END - " + endScore : Integer.toString(endScore); Label label = addLabel(text, "chinyen-font", fScaleFont, new Color(1f, 1f, 1f, 1f), 0, iY); label.setX(GlobalSettings.APPWIDTH / 2f - label.getTextBounds().width / 2f); if (GlobalSettings.PROFILE.isNewHighScore()) showHighScore(); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.GameOverScreen.java
License:Open Source License
private void showHighScore() { highScoreLabel = new Label("HIGH SCORE", getSkin(), "darktimes-font", new Color(0.309f, 0.584f, .796f, 1f)); highScoreLabel.setFontScale(.6f);/*from w w w. ja v a2s . com*/ highScoreLabel.setAlignment(Align.center); highScoreLabel.setWidth(GlobalSettings.APPWIDTH); highScoreLabel.setY(GlobalSettings.ISHD ? 930 : 560); highScoreLabel.setTouchable(null); // we can click through it stage.addActor(highScoreLabel); ActionHighScore highScoreAction = new ActionHighScore(); stage.addAction(highScoreAction); highScoreAction.setActor(highScoreLabel); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.LooseScreen.java
License:Open Source License
@Override public void show() { super.show(); // Set Background addBackGroundShift("GdxMenus/loose/loosebg.jpg"); addBackGround("GdxMenus/loose/loosebuttons.png"); // Set Lives/*from w ww . jav a 2 s. c o m*/ switch (GlobalSettings.PROFILE.getNbLifes()) { case 3: addBackGround("GdxMenus/endgame/heart3.png"); break; case 2: addBackGround("GdxMenus/endgame/heart2.png"); break; case 1: addBackGround("GdxMenus/endgame/heart1.png"); break; default: break; } // Create all Buttons - Play Button int iX, iY; Button retryButton, menuButton; if (GlobalSettings.ISHD) { iX = 328; iY = 1190; retryButton = createButton("transparent", 475, 147, 103, 996); menuButton = createButton("transparent", 475, 147, 734, 996); } else { iX = 200; iY = 703; retryButton = createButton("transparent", 290, 90, 63, 608); menuButton = createButton("transparent", 290, 90, 448, 608); } retryButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { setScreenWithFading(null); } }); menuButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { setScreenWithFading(new MenuScreen()); } }); // Create all fonts addLabel(Integer.toString(GlobalSettings.PROFILE.getScore()), "osakaMid-font", 1f, new Color(0.2f, 0.188f, 0.094f, 1f), iX, iY + (GlobalSettings.ISHD ? 34 : 44)); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.MenuScreen.java
License:Open Source License
@Override public void show() { super.show(); // Set Background addBackGroundShift("GdxMenus/main/mainmenubg.jpg"); // Add Button image addBackGround("GdxMenus/main/mainmenubuttons.png"); // Create the 2 Bouboules out of the screen final Image imgBoubouleR = addImage("GdxMenus/main/boubouleright.png", GlobalSettings.APPWIDTH, 1f); final Image imgBoubouleL = addImage("GdxMenus/main/boubouleleft.png", -GlobalSettings.APPWIDTH, 1f); // add action on the bouboule final ActionBouboul actionbouL = new ActionBouboul(false); this.stage.addAction(actionbouL); actionbouL.setActor(imgBoubouleL);/*from w ww. j a v a2s. com*/ final ActionBouboul actionbouR = new ActionBouboul(true); this.stage.addAction(actionbouR); actionbouR.setActor(imgBoubouleR); // add the title title = new Label("BOUBOULE", getSkin(), "darktimes-font", new Color(.388f, .733f, .984f, 1f)); title.setAlignment(Align.center); // center title.setWidth(GlobalSettings.APPWIDTH); // title.setColor(.2f, .7098f, .898f, 1f); // android color // add the title in a table in order to rotate it. Table tableTitle = new Table(); tableTitle.add(title); tableTitle.setTransform(true); tableTitle.setWidth(GlobalSettings.APPWIDTH); // all the width tableTitle.setX(0); tableTitle.setY((int) (1050 * GlobalSettings.HD) - GlobalSettings.SHIFT_BG_HEIGHT / 2); tableTitle.setOrigin(GlobalSettings.APPWIDTH / 2, tableTitle.getHeight() / 2); // at the center stage.addActor(tableTitle); // add action on the title final ActionTitle actiontitle = new ActionTitle(); this.stage.addAction(actiontitle); actiontitle.setActor(tableTitle); // Add 5 button transparent Button playButton, paramButton, scoreButton, boubouleButton, titleButton; if (GlobalSettings.ISHD) { playButton = createButton("transparent", 690, 250, 312, 1150); paramButton = createButton("transparent", 690, 250, 312, 887); scoreButton = createButton("transparent", 690, 250, 312, 615); boubouleButton = createButton("transparent", 1000, 600, 200, 0); titleButton = createButton("transparent", 1000, 1000, 200, 1450); } else { playButton = createButton("transparent", 430, 160, 200, 725); paramButton = createButton("transparent", 430, 160, 200, 555); scoreButton = createButton("transparent", 430, 160, 200, 385); boubouleButton = createButton("transparent", 500, 350, 200, 0); titleButton = createButton("transparent", 500, 500, 200, 885); } // Listener for the button playButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { if (GlobalSettings.GAME.isPlayingGame()) setScreenWithFading(null); else setScreenWithFading(new WorldScreen()); } }); paramButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { setScreenWithFading(new ParamScreen()); } }); scoreButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { if (GlobalSettings.GAMECENTER != null) { GlobalSettings.GAMECENTER.showLeaderboard(); } else { Dialog dialog = new Dialog(" HighScore ", getSkin(), "default") { // improved default skin? // protected void result(Object object) {} // Just hide the dialog }.text("\n" + getHighScoreText() + " ").button(" Close ", null).show(stage); dialog.setX((GlobalSettings.APPWIDTH - dialog.getWidth()) / 2); } } }); boubouleButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { final ActionBouboul actionbouL = new ActionBouboul(false); actionbouL.init(); stage.addAction(actionbouL); actionbouL.setActor(imgBoubouleL); final ActionBouboul actionbouR = new ActionBouboul(true); actionbouR.init(); stage.addAction(actionbouR); actionbouR.setActor(imgBoubouleR); } }); titleButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { actiontitle.switchName(); } }); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.WinScreen.java
License:Open Source License
@Override public void show() { super.show(); // Set Background addBackGroundShift("GdxMenus/win/winbg.jpg"); addBackGround("GdxMenus/win/winbuttons.png"); // Set Lives//from w w w .j a v a 2s . c om switch (GlobalSettings.PROFILE.getNbLifes()) { case 3: addBackGround("GdxMenus/endgame/heart3.png"); break; case 2: addBackGround("GdxMenus/endgame/heart2.png"); break; case 1: addBackGround("GdxMenus/endgame/heart1.png"); break; default: break; } // Create all Buttons - Play Button int iX, iY; Button nextButton, menuButton; if (GlobalSettings.ISHD) { iX = 328; iY = 1190; nextButton = createButton("transparent", 475, 147, 103, 996); menuButton = createButton("transparent", 475, 147, 734, 996); } else { iX = 200; iY = 703; nextButton = createButton("transparent", 290, 90, 63, 608); menuButton = createButton("transparent", 290, 90, 448, 608); } nextButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { setScreenWithFading(null); } }); menuButton.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { setScreenWithFading(new MenuScreen()); } }); // Set Font addLabel(Integer.toString(GlobalSettings.PROFILE.getScore()), "osakaMid-font", 1f, new Color(0.2f, 0.188f, 0.094f, 1f), iX, iY + (GlobalSettings.ISHD ? 34 : 44)); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.WorldScreen.java
License:Open Source License
private void displayInfoWorlds() { if (bInfoDisplayed || GlobalSettings.PROFILE.getBestLevel() / 4 > 5) return;/*from w w w. jav a 2 s . c o m*/ bInfoDisplayed = true; if (infoLabel == null) { String text = "There are " + GlobalSettings.NBLEVELS / 4 + " worlds\n\n" + "To unlock the next world,\n" + "you have to win 4 fights in a row.\n" + "Click on your player to start fighting!"; infoLabel = addLabel(text, "osakaMid-font", 1f, new Color(.411f, .443f, .188f, 1f), 0, (int) (450 * GlobalSettings.HD)); infoLabel.setAlignment(Align.center); infoLabel.setWidth(GlobalSettings.APPWIDTH); infoLabel.setOrigin(GlobalSettings.APPWIDTH / 2, infoLabel.getHeight() / 2); infoLabel.setTouchable(null); } else stage.addActor(infoLabel); ActionInfo actionInfo = new ActionInfo(); this.stage.addAction(actionInfo); actionInfo.setActor(infoLabel); }
From source file:br.com.raphaelbruno.game.zombieinvaders.vr.screen.SplashScreen.java
License:Apache License
public SplashScreen(GameBase game) { super(game);// www .ja v a 2s . co m this.game = game; logos = new ArrayList<Texture>(); logos.add(new Texture("sprites/logo.png")); setBackgroundColor(new Color(0f, 0f, 0f, 1f)); showTarget = false; showNewLogo(); }
From source file:CB_UI.GL_UI.Activitys.ImportAnimation.java
License:Open Source License
public void render(Batch batch) { if (drawableBackground != null) { back = drawableBackground;//www .j a v a 2 s . c om drawableBackground = null; } if (back != null) { Color c = batch.getColor(); float a = c.a; float r = c.r; float g = c.g; float b = c.b; Color trans = new Color(0, 0.3f, 0, 0.40f); batch.setColor(trans); back.draw(batch, 0, 0, this.getWidth(), this.getHeight()); batch.setColor(new Color(r, g, b, a)); } }