List of usage examples for com.badlogic.gdx.graphics Color WHITE
Color WHITE
To view the source code for com.badlogic.gdx.graphics Color WHITE.
Click Source Link
From source file:com.flaiker.reaktio.screens.ModeSelectionScreen.java
License:Open Source License
@Override public void show() { super.show(); if (demoGame == null) demoGame = new Game(GameSettings.newDemoGameSettings(), SCREEN_WIDTH, SCREEN_HEIGHT, camera); Table table = new Table(skin); table.setFillParent(true);//from ww w . j a v a2 s . c o m uiStage.addActor(table); table.add().padBottom(50).row(); Label titleLabel = new Label("Reaktio", skin, "digital7-92", Color.WHITE); //titleLabel.setFontScale(2); table.add(titleLabel).spaceBottom(5).align(1); table.row(); table.add("Select a Gamemode").align(1).spaceBottom(20); table.row(); // register the button "Timelimit" TextButton timelimitButton = new TextButton("Timelimit", skin); timelimitButton.setColor(1, 1, 1, 0.9f); timelimitButton.addListener(new DefaultActorListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); reaktio.setScreen(new GameScreen(reaktio, GameSettings.newTimeLimitGameSettings(30, 2, 2), skin)); } }); table.add(timelimitButton).expand().fill().pad(0, 100, 100, 100); table.row(); // register the button "Continuous" TextButton continuousButton = new TextButton("Continuous", skin); continuousButton.setColor(1, 1, 1, 0.9f); continuousButton.addListener(new DefaultActorListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); reaktio.setScreen(new GameScreen(reaktio, GameSettings.newContinuousGameSettings(2, 2), skin)); } }); table.add(continuousButton).expand().fill().pad(100, 100, 100, 100); table.row(); table.add(new Label("www.flaiker.com", skin)); Gdx.input.setInputProcessor(uiStage); }
From source file:com.flaiker.reaktio.screens.OptionsScreen.java
License:Open Source License
@Override public void show() { super.show(); if (demoGame == null) demoGame = new Game(GameSettings.newDemoGameSettings(), SCREEN_WIDTH, SCREEN_HEIGHT, camera); Table table = new Table(skin); table.setFillParent(true);/* w w w.ja va 2 s . c o m*/ uiStage.addActor(table); table.add().padBottom(50).row(); Label titleLabel = new Label("Reaktio", skin, "digital7-92", Color.WHITE); //titleLabel.setFontScale(2); table.add(titleLabel).spaceBottom(5).align(1); table.row(); table.add("Options").align(1).spaceBottom(20); table.row(); table.add().expandY().fill().row(); // FPS-Counter-Checkbox final CheckBox fpsCounterCheckbox = new CheckBox("FPS-Counter", skin); fpsCounterCheckbox.setChecked(reaktio.getPreferencesManager().isFpsCounterEnabled()); fpsCounterCheckbox.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { boolean enabled = fpsCounterCheckbox.isChecked(); reaktio.getPreferencesManager().setFPSCounterEnabled(enabled); } }); table.add(fpsCounterCheckbox).fillX().padBottom(30); table.row(); table.add().expandY().fill().row(); // Button "Back" TextButton backButton = new TextButton("BACK", skin); backButton.setColor(1, 1, 1, 0.9f); backButton.addListener(new DefaultActorListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); reaktio.setScreen(new MenuScreen(reaktio, demoGame, skin)); } }); table.add(backButton).padBottom(30).fillX(); table.row(); table.add(new Label("www.flaiker.com", skin)); Gdx.input.setInputProcessor(uiStage); }
From source file:com.flaiker.reaktio.screens.ScoreScreen.java
License:Open Source License
@Override public void show() { super.show(); Gdx.app.log(LOG, game.getScore().toString()); Table table = new Table(skin); table.setFillParent(true);/*from w ww. j a v a 2 s . c om*/ uiStage.addActor(table); table.add().padBottom(50).row(); Label titleLabel = new Label("SCORE", skin, "digital7-92", Color.WHITE); table.add(titleLabel).spaceBottom(5).align(1); table.row(); String score = game.getScore().getComparedScore(reaktio.getPreferencesManager().getScoreArray()); Container<Label> scoreListContainer = new Container<Label>(new Label(score, skin)); scoreListContainer.setBackground(skin.getDrawable("default-round")); scoreListContainer.setColor(1, 1, 1, 0.9f); table.add(scoreListContainer).expand().fill().pad(100, 100, 0, 100).row(); // register the button "Try again" TextButton tryAgainButton = new TextButton("TRY AGAIN", skin); tryAgainButton.setColor(1, 1, 1, 0.9f); tryAgainButton.addListener(new DefaultActorListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); reaktio.setScreen(new GameScreen(reaktio, game.getGameSettings(), skin)); } }); table.add(tryAgainButton).expand().fill().pad(100, 100, 0, 100).row(); // register the button "Back" TextButton backButton = new TextButton("BACK TO MAINMENU", skin); backButton.setColor(1, 1, 1, 0.9f); backButton.addListener(new DefaultActorListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); reaktio.setScreen(new MenuScreen(reaktio, null, skin)); } }); table.add(backButton).expand().fill().pad(100, 100, 50, 100).row(); Gdx.input.setInputProcessor(uiStage); }
From source file:com.game.libgdx.roguelikeengine.Credits.java
License:Open Source License
@Override public void render(float delta) { // set viewport Gdx.gl.glViewport((int) viewport.x, (int) viewport.y, (int) viewport.width, (int) viewport.height); Gdx.gl.glClearColor(0, 0, 0, 1);/*from www.j ava 2 s . co m*/ Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); fadein = fadein + 0.003f; if (fadein > 1.0f) { fadein = 1.0f; } //spriteBatch.setColor(1.0f, 1.0f, 1.0f, fadein); screentext.drawScreen(spriteBatch, messagefont, text, fadein, 30, Color.WHITE); spriteBatch.end(); if (Gdx.input.justTouched() && !screentext.mouseOverElement()) { theGame.setScreen(new SplashScreen(theGame)); } }
From source file:com.game.libgdx.roguelikeengine.GameplayScreen.java
License:Open Source License
/** * /* w w w .ja v a 2 s. c om*/ */ protected void init() { Gdx.input.setInputProcessor(this); batch = new SpriteBatch(); float buttonWidth = Gdx.graphics.getWidth() * 0.1f; float buttonHeight = Gdx.graphics.getHeight() * 0.1f; if (WrapperEngine.OUTPUT_OS.equals("android")) { buttons.add(new TextButton("Go Up", .75f, .2f, buttonWidth, buttonHeight)); buttons.add(new TextButton("Go Down", .75f, .1f, buttonWidth, buttonHeight)); buttons.add(new TextButton("Go Left", .65f, .15f, buttonWidth, buttonHeight)); buttons.add(new TextButton("Go Right", .85f, .15f, buttonWidth, buttonHeight)); getButton("Go Up").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { goup(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Go Left").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { goleft(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Go Right").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { goright(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Go Down").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { godown(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); float leftButtonStartY = 0.1f; buttons.add(new TextButton("Magic", .05f, leftButtonStartY, buttonWidth, buttonHeight)); buttons.add(new TextButton("Talk", .05f, leftButtonStartY + (.1f * 1), buttonWidth, buttonHeight)); buttons.add(new TextButton("Look", .05f, leftButtonStartY + (.1f * 2), buttonWidth, buttonHeight)); buttons.add(new TextButton("Drop", .05f, leftButtonStartY + (.1f * 3), buttonWidth, buttonHeight)); buttons.add(new TextButton("Take", .05f, leftButtonStartY + (.1f * 4), buttonWidth, buttonHeight)); buttons.add(new TextButton("Fight", .05f, leftButtonStartY + (.1f * 5), buttonWidth, buttonHeight)); getButton("Fight").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { fight(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Take").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { take(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Drop").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { drop(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Look").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { look(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Talk").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { talk(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); getButton("Magic").addActionListener(new ButtonAction() { @Override public void onClicked(IButton button) { magic(); } @Override public void onMouseEnter(IButton button) { } @Override public void onMouseExit(IButton button) { } }); } else { float percentOfScreen = 0.65f; float actionBarWidth = (Gdx.graphics.getWidth() * percentOfScreen); buttonWidth = (Gdx.graphics.getWidth() * percentOfScreen) / 11; buttons.add(new HBox(0f, .99f, actionBarWidth) .addElement(new ActionButton(ActionButton.FIGHT, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.TAKE, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.DROP, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.LOOK, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.TALK, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.MAGIC, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.QUIT, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.LEFT, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.DOWN, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.UP, buttonWidth, buttonHeight)) .addElement(new ActionButton(ActionButton.RIGHT, buttonWidth, buttonHeight)).finalizeHBox()); } // fonts setup FileHandle fontFile = Gdx.files.internal("fonts/diabloheavy.ttf"); FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile); // set sound effects setupsoundeffects(); //genericfont = new BitmapFont(); //messagefont = new BitmapFont(); messagefont = generator.generateFont(30); // px messagefont.setColor(Color.YELLOW); genericfont = generator.generateFont(14); // px genericfont.setColor(Color.WHITE); // create a message info screen screentext = new PopupInfoText(100, (WrapperEngine.TILE_Y_SIZE * WrapperEngine.ON_SCREEN_TILES_Y) - 450, "UI/text_popup.png", (int) (Gdx.graphics.getWidth() * 0.75f), (int) (Gdx.graphics.getHeight() * 0.4f)); screentext.settextoffset(50, 50); // create tile layout game = new WrapperEngine(); game.init(); maplayers[0] = game.getmaplayer(0); maplayers[1] = game.getmaplayer(1); maplayers[2] = game.getmaplayer(2); layout = new Layout(); prota = game.gethero(); badguys = game.getenemies(); goodguys = game.getbuddies(); availableobjects = game.getobjects(); availableconsumables = game.getconsumables(); // empty enemy object that hold enemy. Same as object and consumable. actualbuddy = new Buddy(); actualenemy = new Enemy(); actualobject = new Object(); actualconsumable = new Consumable(); objinv = new Object_inventory(); consinv = new Consumable_inventory(); // create welcoming buddy final Buddy priest = game.createbuddy(0, "Priest", 19, 24, "buddy1.png", "Hi, my friend.\nI hope you enjoy your trip!\nBe aware of the monsters.\nDo you require healing?\n\t Accept_Healing \t No"); screentext.addWordClickListener("Accept_Healing", new WordClickAction() { @Override public void onClicked(String word) { priest.healHero(prota, 10); } }); screentext.addWordClickListener("No", new WordClickAction() { @Override public void onClicked(String word) { closeScreenText(); } }); screentext.addWordClickListener("treasure_chest!", new WordClickAction() { @Override public void onClicked(String word) { alert("Would you like to open it? \n \t Open_Chest \n \t Not_Right_Now"); } }); screentext.addWordClickListener("Open_Chest", new WordClickAction() { @Override public void onClicked(String word) { if (!Chest.interacting.open(game.getactivemap(), game.gethero())) { if (!game.gethero().hasKey()) alert("You need a key to open that!"); } ; } }); screentext.addWordClickListener("locked_door!", new WordClickAction() { @Override public void onClicked(String word) { alert("Would you like to open it? \n \t Open_Door \n \t Not_Right_Now"); } }); screentext.addWordClickListener("Open_Door", new WordClickAction() { @Override public void onClicked(String word) { if (!Chest.interacting.open(game.getactivemap(), game.gethero())) { if (!game.gethero().hasKey()) alert("You need a key to open that!"); } ; } }); screentext.addWordClickListener("Not_Right_Now", new WordClickAction() { @Override public void onClicked(String word) { closeScreenText(); } }); }
From source file:com.gamejolt.mikykr5.ceidecpong.ecs.systems.ScoringSystem.java
License:Open Source License
@Override public void processEntity(Entity entity, float deltaTime) { TextBounds bounds;/* w w w. j a va 2s .c om*/ float x, y; InterSystemMessage message; ScoreComponent score = Mappers.scoreMapper.get(entity); PlayerComponent player = Mappers.playerMapper.get(entity); while ((message = InterSystemMessagingQueue.popMessage(ScoringSystem.class.getCanonicalName())) != null) { int playerId; if (message.data.containsKey("SCORE")) { playerId = (Integer) message.data.get("SCORE"); if (playerId == player.id) { score.score++; } else { ignoredMessages.add(message); } } } for (InterSystemMessage msg : ignoredMessages) InterSystemMessagingQueue.pushMessage(msg); ignoredMessages.clear(); bounds = font.getBounds(String.format("%02d", score.score)); y = (ProjectConstants.FB_HEIGHT / 2.0f) - (bounds.height / 2.0f) - 20; if (player.id == 0) { x = -(ProjectConstants.FB_WIDTH / 4.0f) - (bounds.width / 2.0f); } else if (player.id == 1) { x = (ProjectConstants.FB_WIDTH / 4.0f) - (bounds.width / 2.0f); ; } else return; font.setColor(Color.WHITE); font.draw(batch, String.format("%02d", score.score), x, y); }
From source file:com.gamejolt.mikykr5.ceidecpong.states.MainMenuState.java
License:Open Source License
@Override public void onAssetsLoaded() { TextButtonStyle textButtonStyle;/*from w ww. j a v a 2 s. c o m*/ // Create the button backgrounds. menuButtonEnabledTexture = loader.getAsset("data/gfx/gui/Anonymous_Pill_Button_Yellow.png", Texture.class); menuButtonDisabledTexture = loader.getAsset("data/gfx/gui/Anonymous_Pill_Button_Cyan.png", Texture.class); menuButtonPressedTexture = loader.getAsset("data/gfx/gui/Anonymous_Pill_Button_Blue.png", Texture.class); menuButtonEnabled9p = new NinePatch(new TextureRegion(menuButtonEnabledTexture, 0, 0, menuButtonEnabledTexture.getWidth(), menuButtonEnabledTexture.getHeight()), 49, 49, 45, 45); menuButtonDisabled9p = new NinePatch(new TextureRegion(menuButtonDisabledTexture, 0, 0, menuButtonDisabledTexture.getWidth(), menuButtonDisabledTexture.getHeight()), 49, 49, 45, 45); menuButtonPressed9p = new NinePatch(new TextureRegion(menuButtonPressedTexture, 0, 0, menuButtonPressedTexture.getWidth(), menuButtonPressedTexture.getHeight()), 49, 49, 45, 45); // Create the buttons. textButtonStyle = new TextButtonStyle(); textButtonStyle.font = buttonFont; textButtonStyle.up = new NinePatchDrawable(menuButtonEnabled9p); textButtonStyle.checked = new NinePatchDrawable(menuButtonPressed9p); textButtonStyle.disabled = new NinePatchDrawable(menuButtonDisabled9p); textButtonStyle.fontColor = new Color(Color.BLACK); textButtonStyle.downFontColor = new Color(Color.WHITE); textButtonStyle.disabledFontColor = new Color(Color.BLACK); startButton = new TextButton("Start game", textButtonStyle); startButton.setText("Start game"); startButtonBBox = new Rectangle(0, 0, startButton.getWidth(), startButton.getHeight()); quitButton = new TextButton("Quit", textButtonStyle); quitButton.setText("quit"); quitButtonBBox = new Rectangle(0, 0, quitButton.getWidth(), quitButton.getHeight()); // Set buttons. startButton.setPosition(-(startButton.getWidth() / 2), -(startButton.getHeight() / 2)); startButtonBBox.setPosition(startButton.getX(), startButton.getY()); quitButton.setPosition(-(quitButton.getWidth() / 2), (startButton.getY() - startButton.getHeight()) - 10); quitButtonBBox.setPosition(quitButton.getX(), quitButton.getY()); assetsLoaded = true; AsyncAssetLoader.freeInstance(); }
From source file:com.gamemaker.gameworld.GameRenderer.java
License:Apache License
public void drawGameOver(float delta) { AssetLoader.backgroundMusic.stop();/* w w w .ja v a 2 s . co m*/ AssetLoader.monsterMusic.stop(); AssetLoader.yell.stop(); AssetLoader.dangerous.stop(); AssetLoader.monsterSound.stop(); AssetLoader.startSound.stop(); AssetLoader.billycanSound.stop(); AssetLoader.waterSound.stop(); AssetLoader.bushonionSound.stop(); AssetLoader.rockSound1.stop(); AssetLoader.rockSound2.stop(); AssetLoader.backgroundMusicLev2.stop(); tempRunTimeGameOver += delta; shapeRenderer.begin(ShapeType.Filled); shapeRenderer.setColor(Color.GRAY); shapeRenderer.rect(0, 0, 1280, 720); shapeRenderer.end(); batcher.begin(); font.getData().setScale(5f, -5f); font.setColor(Color.WHITE); //if (myWorld.getMonster().getMonsterGo() == 1 || myWorld.getKingbrown1().collides(myWorld.getPlayer()) || myWorld.getKingbrown2().collides(myWorld.getPlayer()) || myWorld.getWater() <= 0 || myWorld.collideStone()) { if (deathSoundPlay) { AssetLoader.die.play(); deathSoundPlay = false; } layout.setText(font4, "Ngarlpu wiyarringu"); font4.draw(batcher, layout, 280, 120); if (playerDeath.getKeyFrameIndex(tempRunTimeGameOver) == 2) { flagDeath = false; } if (flagDeath) { batcher.draw(playerDeath.getKeyFrame(tempRunTimeGameOver), 500, 400); } else { batcher.draw(AssetLoader.death3, 500, 550); } Gdx.app.log("drawGameOver", "called"); //} /*else if (myWorld.getMonster().getMonsterGo() == 2) { font.draw(batcher, "You Win", 554, 250); font.draw(batcher, "Touch The Screen", 370, 380); }*/ font.getData().setScale(1f, -1f); drawButton(); batcher.end(); }
From source file:com.garciagars.Game.java
License:Open Source License
@Override public void create() { enemies = new ArrayList(); enemyDispose = new ArrayList(); bullets = new ArrayList(); bulletDispose = new ArrayList(); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); height = Gdx.graphics.getHeight();//from www . j a v a 2 s . c o m width = Gdx.graphics.getWidth(); Gdx.input.setInputProcessor(this); bg = new Texture(Gdx.files.internal("bg.bmp")); ship = new Texture(Gdx.files.internal("ship.png")); danger = new Texture(Gdx.files.internal("danger.png")); FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("arcade.ttf")); FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); parameter.flip = true; parameter.size = 45; parameter.color = Color.WHITE; lblHealth = generator.generateFont(parameter); lblScore = generator.generateFont(parameter); generator.dispose(); // setX to be centered x = width - shipW / 2; }
From source file:com.gcq.fivesecond.layer.AboutLayer.java
License:Apache License
/** * Build view elements./*from w w w.j a v a 2 s . c o m*/ * */ private void buildElements() { // --------------------------------------------------------------- // Background. // --------------------------------------------------------------- Image image = new Image(logo); image.setWidth(getWidth()); image.setHeight(getHeight()); // --------------------------------------------------------------- // Labels // --------------------------------------------------------------- urlLabel = new Label("www.netthreads.co.uk", skin, URL_LABEL_FONT, Color.WHITE); versionLabel = new Label(FiveSecondGame.VERSION_TEXT, skin, URL_LABEL_FONT, Color.WHITE); // --------------------------------------------------------------- // Table // --------------------------------------------------------------- table = new Table(); table.size((int) getWidth(), (int) getHeight()); table.row(); table.add(urlLabel).expandY().expandX(); table.row(); table.add(image); table.row(); table.add(versionLabel).expandY().expandX(); table.pack(); table.setFillParent(true); addActor(table); }