From 25fe22da7766e6c5463420a03f9f4a1cdcf9a33c Mon Sep 17 00:00:00 2001 From: Armin Benz Date: Fri, 14 Apr 2017 21:09:16 +0200 Subject: [PATCH] =?UTF-8?q?ImageButton=20f=C3=BCr=20das=20Men=C3=BC=20hinz?= =?UTF-8?q?ugef=C3=BCgt(testing)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/assets/menu/Settings.png | Bin 0 -> 1938 bytes .../colorrunner/screens/menu/MainMenu.java | 38 +++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 android/assets/menu/Settings.png diff --git a/android/assets/menu/Settings.png b/android/assets/menu/Settings.png new file mode 100644 index 0000000000000000000000000000000000000000..5ff5af208fdf2eadfd3b467082ac6c3c0ca6e79a GIT binary patch literal 1938 zcmV;D2W|L?P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^5z3JSmg00#m|L_t(&L*1Hdh*eb-$NeB7P+1`@0a6g{kD6b+4s!8_nvd-&Im2|bNAhQ?X~{v?zJChpF3(O(&hEf5Nr~h6?j>K zzSx+d&5n$S!_k7pg5L!;p%x8q$H&Fqq&XA4sq1d`?p%GH0%huG3+h|ICbmawcf%v% zV6LD_U>vs#I<4;tYqqZS9yob>%K~qzXJdNl`17xf-|;b5yUm@5(Q$&$ zv=h)_l?UP7pVub^U@)(7QY%5a`dF}S<8z#*F*FfF1?`u5>$Tw?{h1QAjpte)+B(A- z2%s$%|HuCIQ$hLCz6&&+>_iL{b@umlW3b}Lp}v|kb+we!;fvC*&NC-mK>*s&arL!< zFMLwg9EvopXd)e#36!A^_I&6~UVFWF*Ta*&%F{K$37Q1vK&C+6+PI<1)z<(Y_`)Z? zbv;~`X?o#AIuz-S-m14(d9w~rXoJLkCAakAU{A^3UfNtBkSQDTx`P22(3WDtD_|QR z_(C7waM0~=3O6#MI8%4dsH4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E z!45%_z$O$0^u@+(ZT9Ml5GfGwF0%NSqldlf+SBa7K4Hq#9XWoC6{}e54(-n}zKk06 Y9}A`uIO^^-8UO$Q07*qoM6N<$f&%KFsQ>@~ literal 0 HcmV?d00001 diff --git a/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java b/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java index 2430b70..dc26e32 100644 --- a/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java +++ b/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java @@ -6,16 +6,18 @@ import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.Gdx2DPixmap; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; +import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import de.samdev.colorrunner.CRGame; import de.samdev.colorrunner.game.world.map.CRMapStorage; @@ -28,6 +30,7 @@ public class MainMenu implements Screen { private Stage stage = new Stage(); private Table table = new Table(); + private OrthographicCamera cam = new OrthographicCamera(); private Texture background = new Texture("images/background2.jpg"); @@ -37,8 +40,35 @@ public class MainMenu implements Screen { private TextButton buttonPlay1 = new TextButton("Play Level 1", skin); private TextButton buttonPlay2 = new TextButton("Play Endless", skin); - private TextButton buttonExit = new TextButton("Exit", skin); private TextButton buttonOption = new TextButton("Option", skin); + private TextButton buttonExit = new TextButton("Exit", skin); + + private Texture myTexture = new Texture(Gdx.files.internal("menu/Settings.png")); + private TextureRegion myTextureRegion= new TextureRegion(myTexture); + private TextureRegionDrawable myTexRegionDrawable = new TextureRegionDrawable(myTextureRegion); + private ImageButton optionButton = new ImageButton(myTexRegionDrawable); + + // folgendes mal als Beispiel :) + /* + button3.setSize(col_width*4,(float)(row_height*2)); +button3.getStyle().imageUp = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("switch_off.png")))); +button3.getStyle().imageDown = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("switch_on.png")))); +button3.setPosition(col_width,Gdx.graphics.getHeight()-row_height*6); +button3.addListener(new InputListener(){ + @Override + public void touchUp (InputEvent event, float x, float y, int pointer, int button) { + outputLabel.setText("Press a Button"); + } + @Override + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + outputLabel.setText("Pressed Image Button"); + return true; + } +}); + + + + */ private Label title = new Label("Color Runner", skin); @@ -48,6 +78,8 @@ public class MainMenu implements Screen { music = CRGame.manager.get("sound/menusound.mp3", Music.class); music.setLooping(true); music.play(); + + } @Override @@ -63,6 +95,7 @@ public class MainMenu implements Screen { sb.draw(background, 0, 0); sb.end(); + stage.act(); stage.draw(); @@ -115,6 +148,7 @@ public class MainMenu implements Screen { table.setFillParent(true); stage.addActor(table); + stage.addActor(optionButton); Gdx.input.setInputProcessor(stage); }