-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyGdxGame
More file actions
162 lines (162 loc) · 5.57 KB
/
MyGdxGame
File metadata and controls
162 lines (162 loc) · 5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//package com.mygdx.game;
//
//
// import com.badlogic.gdx.ApplicationAdapter;
// import com.badlogic.gdx.Gdx;
// import com.badlogic.gdx.graphics.GL20;
// import com.badlogic.gdx.graphics.Texture;
// import com.badlogic.gdx.math.Interpolation;
// import com.badlogic.gdx.scenes.scene2d.InputEvent;
// import com.badlogic.gdx.scenes.scene2d.InputListener;
// import com.badlogic.gdx.scenes.scene2d.Group;
// import com.badlogic.gdx.scenes.scene2d.Stage;
// import com.badlogic.gdx.physics.box2d.Body;
// import com.badlogic.gdx.scenes.scene2d.actions.Actions;
// import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction;
// import com.badlogic.gdx.scenes.scene2d.actions.ParallelAction;
// import com.badlogic.gdx.scenes.scene2d.actions.RepeatAction;
// import com.badlogic.gdx.scenes.scene2d.actions.RunnableAction;
// import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction;
// import com.badlogic.gdx.scenes.scene2d.ui.Image;
// import com.badlogic.gdx.scenes.scene2d.ui.Label;
// import com.badlogic.gdx.scenes.scene2d.ui.Skin;
// import com.badlogic.gdx.scenes.scene2d.ui.Button;
// import com.badlogic.gdx.utils.Align;
// import com.badlogic.gdx.utils.viewport.ScreenViewport;
//
// public class MyGdxGame extends ApplicationAdapter {
// private Stage stage;
// private static int lapsCount;
// private Label lapsLabel;
// private Group lapsLabelContainer;
// private int GWidth;
// private int GHeight;
//
// public void initiateScene() {
// lapsCount = 3;
// Skin skin = new Skin(Gdx.files.internal("skin/glassy-ui.json"));
// Texture texture = new Texture(Gdx.files.internal("image.jpg"));
// int TWidth = texture.getWidth();
// int THeight = texture.getHeight();
// int X_left= GWidth/3-TWidth/2;
// int X_right = GWidth*2/3-TWidth/2;
// int Y_top = GHeight*2/3-THeight/2;
// int Y_bottom = GHeight/3-THeight/2;
//
// Image image1 = new Image(texture);
// image1.setPosition(X_left,Y_top);
// image1.setOrigin(image1.getWidth()/2,image1.getHeight()/2);
// stage.addActor(image1);
//
// ParallelAction topLeftRightParallelAction = new ParallelAction(
// Actions.moveTo(X_right,Y_top,1,Interpolation.exp5Out),
// Actions.scaleTo(2,2,1,Interpolation.exp5Out)
// );
// MoveToAction moveBottomRightAction = new MoveToAction();
// moveBottomRightAction.setPosition(X_right,Y_bottom);
// moveBottomRightAction.setDuration(1);
// moveBottomRightAction.setInterpolation(Interpolation.smooth);
//
// RunnableAction updateLapCountAction = new RunnableAction();
// updateLapCountAction.setRunnable(new Runnable() {
// @Override
// public void run() {
// updateLapsCount();
// }
// });
//
// ParallelAction bottomLeftRightParallelAction = new ParallelAction(
// Actions.moveTo(X_left,Y_bottom,1,Interpolation.sineOut),
// Actions.scaleTo(1,1,1)
// );
//
// ParallelAction leftBottomTopParallelAction = new ParallelAction(
// Actions.moveTo(X_left,Y_top,1,Interpolation.swingOut),
// Actions.rotateBy(90,1)
// );
//
// SequenceAction overallSequence = new SequenceAction(
// updateLapCountAction,
// topLeftRightParallelAction,
// moveBottomRightAction,
// bottomLeftRightParallelAction,
// leftBottomTopParallelAction
// );
//
// RepeatAction loopNbrAction = new RepeatAction();
// loopNbrAction.setCount(lapsCount);
// loopNbrAction.setAction(overallSequence);
// lapsLabel = new Label(" Loop :", skin);
// lapsLabel.setPosition(0,0);
// lapsLabel.setSize(GWidth,GHeight);
// lapsLabel.setAlignment(Align.center);
// lapsLabelContainer = new Group();
// lapsLabelContainer.addActor(lapsLabel);
// lapsLabelContainer.setOrigin(lapsLabel.getWidth()/2,lapsLabel.getHeight()/2);
// stage.addActor(lapsLabelContainer);
//
// RunnableAction completedAction = new RunnableAction();
// completedAction.setRunnable(new Runnable() {
// @Override
// public void run() {
// finished();
// }
// });
// image1.addAction(Actions.sequence(loopNbrAction,completedAction));
// }
//
// @Override
// public void create () {
// stage = new Stage(new ScreenViewport());
// Gdx.input.setInputProcessor(stage);
// GWidth = Gdx.graphics.getWidth();
// GHeight = Gdx.graphics.getHeight();
// int Center_X = GWidth/2;
// int Center_Y = GHeight/2;
// final StartButton startButton = new StartButton(Center_X, Center_Y);
// startButton.addListener(new InputListener(){
// @Override
// public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
// System.out.println("clicked");
// initiateScene();
// startButton.remove();
// return true;
// }
// });
// stage.addActor(startButton);
// }
//
// private void updateLapsCount(){
// lapsCount--;
// lapsLabelContainer.setScale(0);
// lapsLabel.setText(" Laps : " + (lapsCount+1));
// ParallelAction parallelAction = new ParallelAction(
// Actions.scaleBy(5,5,4),
// new SequenceAction(
// Actions.fadeIn(1),
// Actions.fadeOut(2)
// )
// );
// lapsLabelContainer.addAction(parallelAction);
// }
//
// private void finished(){
// lapsLabelContainer.setScale(0);
// SequenceAction FadingSequenceAction = new SequenceAction(Actions.fadeIn(1));
// lapsLabel.setText(" Finished!");
// ParallelAction parallelAction = new ParallelAction(
// Actions.rotateBy(360,2),
// Actions.scaleBy((float)1.2,(float)1.2,3,Interpolation.bounce),
// FadingSequenceAction
// );
// lapsLabelContainer.addAction(parallelAction);
// }
//
// @Override
// public void render () {
// Gdx.gl.glClearColor(1, 1, 1, 1);
// Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// stage.act();
// stage.draw();
// }
// }