gdx-studio
git clone https://git.pyrossh.dev/gdx-studio
An IDE for creating Games using libgdx and Java supported on all platforms Android, iOS, Desktop
test/source/Menu.java
| a9b2a64 | 1 | package source; |
| a9b2a64 | 2 | |
| a62d533 | 3 | import com.badlogic.gdx.scenes.scene2d.Actor; |
| a9b2a64 | 4 | import scene2d.*; |
| a62d533 | 5 | |
| 7c84877 | 6 | /** A Basic Main Menu for the Game |
| 7c84877 | 7 | * <p> |
| 7c84877 | 8 | * The Main Menu Displays all the scenes to which the game can switch too. Based on which button or |
| a9b2a64 | 9 | * image or widget pressed the scene can be switched. |
| 7c84877 | 10 | * <p> |
| 7c84877 | 11 | * @author pyros2097 */ |
| a62d533 | 12 | public class Menu extends Scene {
|
| a62d533 | 13 | |
| a62d533 | 14 | public Menu(){
|
| a9b2a64 | 15 | log("Hello World");
|
| a9b2a64 | 16 | log("new dat");
|
| a9b2a64 | 17 | showToast("Toasting", 2f);
|
| a62d533 | 18 | } |
| a62d533 | 19 | |
| a62d533 | 20 | @Override |
| a62d533 | 21 | public void onClick(Actor actor){
|
| a62d533 | 22 | if(actor.getName().equals("Play"))
|
| a9b2a64 | 23 | setScene("Game");
|
| a62d533 | 24 | if(actor.getName().equals("Play3d"))
|
| a9b2a64 | 25 | setScene("Game3d");
|
| a62d533 | 26 | if(actor.getName().equals("Options"))
|
| a9b2a64 | 27 | setScene("Options");
|
| a62d533 | 28 | if(actor.getName().equals("Exit"))
|
| a9b2a64 | 29 | showMessageDialog("Exit", " Are you sure you want \n to Quit the Game ");
|
| a62d533 | 30 | } |
| a62d533 | 31 | |
| a62d533 | 32 | @Override |
| a62d533 | 33 | public void onTouchDown(Actor actor){
|
| a62d533 | 34 | } |
| a62d533 | 35 | |
| a62d533 | 36 | @Override |
| a62d533 | 37 | public void onTouchUp(){}
|
| a62d533 | 38 | |
| a62d533 | 39 | @Override |
| a62d533 | 40 | public void onDragged(){}
|
| a62d533 | 41 | |
| a62d533 | 42 | @Override |
| a62d533 | 43 | public void onGesture(GestureType type){
|
| a62d533 | 44 | if(type == GestureType.Up) |
| a9b2a64 | 45 | log("Up");
|
| a62d533 | 46 | else if(type == GestureType.Down) |
| a9b2a64 | 47 | log("Down");
|
| a62d533 | 48 | } |
| a62d533 | 49 | |
| 7c84877 | 50 | @Override |
| 7c84877 | 51 | public void onKeyTyped(char key){
|
| a9b2a64 | 52 | } |
| 7c84877 | 53 | |
| 7c84877 | 54 | @Override |
| 7c84877 | 55 | public void onKeyUp(int keycode){
|
| a9b2a64 | 56 | } |
| 7c84877 | 57 | |
| 7c84877 | 58 | @Override |
| 7c84877 | 59 | public void onKeyDown(int keycode){
|
| a9b2a64 | 60 | } |
| 7c84877 | 61 | |
| a62d533 | 62 | @Override |
| a62d533 | 63 | public void onPause(){
|
| a62d533 | 64 | } |
| a62d533 | 65 | |
| a62d533 | 66 | @Override |
| a62d533 | 67 | public void onResume(){
|
| a62d533 | 68 | } |
| a62d533 | 69 | |
| a62d533 | 70 | @Override |
| a62d533 | 71 | public void onDispose(){
|
| a62d533 | 72 | } |
| a62d533 | 73 | } |