~repos /gdx-studio

#libgdx#java#desktop

git clone https://pyrossh.dev/repos/gdx-studio.git

An IDE for creating Games using libgdx and Java supported on all platforms Android, iOS, Desktop


7c848771 pyros2097

11 years ago
some changes
Files changed (96) hide show
  1. IDE/Content.java +2 -15
  2. IDE/Editor.java +2 -1
  3. IDE/Frame.java +10 -22
  4. IDE/SearchBar.java +13 -19
  5. IDE/StatusBar.java +14 -41
  6. IDE/Style.java +249 -394
  7. IDE/ToolBar.java +52 -25
  8. Panel/ActorPanel.java +42 -7
  9. Panel/BaseList.java +8 -2
  10. Panel/BaseTable.java +19 -6
  11. Panel/ConsolePanel.java +2 -1
  12. Panel/DashPanel.java +2 -1
  13. Panel/EffectPanel.java +3 -0
  14. Panel/OptionsPanel.java +51 -17
  15. Panel/ProjectPanel.java +20 -4
  16. Panel/PropertyPanel.java +53 -28
  17. Panel/ReplacePanel.java +3 -1
  18. Panel/SceneEffectPanel.java +25 -20
  19. Panel/ScenePanel.java +297 -63
  20. Panel/SceneTemplate.txt +10 -2
  21. Panel/StudioPanel.java +18 -281
  22. Panel/TablePanel.java +1 -1
  23. Panel/WidgetPanel.java +1 -1
  24. Panel/project.properties +0 -11
  25. Stage/Asset.java +24 -4
  26. Stage/Config.java +2 -3
  27. Stage/Map.java +34 -3
  28. Stage/Scene.java +27 -20
  29. Stage/Serializer.java +210 -107
  30. Stage/Sprite.java +2 -1
  31. Stage/Stage.java +69 -85
  32. test/asset +1 -1
  33. test/atlas/charset.atlas +124 -124
  34. test/atlas/charset.png +0 -0
  35. test/atlas/pack.atlas +325 -0
  36. test/atlas/pack.png +0 -0
  37. test/atlas/pack2.png +0 -0
  38. test/config +3 -3
  39. test/model/skydome.g3db +0 -0
  40. test/model/skydome.png +0 -0
  41. test/pack/charset/661.png +0 -0
  42. test/pack/charset/662.png +0 -0
  43. test/pack/charset/663.png +0 -0
  44. test/pack/charset/771.png +0 -0
  45. test/pack/charset/772.png +0 -0
  46. test/pack/charset/775.png +0 -0
  47. test/pack/charset/Thumbs.db +0 -0
  48. test/pack/charset/alfador00.png +0 -0
  49. test/pack/charset/alfador01.png +0 -0
  50. test/pack/charset/baldarov00.png +0 -0
  51. test/pack/charset/baldarov01.png +0 -0
  52. test/pack/charset/calais00.png +0 -0
  53. test/pack/charset/calais01.png +0 -0
  54. test/pack/charset/citizen.png +0 -0
  55. test/pack/charset/earcher.png +0 -0
  56. test/pack/charset/elemental.png +0 -0
  57. test/pack/charset/esoldier.png +0 -0
  58. test/pack/charset/garett00.png +0 -0
  59. test/pack/charset/garett01.png +0 -0
  60. test/pack/charset/lizardman.png +0 -0
  61. test/pack/charset/lord00.png +0 -0
  62. test/pack/charset/lord01.png +0 -0
  63. test/pack/charset/merman.png +0 -0
  64. test/pack/charset/mina.png +0 -0
  65. test/pack/charset/pguardian.png +0 -0
  66. test/pack/charset/poralfador.png +0 -0
  67. test/pack/charset/porbaldarov.png +0 -0
  68. test/pack/charset/porcalais.png +0 -0
  69. test/pack/charset/porgarett.png +0 -0
  70. test/pack/charset/porlord.png +0 -0
  71. test/pack/charset/porsabra.png +0 -0
  72. test/pack/charset/porserpentknight.png +0 -0
  73. test/pack/charset/portiberon.png +0 -0
  74. test/pack/charset/porwizard.png +0 -0
  75. test/pack/charset/psoldier.png +0 -0
  76. test/pack/charset/sabra00.png +0 -0
  77. test/pack/charset/sabra01.png +0 -0
  78. test/pack/charset/serpentknight00.png +0 -0
  79. test/pack/charset/serpentknight01.png +0 -0
  80. test/pack/charset/shaka.png +0 -0
  81. test/pack/charset/tiberon00.png +0 -0
  82. test/pack/charset/tiberon01.png +0 -0
  83. test/pack/charset/tribeman.png +0 -0
  84. test/pack/charset/wizard00.png +0 -0
  85. test/pack/charset/wizard01.png +0 -0
  86. test/pack/concrete.png +0 -0
  87. test/scene +56 -58
  88. test/source/BasicDemo.java +18 -6
  89. test/source/Game.java +12 -0
  90. test/source/Game3d.java +38 -2
  91. test/source/GameOver.java +17 -5
  92. test/source/GameWin.java +17 -5
  93. test/source/Menu.java +18 -6
  94. test/source/Options.java +19 -7
  95. test/source/Splash.java +15 -3
  96. test/source/TicTacToe.java +14 -1
IDE/Content.java CHANGED
@@ -1,9 +1,9 @@
1
1
  import java.awt.BorderLayout;
2
2
  import java.awt.CardLayout;
3
- import java.awt.Graphics;
4
3
  import java.awt.Insets;
5
4
  import java.io.File;
6
5
 
6
+ import javax.swing.BorderFactory;
7
7
  import javax.swing.JButton;
8
8
  import javax.swing.JPanel;
9
9
  import javax.swing.SwingUtilities;
@@ -29,7 +29,6 @@ final public class Content extends JPanel {
29
29
  public static RTextScrollPane editorScroll;
30
30
  public static StudioPanel studioPanel;
31
31
  private static ReplacePanel replacePanel;
32
- private static OptionsPanel optionsPanel;
33
32
  public static AssetPanel assetPanel;
34
33
  private static ConsolePanel consolePanel;
35
34
 
@@ -66,9 +65,6 @@ final public class Content extends JPanel {
66
65
  JPanel north = new JPanel(new VerticalFlowLayout());
67
66
  replacePanel = new ReplacePanel();
68
67
  north.add(replacePanel);
69
- //north.add(title);
70
- optionsPanel = new OptionsPanel();
71
- north.add(optionsPanel);
72
68
  add(north, BorderLayout.NORTH);
73
69
  add(card, BorderLayout.CENTER);
74
70
 
@@ -79,12 +75,7 @@ final public class Content extends JPanel {
79
75
  vert.add(assetPanel);
80
76
  vert.add(consolePanel);
81
77
  add(vert, BorderLayout.SOUTH);
82
- }
83
-
84
- @Override
85
- public void paintComponent(Graphics g){
86
- Style.drawRightBorder(g, getWidth(), getHeight());
87
- Style.drawLeftBorder(g, getWidth(), getHeight());
78
+ setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, Style.border));
88
79
  }
89
80
 
90
81
  private static boolean canvasChanged = true;
@@ -131,10 +122,6 @@ final public class Content extends JPanel {
131
122
  }
132
123
  }
133
124
 
134
- public static void toggleOptions(){
135
- optionsPanel.setVisible(!optionsPanel.isVisible());
136
- }
137
-
138
125
  public static void toggleReplace(){
139
126
  replacePanel.setVisible(!replacePanel.isVisible());
140
127
  }
IDE/Editor.java CHANGED
@@ -28,7 +28,7 @@ final public class Editor extends TextEditorPane {
28
28
  static DefaultCompletionProvider provider = new DefaultCompletionProvider();
29
29
  public static SearchContext context = new SearchContext();
30
30
 
31
- final Timer saveTimer = new Timer(30000, new ActionListener(){
31
+ final private Timer saveTimer = new Timer(60000, new ActionListener(){
32
32
  @Override
33
33
  public void actionPerformed(ActionEvent arg0) {
34
34
  save();
@@ -38,6 +38,7 @@ final public class Editor extends TextEditorPane {
38
38
 
39
39
  public Editor(){
40
40
  super(TextEditorPane.INSERT_MODE, true);
41
+ saveTimer.start();
41
42
  setMargin(new Insets(0, 0, 0, 0));
42
43
  setMarginLineEnabled(true);
43
44
  setMarginLineColor(new Color(248,248,248)); //FIXME color not changing
IDE/Frame.java CHANGED
@@ -1,6 +1,5 @@
1
1
  import java.awt.BorderLayout;
2
2
  import java.awt.Component;
3
- import java.awt.Graphics;
4
3
  import java.awt.event.WindowEvent;
5
4
  import java.awt.event.WindowListener;
6
5
 
@@ -11,6 +10,7 @@ import javax.swing.JList;
11
10
  import javax.swing.JPanel;
12
11
 
13
12
  import web.laf.lite.layout.VerticalFlowLayout;
13
+ import web.laf.lite.utils.UIUtils;
14
14
 
15
15
  final public class Frame extends JFrame implements WindowListener{
16
16
  private static final long serialVersionUID = 1L;
@@ -39,6 +39,7 @@ final public class Frame extends JFrame implements WindowListener{
39
39
  private Frame() {
40
40
  setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
41
41
  addWindowListener(this);
42
+ //styleProject();
42
43
  }
43
44
 
44
45
  public static Frame getInstance(){
@@ -50,18 +51,11 @@ final public class Frame extends JFrame implements WindowListener{
50
51
  public void initToolBar(){
51
52
  toolBar = new ToolBar();
52
53
  add(toolBar, BorderLayout.NORTH);
53
- styleProject();
54
54
  }
55
55
 
56
56
  public void initSideBar(){
57
- rightSideBar = new JPanel(new VerticalFlowLayout(0, 10)){
57
+ rightSideBar = new JPanel(new VerticalFlowLayout(0, 10));
58
- private static final long serialVersionUID = 1L;
59
- @Override
60
- public void paintComponent(Graphics g){
61
- Style.drawVerticalBar(g, getWidth(), getHeight());
58
+ UIUtils.setUndecorated(rightSideBar, true);
62
- }
63
- };
64
-
65
59
  dashPanel = new DashPanel();
66
60
  widgetPanel = new WidgetPanel();
67
61
  propertyPanel = new PropertyPanel();
@@ -74,14 +68,8 @@ final public class Frame extends JFrame implements WindowListener{
74
68
  rightSideBar.add(eventPanel);
75
69
  rightSideBar.add(widgetPanel);
76
70
 
77
- leftSideBar = new JPanel(new VerticalFlowLayout(0, 10)){
71
+ leftSideBar = new JPanel(new VerticalFlowLayout(0, 10));
78
- private static final long serialVersionUID = 1L;
79
- @Override
80
- public void paintComponent(Graphics g){
81
- Style.drawVerticalBar(g, getWidth(), getHeight());
72
+ UIUtils.setUndecorated(leftSideBar, true);
82
- }
83
- };
84
-
85
73
  projectPanel = new ProjectPanel();
86
74
  projectSettingsPanel = new ProjectSettingsPanel();
87
75
  projectSettingsPanel.setVisible(false);
@@ -197,6 +185,7 @@ final public class Frame extends JFrame implements WindowListener{
197
185
  btn.setForeground(Style.font);
198
186
  btn.setBackground(Style.topColor);
199
187
  }
188
+ toolBar.searchBar.setBackground(Style.listBg);
200
189
  }
201
190
 
202
191
  private static void stylePanel(JPanel panel){
@@ -204,17 +193,17 @@ final public class Frame extends JFrame implements WindowListener{
204
193
  panel.setBackground(Style.botColor);
205
194
  for(Component c: panel.getComponents()){
206
195
  c.setForeground(Style.font);
207
- c.setBackground(Style.topColor);
196
+ c.setBackground(Style.botColor);
208
197
  if(c instanceof BaseList){
209
198
  ((BaseList)c).list.setBackground(Style.listBg);
210
199
  ((BaseList)c).list.setForeground(Style.font);
211
- ((BaseList)c).list.setSelectionBackground(Style.border);
200
+ ((BaseList)c).list.setSelectionBackground(Style.listSelect);
212
201
  ((BaseList)c).list.setSelectionForeground(Style.headerFg);
213
202
  }
214
203
  else if(c instanceof BaseTable){
215
204
  ((BaseTable)c).table.setBackground(Style.listBg);
216
205
  ((BaseTable)c).table.setForeground(Style.font);
217
- ((BaseTable)c).table.setSelectionBackground(Style.font);
206
+ ((BaseTable)c).table.setSelectionBackground(Style.listSelect);
218
207
  ((BaseTable)c).table.setSelectionForeground(Style.headerFg);
219
208
  }
220
209
  else if(c instanceof Style.TitleLabel)
@@ -268,7 +257,6 @@ final public class Frame extends JFrame implements WindowListener{
268
257
 
269
258
  @Override
270
259
  public void windowClosing(WindowEvent arg0) {
271
- ScenePanel.save();
272
260
  Content.editor.save();
273
261
  if(Content.studioPanel.canvas != null)
274
262
  Stage.clear();
IDE/SearchBar.java CHANGED
@@ -20,23 +20,7 @@ final public class SearchBar extends JTextField {
20
20
  UIUtils.setShadeWidth(this, 0);
21
21
  setPreferredSize(new Dimension(280, 22));
22
22
 
23
- JButton searchUpBtn = Style.createToolButton("up");
23
+ JButton searchUpBtn = Style.createToolButton("SearchUP", "up", new ActionListener(){
24
- UIUtils.setLeftRightSpacing(searchUpBtn, 0);
25
- UIUtils.setUndecorated(searchUpBtn, true);
26
-
27
- JButton searchDownBtn = Style.createToolButton("down");
28
- UIUtils.setLeftRightSpacing(searchDownBtn, 0);
29
- UIUtils.setUndecorated(searchDownBtn, true);
30
-
31
- JPanel updownPanel = new JPanel(new HorizontalFlowLayout(0));
32
- updownPanel.add(searchUpBtn);
33
- updownPanel.add(searchDownBtn);
34
- updownPanel.setOpaque(false);
35
- UIUtils.setUndecorated(updownPanel, true);
36
- UIUtils.setTrailingComponent(this, updownPanel);
37
-
38
-
39
- searchUpBtn.addActionListener( new ActionListener(){
40
24
  @Override
41
25
  public void actionPerformed(ActionEvent arg0) {
42
26
  if(Content.currentView.equals("Editor")){
@@ -45,8 +29,9 @@ final public class SearchBar extends JTextField {
45
29
  }
46
30
  }
47
31
  });
48
-
32
+ UIUtils.setLeftRightSpacing(searchUpBtn, 0);
33
+ UIUtils.setUndecorated(searchUpBtn, true);
49
- searchDownBtn.addActionListener( new ActionListener(){
34
+ JButton searchDownBtn = Style.createToolButton("SearchDown", "down", new ActionListener(){
50
35
  @Override
51
36
  public void actionPerformed(ActionEvent arg0) {
52
37
  if(Content.currentView.equals("Editor")){
@@ -55,5 +40,14 @@ final public class SearchBar extends JTextField {
55
40
  }
56
41
  }
57
42
  });
43
+ UIUtils.setLeftRightSpacing(searchDownBtn, 0);
44
+ UIUtils.setUndecorated(searchDownBtn, true);
45
+
46
+ JPanel updownPanel = new JPanel(new HorizontalFlowLayout(0));
47
+ updownPanel.add(searchUpBtn);
48
+ updownPanel.add(searchDownBtn);
49
+ updownPanel.setOpaque(false);
50
+ UIUtils.setUndecorated(updownPanel, true);
51
+ UIUtils.setTrailingComponent(this, updownPanel);
58
52
  }
59
53
  }
IDE/StatusBar.java CHANGED
@@ -13,18 +13,13 @@ import java.lang.management.ManagementFactory;
13
13
  import java.lang.management.MemoryUsage;
14
14
  import java.text.DecimalFormat;
15
15
 
16
+ import javax.swing.BorderFactory;
16
17
  import javax.swing.JButton;
17
- import javax.swing.JComponent;
18
18
  import javax.swing.JLabel;
19
19
  import javax.swing.JPanel;
20
- import javax.swing.JSeparator;
21
- import javax.swing.SwingConstants;
22
20
  import javax.swing.SwingUtilities;
23
21
 
24
22
  import web.laf.lite.layout.ToolbarLayout;
25
- import web.laf.lite.layout.VerticalFlowLayout;
26
- import web.laf.lite.popup.ButtonPopup;
27
- import web.laf.lite.popup.PopupWay;
28
23
  import web.laf.lite.utils.LafUtils;
29
24
  import web.laf.lite.utils.UIUtils;
30
25
  import web.laf.lite.utils.UpdateTimer;
@@ -81,6 +76,7 @@ final public class StatusBar extends JPanel {
81
76
  //initUpdate();
82
77
  //initNuke(); //Reduce nuke size
83
78
  add(new MemoryBar(), ToolbarLayout.END);
79
+ setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Style.border));
84
80
  }
85
81
 
86
82
  public void addSpace(){
@@ -88,25 +84,9 @@ final public class StatusBar extends JPanel {
88
84
  }
89
85
 
90
86
  public void addSeparator(){
87
+ JLabel comp = new JLabel();
88
+ comp.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Style.border));
91
- add(new VBar(), ToolbarLayout.START);
89
+ add(comp, ToolbarLayout.START);
92
- }
93
-
94
- class VBar extends JComponent {
95
- private static final long serialVersionUID = 1L;
96
-
97
- @Override
98
- protected void paintComponent(Graphics g) {
99
- super.paintComponent(g);
100
- g.setColor(Style.border);
101
- g.drawLine(0, 1, 0, getHeight());
102
- }
103
- }
104
-
105
- @Override
106
- protected void paintComponent(Graphics g) {
107
- //Style.drawHorizontalBar(g, getWidth (), getHeight ());
108
- super.paintComponent(g);
109
- Style.drawTopBorder(g, getWidth());
110
90
  }
111
91
 
112
92
  public static void updateCaret(int row, int col){
@@ -156,31 +136,25 @@ final public class StatusBar extends JPanel {
156
136
  }
157
137
 
158
138
  void initZoomIn(){
159
- final JButton zoomin = Style.createExplorerToolButton("ZoomIn", "szoomin", null);
139
+ add(Style.createToolPanel("ZoomIn", "szoomin", new ActionListener(){
160
- zoomin.addActionListener(new ActionListener(){
161
140
  @Override
162
141
  public void actionPerformed(ActionEvent arg0) {
163
142
  Content.editor.zoomin();
164
143
  }
165
-
166
- });
144
+ }));
167
- add(zoomin);
168
145
  }
169
146
 
170
147
  void initZoomOut(){
171
- final JButton zoomout = Style.createExplorerToolButton("ZoomOut", "szoomout", null);
148
+ add(Style.createToolPanel("ZoomOut", "szoomout", new ActionListener(){
172
- zoomout.addActionListener(new ActionListener(){
173
149
  @Override
174
150
  public void actionPerformed(ActionEvent arg0) {
175
151
  Content.editor.zoomout();
176
152
  }
177
-
178
- });
153
+ }));
179
- add(zoomout);
180
154
  }
181
155
 
182
156
  void initUpdate(){
183
- final JButton update = Style.createExplorerToolButton("Update", "supdate", null);
157
+ /*final JButton update = Style.createExplorerToolButton("Update", "supdate", null);
184
158
  ButtonPopup menu = new ButtonPopup(update, PopupWay.upCenter);
185
159
  JPanel popupContent = new JPanel (new VerticalFlowLayout(5, 10));
186
160
  popupContent.add(UIUtils.setBoldFont(new JLabel("SkyCode v0.39")));
@@ -192,18 +166,17 @@ final public class StatusBar extends JPanel {
192
166
  popupContent.add(new JLabel("Bug Fixes"));
193
167
  popupContent.setOpaque(false);
194
168
  menu.setContent (popupContent);
195
- add(update, ToolbarLayout.END);
169
+ add(update, ToolbarLayout.END);*/
196
170
  }
197
171
 
198
172
  void initNuke(){
199
- final JButton nuke = Style.createExplorerToolButton("Free Memory", "snuke", new ActionListener(){
173
+ add(Style.createToolPanel("Free Memory", "snuke", new ActionListener(){
200
174
  @Override
201
175
  public void actionPerformed(ActionEvent arg0) {
202
176
  System.gc();
203
177
  }
204
- });
178
+ }));
205
- add(nuke, ToolbarLayout.END);
206
- }
179
+ }
207
180
  }
208
181
 
209
182
  class MemoryBar extends JLabel{
IDE/Style.java CHANGED
@@ -1,317 +1,263 @@
1
-
2
-
3
- import java.awt.BorderLayout;
4
1
  import java.awt.Color;
5
- import java.awt.Dimension;
6
2
  import java.awt.FlowLayout;
7
3
  import java.awt.GradientPaint;
8
4
  import java.awt.Graphics;
9
5
  import java.awt.Graphics2D;
10
- import java.awt.Insets;
11
6
  import java.awt.Rectangle;
12
7
  import java.awt.event.ActionEvent;
13
8
  import java.awt.event.ActionListener;
14
9
  import java.util.ArrayList;
15
10
  import java.util.HashMap;
16
11
 
17
- import javax.swing.Box;
18
12
  import javax.swing.JButton;
19
13
  import javax.swing.JLabel;
20
14
  import javax.swing.JPanel;
21
- import javax.swing.JTextField;
22
15
 
23
- import web.laf.lite.layout.HorizontalFlowLayout;
24
16
  import web.laf.lite.layout.ToolbarLayout;
25
17
  import web.laf.lite.layout.VerticalFlowLayout;
26
- import web.laf.lite.popup.ButtonPopup;
27
- import web.laf.lite.popup.PopupWay;
28
18
  import web.laf.lite.utils.ColorUtils;
29
19
  import web.laf.lite.utils.UIUtils;
30
- import web.laf.lite.widget.CenterPanel;
31
20
 
32
21
  public enum Style {
33
- BLUE, DARK;
22
+ BLUE, DARK;
34
- private static Style currentStyle = Style.BLUE;
23
+ private static Style currentStyle = Style.BLUE;
35
- public static Color topColor;
24
+ public static Color topColor;
36
- public static Color botColor;
25
+ public static Color botColor;
37
- public static Color headerTopLine;
26
+ public static Color headerTopLine;
38
- public static Color headerBg;
27
+ public static Color headerBg;
39
- public static Color headerBgBot;
28
+ public static Color headerBgBot;
40
- public static Color headerFg;
29
+ public static Color headerFg;
41
- public static Color border;
30
+ public static Color border;
42
- public static Color focus;
31
+ public static Color focus;
43
- public static Color font;
32
+ public static Color font;
44
- public static Color listBg;
33
+ public static Color listBg;
34
+ public static Color listSelect;
35
+
36
+ public static Color topLineColor = new Color(0x4580c8);
37
+ public static Color bottomColor = new Color(0x1956ad);
38
+
39
+ private static HashMap<Style, ArrayList<Color>> stylesMap = new HashMap<Style, ArrayList<Color>>();
40
+ /* top, bot, headerTopline, headerBg, headerBgBot, headerFg, border, focus, font, listBg, listSelect*/
41
+ private static String blueColors = "e4e4e4,d1d1d1,e8eaeb,2a3b57,1a2b47,ffffff,"
42
+ + "808080,ef8e39,000000,ffffff,000080";
43
+ private static String darkColors = "213134,272b2f,6C788C,20272a,0b0e20,93c705,"
44
+ + "404040,ef8e39,e4e0e2,272b2f,000080";
45
+ static {
46
+ stylesMap.put(Style.BLUE, getColor(blueColors));
47
+ stylesMap.put(Style.DARK, getColor(darkColors));
48
+ setStyle(Style.BLUE);
49
+ }
50
+
51
+ public static void setStyle(Style style){
52
+ currentStyle = style;
53
+ topColor = stylesMap.get(currentStyle).get(0);
54
+ botColor = stylesMap.get(currentStyle).get(1);
55
+ headerTopLine = stylesMap.get(currentStyle).get(2);
56
+ headerBg = stylesMap.get(currentStyle).get(3);
57
+ headerBgBot = stylesMap.get(currentStyle).get(4);
58
+ headerFg = stylesMap.get(currentStyle).get(5);
59
+ border = stylesMap.get(currentStyle).get(6);
60
+ focus = stylesMap.get(currentStyle).get(7);
61
+ font = stylesMap.get(currentStyle).get(8);
62
+ listBg = stylesMap.get(currentStyle).get(9);
63
+ listSelect = stylesMap.get(currentStyle).get(10);
64
+ }
65
+
66
+ private static ArrayList<Color> getColor(String colorsString){
67
+ ArrayList<Color> listColor = new ArrayList<Color>();
68
+ for(String c: colorsString.split(","))
69
+ listColor.add(ColorUtils.parseHexColor(c));
70
+ return listColor;
71
+ }
72
+
73
+ public static Color canvasBg = new Color(108, 108, 108);
74
+ public static Color canvasScreen = new Color(28, 28, 28);
75
+ public static Color canvasShadowTop = new Color(108, 108, 108);
76
+ public static Color canvasShadowBot = new Color(155, 155, 155);
77
+ public static Color canvasBox = new Color(83, 82, 82);
78
+
79
+ private static Color scrollBg = new Color ( 245, 245, 245 );
80
+ private static Color scrollBorder = new Color ( 230, 230, 230 );
45
81
 
46
- public static Color topLineColor = new Color(0x4580c8);
82
+ private static Color scrollBarBorder = new Color ( 201, 201, 201 );
47
- public static Color bottomColor = new Color(0x1956ad);
83
+ private static Color scrollGradientLeft = new Color ( 239, 239, 239 );
48
-
49
- private static HashMap<Style, ArrayList<Color>> stylesMap = new HashMap<Style, ArrayList<Color>>();
50
- /* top, bot, headerTopline, headerBg, headerBgBot, headerFg, border, focus, font, listBg*/
51
- private static String blueColors = "e4e4e4,d1d1d1,e8eaeb,2a3b57,1a2b47,ffffff,"
52
- + "808080,ef8e39,000000,ffffff";
53
- private static String darkColors = "213134,272b2f,6C788C,20272a,0b0e20,93c705,"
84
+ private static Color scrollSelGradientLeft = new Color ( 203, 203, 203 ); //33
54
- + "404040,ef8e39,e4e0e2,272b2f";
55
- static {
56
- stylesMap.put(Style.BLUE, getColor(blueColors));
85
+ private static Color scrollGradientRight = new Color ( 211, 211, 211 );
57
- stylesMap.put(Style.DARK, getColor(darkColors));
86
+ private static Color scrollSelGradientRight = new Color ( 175, 175, 175 );//-45
58
- setStyle(Style.BLUE);
59
- }
60
87
 
88
+ public static HashMap<String, JButton> btnMap = new HashMap<String, JButton>();
89
+ public static ArrayList<JButton> viewGroup = new ArrayList<JButton>();
61
- public static void setStyle(Style style){
90
+ private static GradientPaint headerBgPaint;
62
- currentStyle = style;
63
- topColor = stylesMap.get(currentStyle).get(0);
64
- botColor = stylesMap.get(currentStyle).get(1);
65
- headerTopLine = stylesMap.get(currentStyle).get(2);
66
- headerBg = stylesMap.get(currentStyle).get(3);
67
- headerBgBot = stylesMap.get(currentStyle).get(4);
68
- headerFg = stylesMap.get(currentStyle).get(5);
69
- border = stylesMap.get(currentStyle).get(6);
70
- focus = stylesMap.get(currentStyle).get(7);
71
- font = stylesMap.get(currentStyle).get(8);
72
- listBg = stylesMap.get(currentStyle).get(9);
73
- }
74
91
 
75
- private static ArrayList<Color> getColor(String colorsString){
76
- ArrayList<Color> listColor = new ArrayList<Color>();
77
- for(String c: colorsString.split(","))
78
- listColor.add(ColorUtils.parseHexColor(c));
79
- return listColor;
80
- }
81
-
82
- public static Color canvasBg = new Color(108, 108, 108);
83
- public static Color canvasScreen = new Color(28, 28, 28);
84
- public static Color canvasShadowTop = new Color(108, 108, 108);
85
- public static Color canvasShadowBot = new Color(155, 155, 155);
86
- public static Color canvasBox = new Color(83, 82, 82);
87
-
88
- private static Color scrollBg = new Color ( 245, 245, 245 );
89
- private static Color scrollBorder = new Color ( 230, 230, 230 );
90
-
91
- private static Color scrollBarBorder = new Color ( 201, 201, 201 );
92
- private static Color scrollGradientLeft = new Color ( 239, 239, 239 );
93
- private static Color scrollSelGradientLeft = new Color ( 203, 203, 203 ); //33
94
- private static Color scrollGradientRight = new Color ( 211, 211, 211 );
95
- private static Color scrollSelGradientRight = new Color ( 175, 175, 175 );//-45
96
-
97
- public static HashMap<String, JButton> btnMap = new HashMap<String, JButton>();
98
- public static ArrayList<JButton> viewGroup = new ArrayList<JButton>();
99
- private static GradientPaint headerBgPaint;
100
-
101
- final public static void drawBottomBorder(Graphics g, int width, int height){
102
- g.setColor(Style.border);
103
- g.drawLine(0, height-1, width, height-1);
104
- }
105
-
106
- final public static void drawTopBorder(Graphics g, int width){
107
- g.setColor(Style.border);
108
- g.drawLine(0, 0, width, 0);
109
- }
110
-
111
- final public static void drawRightBorder(Graphics g, int width, int height){
112
- g.setColor(Style.border);
113
- g.drawLine(width-1, 0, width-1, height);
114
- }
115
-
116
- final public static void drawLeftBorder(Graphics g, int width, int height){
117
- g.setColor(Style.border);
118
- g.drawLine(0, 0, 0, height);
119
- }
120
-
121
- private static final int margin = 15;
92
+ private static final int margin = 15;
122
- private static final int marginsub5 = 10;
93
+ private static final int marginsub5 = 10;
123
- private static final int margin5 = 20;
94
+ private static final int margin5 = 20;
124
- private static final int targetW = 800+55;
95
+ private static final int targetW = 800+55;
125
- private static final int targetH = 480;
96
+ private static final int targetH = 480;
126
-
127
- final public static void drawScreen(Graphics g, int width, int height){
128
- g.setColor(Style.canvasBg);
129
- g.fillRect(0, 0, width, height); //bg
130
- g.setColor(Color.black);
131
- g.fillRoundRect(5, marginsub5, targetW+marginsub5, targetH+10, 10, 10);
132
- g.setColor(Style.canvasShadowBot);
133
- g.drawLine(margin, targetH+margin5, targetW+marginsub5, targetH+margin5);//hoz shadow y same
134
- g.drawLine(targetW+margin, margin, targetW+margin, targetH+margin);// vert shadow x same
135
- g.setColor(Style.canvasBox);
136
- g.fillRect(0, targetH+3*margin, width, 2);
137
- g.fillRect(0, targetH+3*margin+3, width, height-targetH+3*margin-3);
138
- }
139
-
140
- public static Color tableHeaderTopLineColor = new Color ( 232, 234, 235 );
141
- public static Color tableHeaderTopBgColor = new Color ( 226, 226, 226 );
142
- public static Color tableHeaderBotBgColor = new Color ( 201, 201, 201 );
143
- public static Color tableHeaderBotLineColor = new Color ( 104, 104, 104 );
144
- public static void drawTableHeader(Graphics g, int width, int height){
145
- Graphics2D g2d = ( Graphics2D ) g;
146
- // Table header background
147
- GradientPaint bgPaint = new GradientPaint (0, 1, topColor, 0, height - 1, botColor);
148
- g2d.setPaint(bgPaint);
149
- g2d.fillRect(0, 1, width, height - 1);
150
97
 
98
+ final public static void drawScreen(Graphics g, int width, int height){
99
+ g.setColor(Style.canvasBg);
100
+ g.fillRect(0, 0, width, height); //bg
101
+ g.setColor(Color.black);
102
+ g.fillRoundRect(5, marginsub5, targetW+marginsub5, targetH+10, 10, 10);
103
+ g.setColor(Style.canvasShadowBot);
104
+ g.drawLine(margin, targetH+margin5, targetW+marginsub5, targetH+margin5);//hoz shadow y same
105
+ g.drawLine(targetW+margin, margin, targetW+margin, targetH+margin);// vert shadow x same
106
+ g.setColor(Style.canvasBox);
107
+ g.fillRect(0, targetH+3*margin, width, 2);
108
+ g.fillRect(0, targetH+3*margin+3, width, height-targetH+3*margin-3);
109
+ }
110
+
111
+ public static Color tableHeaderTopLineColor = new Color ( 232, 234, 235 );
112
+ public static Color tableHeaderTopBgColor = new Color ( 226, 226, 226 );
113
+ public static Color tableHeaderBotBgColor = new Color ( 201, 201, 201 );
114
+ public static Color tableHeaderBotLineColor = new Color ( 104, 104, 104 );
115
+ public static void drawTableHeader(Graphics g, int width, int height){
116
+ Graphics2D g2d = ( Graphics2D ) g;
117
+ // Table header background
118
+ GradientPaint bgPaint = new GradientPaint (0, 1, topColor, 0, height - 1, botColor);
119
+ g2d.setPaint(bgPaint);
120
+ g2d.fillRect(0, 1, width, height - 1);
121
+
151
- // Header top and bottom lines
122
+ // Header top and bottom lines
152
- //g2d.setColor(headerTopLine);
123
+ //g2d.setColor(headerTopLine);
153
124
  // g2d.drawLine( 0, 0, width, 0);
154
- }
125
+ }
155
-
126
+
156
- final public static void drawHorizontalBar(Graphics g, int width, int height){
127
+ final public static void drawHorizontalBar(Graphics g, int width, int height){
157
- Graphics2D g2d = ( Graphics2D ) g;
128
+ Graphics2D g2d = ( Graphics2D ) g;
158
- GradientPaint paint = new GradientPaint(0, 1, Style.topColor, 0, height, Style.botColor);
129
+ GradientPaint paint = new GradientPaint(0, 1, Style.topColor, 0, height, Style.botColor);
159
- g2d.setPaint(paint);
130
+ g2d.setPaint(paint);
160
- g2d.fillRect(0, 0, width, height);
131
+ g2d.fillRect(0, 0, width, height);
161
- }
132
+ }
162
-
163
- final public static void drawLightHorizontalBar(Graphics g, int width, int height){
164
- Graphics2D g2d = ( Graphics2D ) g;
165
- g2d.setPaint ( new GradientPaint ( 0, 1, Color.WHITE, 0, height, new Color ( 223, 223, 223 ) ) );
166
- g2d.fillRect(0, 0, width, height);
167
- }
168
-
169
- final public static void drawDarkHorizontalBar(Graphics g, int width, int height){
170
- Graphics2D g2d = ( Graphics2D ) g;
171
- GradientPaint paint = new GradientPaint(0, 1, Style.topColor.darker(), 0, height, Style.botColor.darker());
172
- g2d.setPaint(paint);
173
- g2d.fillRect(0, 0, width, height);
174
- }
175
-
176
- final public static void drawTreeSelection(Graphics g, int height, Rectangle rect){
177
- Graphics2D g2d = ( Graphics2D ) g;
178
- g2d.setPaint ( new GradientPaint ( 0, 1, Style.topLineColor, 0, height, Style.bottomColor ) );
179
- g2d.fill(rect);
180
- g2d.setPaint(Style.topLineColor);
181
- g2d.draw(rect);
182
- }
183
-
184
- final public static void drawVerticalBar(Graphics g, int width, int height){
185
- Graphics2D g2d = ( Graphics2D ) g;
186
- GradientPaint paint = new GradientPaint(0, 1, Style.botColor, 0, height, Style.topColor);
187
- g2d.setPaint(paint);
188
- g2d.fillRect(0, 0, width, height);
189
- }
190
-
191
- final public static void drawVerticalScrollTrack( Graphics g, Rectangle thumbRect, int width,int height,
192
- boolean drawBorder ){
193
- if (drawBorder){
194
- Graphics2D g2d = ( Graphics2D ) g;
195
- g2d.setPaint ( scrollBg );
196
- g2d.fillRect ( 0, 0, width, height );
197
- int vBorder = width - 1; //maybe 0
198
- g2d.setColor ( scrollBorder );
199
- g2d.drawLine ( vBorder, 0, vBorder, height - 1 );
200
- }
201
- }
202
-
203
- final public static void drawHorizontalScrollTrack( Graphics g, Rectangle thumbRect, int width,int height,
204
- boolean drawBorder ){
205
- if (drawBorder){
206
- Graphics2D g2d = ( Graphics2D ) g;
207
- g2d.setPaint ( scrollBg );
208
- g2d.fillRect ( 0, 0, width, height );
209
- g2d.setColor ( scrollBorder );
210
- g2d.drawLine ( 0, 0, width, 0 );
211
- }
212
- }
213
-
214
- final public static void drawVerticalScrollBar( Graphics g, Rectangle thumbRect, int width, boolean isDragging){
215
- Graphics2D g2d = ( Graphics2D ) g;
216
- Color leftColor = isDragging ? scrollSelGradientLeft : scrollGradientLeft;
217
- Color rightColor = isDragging ? scrollSelGradientRight : scrollGradientRight;
218
- g2d.setPaint ( new GradientPaint ( 3, 0, leftColor, width - 4, 0, rightColor ) );
219
- g2d.fillRoundRect ( thumbRect.x + 2, thumbRect.y + 1, thumbRect.width - 4, thumbRect.height - 3, 0, 0);
220
- g2d.setPaint ( scrollBarBorder );
221
- g2d.drawRoundRect ( thumbRect.x + 2, thumbRect.y + 1, thumbRect.width - 4, thumbRect.height - 3, 0, 0);
222
- }
223
-
224
- final public static void drawHorizontalScrollBar( Graphics g, Rectangle thumbRect, int width, boolean isDragging){
225
- Graphics2D g2d = ( Graphics2D ) g;
226
- Color leftColor = isDragging ? scrollSelGradientLeft : scrollGradientLeft;
227
- Color rightColor = isDragging ? scrollSelGradientRight : scrollGradientRight;
228
- g2d.setPaint ( new GradientPaint ( 0, thumbRect.y + 2, leftColor, 0, thumbRect.y + 2 + thumbRect.height - 4, rightColor ) );
229
- g2d.fillRoundRect ( thumbRect.x + 1, thumbRect.y + 2, thumbRect.width - 3, thumbRect.height - 4, 0, 0);
230
- g2d.setPaint ( scrollBarBorder );
231
- g2d.drawRoundRect ( thumbRect.x + 1, thumbRect.y + 2, thumbRect.width - 3, thumbRect.height - 4, 0, 0);
232
- }
233
-
234
- public static class TitleLabel extends JLabel {
235
- private static final long serialVersionUID = 1L;
236
- public TitleLabel(String text){
237
- super(text.toUpperCase());
238
- UIUtils.setBoldFont(this);
239
- setVerticalTextPosition(JLabel.CENTER);
240
- setHorizontalTextPosition(JLabel.CENTER);
241
- setHorizontalAlignment(JLabel.CENTER);
242
- setForeground(Style.headerFg);
243
- }
244
- @Override
245
- public void paint ( Graphics g){
246
- Graphics2D g2d = ( Graphics2D ) g;
247
- if(headerBgPaint == null)
248
- headerBgPaint = new GradientPaint ( 0, 1, Style.headerBg,
249
- 0, getHeight()-1, Style.headerBgBot);
250
- g2d.setPaint ( headerBgPaint );
251
- g2d.fillRect ( 0, 1, getWidth(), getHeight() - 1 );
252
- g2d.setColor ( Style.headerTopLine);
253
- g2d.drawLine ( 0, 0, getWidth (), 0 );
254
- super.paint(g);
255
- }
256
- }
257
-
258
- public static class TitleButton extends JButton {
259
- private static final long serialVersionUID = 1L;
260
- public TitleButton(String text){
261
- super(text.toUpperCase());
262
- //btn.setOpaque(true);
263
- //btn.setBackground(headerBg);
264
- setForeground(Style.headerFg);
265
- UIUtils.setBoldFont(this);
266
- UIUtils.setRolloverDecoratedOnly(this,true);
267
- UIUtils.setLeftRightSpacing(this, 4);
268
- UIUtils.setRound(this, 0);
269
- UIUtils.setUndecorated(this, true);
270
- UIUtils.setShadeWidth(this, 2);
271
- setVerticalTextPosition(JLabel.CENTER);
272
- setHorizontalTextPosition(JLabel.CENTER);
273
- setHorizontalAlignment(JLabel.CENTER);
274
- }
275
133
 
276
- @Override
134
+ final public static void drawVerticalScrollTrack( Graphics g, Rectangle thumbRect, int width,int height,
277
- public void paint( Graphics g){
135
+ boolean drawBorder ){
136
+ if (drawBorder){
278
- Graphics2D g2d = ( Graphics2D ) g;
137
+ Graphics2D g2d = ( Graphics2D ) g;
279
- if(headerBgPaint == null)
280
- headerBgPaint = new GradientPaint ( 0, 1, Style.headerBg,
281
- 0, getHeight()-1, Style.headerBgBot);
282
- g2d.setPaint ( headerBgPaint );
138
+ g2d.setPaint ( scrollBg );
283
- g2d.fillRect ( 0, 1, getWidth (), getHeight () - 1 );
139
+ g2d.fillRect ( 0, 0, width, height );
140
+ int vBorder = width - 1; //maybe 0
141
+ g2d.setColor ( scrollBorder );
142
+ g2d.drawLine ( vBorder, 0, vBorder, height - 1 );
143
+ }
144
+ }
284
145
 
146
+ final public static void drawHorizontalScrollTrack( Graphics g, Rectangle thumbRect, int width,int height,
147
+ boolean drawBorder ){
148
+ if (drawBorder){
285
- // Header top and bottom lines
149
+ Graphics2D g2d = ( Graphics2D ) g;
150
+ g2d.setPaint ( scrollBg );
151
+ g2d.fillRect ( 0, 0, width, height );
286
- g2d.setColor ( Style.headerTopLine );
152
+ g2d.setColor ( scrollBorder );
287
- g2d.drawLine ( 0, 0, getWidth (), 0 );
153
+ g2d.drawLine ( 0, 0, width, 0 );
288
- super.paint(g);
289
- }
154
+ }
290
- }
155
+ }
291
156
 
157
+ final public static void drawVerticalScrollBar( Graphics g, Rectangle thumbRect, int width, boolean isDragging){
292
- /*
158
+ Graphics2D g2d = ( Graphics2D ) g;
159
+ Color leftColor = isDragging ? scrollSelGradientLeft : scrollGradientLeft;
160
+ Color rightColor = isDragging ? scrollSelGradientRight : scrollGradientRight;
293
- * Creates a plain flat JButton/Header Button with current Style background color
161
+ g2d.setPaint ( new GradientPaint ( 3, 0, leftColor, width - 4, 0, rightColor ) );
162
+ g2d.fillRoundRect ( thumbRect.x + 2, thumbRect.y + 1, thumbRect.width - 4, thumbRect.height - 3, 0, 0);
163
+ g2d.setPaint ( scrollBarBorder );
164
+ g2d.drawRoundRect ( thumbRect.x + 2, thumbRect.y + 1, thumbRect.width - 4, thumbRect.height - 3, 0, 0);
165
+ }
166
+
167
+ final public static void drawHorizontalScrollBar( Graphics g, Rectangle thumbRect, int width, boolean isDragging){
168
+ Graphics2D g2d = ( Graphics2D ) g;
169
+ Color leftColor = isDragging ? scrollSelGradientLeft : scrollGradientLeft;
170
+ Color rightColor = isDragging ? scrollSelGradientRight : scrollGradientRight;
171
+ g2d.setPaint ( new GradientPaint ( 0, thumbRect.y + 2, leftColor, 0, thumbRect.y + 2 + thumbRect.height - 4, rightColor ) );
172
+ g2d.fillRoundRect ( thumbRect.x + 1, thumbRect.y + 2, thumbRect.width - 3, thumbRect.height - 4, 0, 0);
173
+ g2d.setPaint ( scrollBarBorder );
174
+ g2d.drawRoundRect ( thumbRect.x + 1, thumbRect.y + 2, thumbRect.width - 3, thumbRect.height - 4, 0, 0);
175
+ }
176
+
177
+ public static class TitleLabel extends JLabel {
178
+ private static final long serialVersionUID = 1L;
179
+ public TitleLabel(String text){
180
+ setText(text);
181
+ UIUtils.setBoldFont(this);
182
+ setVerticalTextPosition(JLabel.CENTER);
183
+ setHorizontalTextPosition(JLabel.CENTER);
184
+ setHorizontalAlignment(JLabel.CENTER);
185
+ setForeground(Style.headerFg);
186
+ }
294
- */
187
+ @Override
188
+ public void setText(String text){
189
+ super.setText(text.toUpperCase());
190
+ }
191
+ @Override
192
+ public void paint ( Graphics g){
193
+ Graphics2D g2d = ( Graphics2D ) g;
194
+ if(headerBgPaint == null)
195
+ headerBgPaint = new GradientPaint ( 0, 1, Style.headerBg,
196
+ 0, getHeight()-1, Style.headerBgBot);
197
+ g2d.setPaint ( headerBgPaint );
198
+ g2d.fillRect ( 0, 1, getWidth(), getHeight() - 1 );
199
+ g2d.setColor ( Style.headerTopLine);
200
+ g2d.drawLine ( 0, 0, getWidth (), 0 );
201
+ super.paint(g);
202
+ }
203
+ }
204
+
205
+ public static class TitleButton extends JButton {
206
+ private static final long serialVersionUID = 1L;
295
- final public static JButton createHeaderButton(String text, ActionListener al){
207
+ public TitleButton(String text, ActionListener al){
208
+ setText(text);
209
+ //btn.setOpaque(true);
210
+ //btn.setBackground(headerBg);
211
+ setForeground(Style.headerFg);
212
+ UIUtils.setBoldFont(this);
296
- final TitleButton btn = new TitleButton(text);
213
+ UIUtils.setRolloverDecoratedOnly(this,true);
214
+ UIUtils.setLeftRightSpacing(this, 4);
215
+ UIUtils.setRound(this, 0);
216
+ UIUtils.setUndecorated(this, true);
217
+ UIUtils.setShadeWidth(this, 2);
218
+ setVerticalTextPosition(JLabel.CENTER);
219
+ setHorizontalTextPosition(JLabel.CENTER);
220
+ setHorizontalAlignment(JLabel.CENTER);
297
- if(al != null)
221
+ if(al != null)
298
- btn.addActionListener(al);
222
+ addActionListener(al);
223
+ }
224
+ public TitleButton(String text){
225
+ this(text, null);
226
+ }
227
+ @Override
228
+ public void setText(String text){
229
+ super.setText(text.toUpperCase());
230
+ }
231
+ @Override
232
+ public void paint( Graphics g){
233
+ Graphics2D g2d = ( Graphics2D ) g;
234
+ if(headerBgPaint == null)
235
+ headerBgPaint = new GradientPaint ( 0, 1, Style.headerBg,
236
+ 0, getHeight()-1, Style.headerBgBot);
237
+ g2d.setPaint ( headerBgPaint );
238
+ g2d.fillRect ( 0, 1, getWidth (), getHeight () - 1 );
239
+
240
+ // Header top and bottom lines
241
+ g2d.setColor ( Style.headerTopLine );
242
+ g2d.drawLine ( 0, 0, getWidth (), 0 );
299
- return btn;
243
+ super.paint(g);
244
+ }
300
245
  }
246
+
301
- /* ToolBar Related Methods */
247
+ /* ToolBar Related Methods */
302
248
  // This is for Menu Items
303
249
  final public static JButton createMenuButton(String title){
304
250
  JButton btn = new JButton(title);
305
251
  btn.setFocusable(false);
306
252
  btn.setOpaque(false);
307
- UIUtils.setRolloverDecoratedOnly(btn, true);
253
+ UIUtils.setRolloverDecoratedOnly(btn, true);
308
- UIUtils.setRound(btn, 0);
254
+ UIUtils.setRound(btn, 0);
309
- UIUtils.setLeftRightSpacing(btn, 5);
255
+ UIUtils.setLeftRightSpacing(btn, 5);
310
- UIUtils.setShadeWidth(btn, 0);
256
+ UIUtils.setShadeWidth(btn, 0);
311
- UIUtils.setInnerShadeWidth(btn, 0);
257
+ UIUtils.setInnerShadeWidth(btn, 0);
312
258
  return btn;
313
259
  }
314
-
260
+
315
261
  // This is for ToolButtons without Popup
316
262
  final public static JPanel createToolPanel(String text, String iconname,final ActionListener onClick){
317
263
  final JPanel pan = new JPanel(new VerticalFlowLayout(FlowLayout.CENTER, 0, 0));
@@ -327,63 +273,62 @@ public enum Style {
327
273
  return pan;
328
274
  }
329
275
 
330
- /* SideBar Related Methods */
276
+ /* SideBar Related Methods */
331
277
  // This is for ToolButtons with Popup
332
- final public static JButton createToolButton(String iconname){
278
+ final public static JButton createToolButton(String tooltip, String iconname, ActionListener al){
333
279
  final JButton btn = new JButton(Icon.icon(iconname));
280
+ btn.setToolTipText(tooltip);
281
+ UIUtils.setRolloverDecoratedOnly(btn,true);
282
+ UIUtils.setLeftRightSpacing(btn, 0);
334
283
  btn.setFocusable(false);
335
- btn.setToolTipText(iconname.toUpperCase());
284
+ if(al != null)
336
- btn.setOpaque(false);
285
+ btn.addActionListener(al);
337
- UIUtils.setLeftRightSpacing(btn, 5);
338
- UIUtils.setRound(btn, 0);
339
- UIUtils.setShadeWidth(btn, 0);
340
- UIUtils.setUndecorated(btn, true);
341
286
  return btn;
342
287
  }
343
-
288
+
344
289
  // This is for ToolButtons without Popup
345
290
  public static JButton createPopUpToolButton(String iconname){
346
291
  JButton btn = new JButton(Icon.icon(iconname));
347
292
  btn.setFocusable(false);
348
293
  btn.setToolTipText(iconname.toUpperCase());
349
294
  btn.setOpaque(false);
350
- UIUtils.setLeftRightSpacing(btn, 4);
295
+ UIUtils.setLeftRightSpacing(btn, 4);
351
- UIUtils.setRound(btn, 0);
296
+ UIUtils.setRound(btn, 0);
352
- UIUtils.setUndecorated(btn, true);
297
+ UIUtils.setUndecorated(btn, true);
353
298
  return btn;
354
299
  }
355
-
300
+
356
301
  static int currentIndex = 1;
357
302
  public static void viewButton(String text, String ic){
358
303
  final int id = Integer.valueOf(currentIndex);
359
304
  currentIndex += 1;
360
305
  JButton btn = new JButton(text,Icon.icon(ic));
361
306
  UIUtils.setDrawFocus(btn, false);
362
- UIUtils.setShadeWidth(btn, 0);
307
+ UIUtils.setShadeWidth(btn, 0);
363
- //UIUtils.setRound(btn, 0);
308
+ //UIUtils.setRound(btn, 0);
364
309
  viewGroup.add(btn);
365
310
  btn.addActionListener(new ActionListener(){
366
311
  @Override
367
312
  public void actionPerformed(ActionEvent arg0) {
368
313
  Content.toggleView(id);
369
314
  }
370
- });
315
+ });
371
316
  }
372
-
317
+
373
318
  final public static JPanel createButtonToolBarPanel(){
374
319
  JPanel tools = new JPanel(new ToolbarLayout(ToolbarLayout.HORIZONTAL)){
375
320
  private static final long serialVersionUID = 1L;
376
321
 
377
322
  @Override
378
323
  public void paintComponent(Graphics g){
379
- Style.drawHorizontalBar(g, getWidth (), getHeight ());
324
+ Style.drawHorizontalBar(g, getWidth (), getHeight ());
380
- g.setColor(Color.GRAY);
325
+ g.setColor(Color.GRAY);
381
- g.drawLine(0, getHeight()-1, getWidth(), getHeight()-1);
326
+ g.drawLine(0, getHeight()-1, getWidth(), getHeight()-1);
382
327
  }
383
328
  };
384
329
  return tools;
385
330
  }
386
-
331
+
387
332
  public static JPanel createButtonToolBar(ActionListener al, String[] list){
388
333
  JPanel tools = createButtonToolBarPanel();
389
334
  for(int i=0;i< list.length-1; i++){
@@ -391,103 +336,13 @@ public enum Style {
391
336
  if(i%2 != 0)
392
337
  continue;
393
338
  final JButton btn = new JButton(Icon.icon(list[i+1]));
394
- UIUtils.setRolloverDecoratedOnly(btn,true);
339
+ UIUtils.setRolloverDecoratedOnly(btn,true);
395
- UIUtils.setLeftRightSpacing(btn, 0);
340
+ UIUtils.setLeftRightSpacing(btn, 0);
396
- btn.setFocusable(false);
341
+ btn.setFocusable(false);
397
- btn.setToolTipText(list[i]);
342
+ btn.setToolTipText(list[i]);
398
- btn.addActionListener(al);
343
+ btn.addActionListener(al);
399
- tools.add(btn);
344
+ tools.add(btn);
400
345
  }
401
346
  return tools;
402
347
  }
403
-
404
- /* Explorer Related Methods */
405
- final public static JButton createExplorerToolButton(String text,String iconname, ActionListener al){
406
- final JButton btn = new JButton(Icon.icon(iconname));
407
- UIUtils.setRolloverDecoratedOnly(btn,true);
408
- UIUtils.setLeftRightSpacing(btn, 0);
409
- btn.setFocusable(false);
410
- btn.setToolTipText(text);
411
- if(al != null)
412
- btn.addActionListener(al);
413
- return btn;
414
- }
415
-
416
- final private static ButtonPopup createExplorerToolMenu(JButton btn, String title){
417
- final ButtonPopup menu = new ButtonPopup(btn, PopupWay.upRight);
418
- menu.setRound(0);
419
- menu.setShadeWidth(7);
420
- final JPanel content = new JPanel(new BorderLayout());
421
- content.setOpaque(false);
422
- UIUtils.setRound(btn, 0);
423
- UIUtils.setLeftRightSpacing(btn, 0);
424
- content.add(new TitleLabel(title), BorderLayout.NORTH);
425
- menu.setContent(content);
426
- return menu;
427
- }
428
-
429
- final public static JButton createExplorerToolPopButton(final String text, final String icon,
430
- final JPanel panel, final String finishText, final ActionListener onClick){
431
- final JButton btn = createExplorerToolButton(text, icon, null);
432
- final ButtonPopup menu = createExplorerToolMenu(btn, text);
433
- final JButton finish = createHeaderButton(finishText, null);
434
- finish.setToolTipText(text);
435
- final JPanel hoz = new JPanel(new VerticalFlowLayout(10));
436
- panel.setOpaque(false);
437
- UIUtils.setMargin(hoz, new Insets(10,10,10,10));
438
- hoz.setOpaque(false);
439
- hoz.add(new CenterPanel(panel));
440
- Box box = Box.createHorizontalBox();
441
- box.add(Box.createHorizontalGlue());
442
- box.add(finish);
443
- hoz.add(box);
444
- menu.getContentPanel().add(new CenterPanel(hoz), BorderLayout.CENTER);
445
- finish.addActionListener(new ActionListener(){
446
- @Override
447
- public void actionPerformed(ActionEvent event) {
448
- menu.hidePopup();
449
- if(onClick != null)
450
- onClick.actionPerformed(event);
451
- }
452
- });
453
- return btn;
454
- }
455
-
456
- final public static JButton createExplorerToolPopButton(final String text, final String icon,
457
- JTextField field, final ActionListener onClick){
458
- final JButton btn = createExplorerToolButton(text, icon, null);
459
- final ButtonPopup menu = createExplorerToolMenu(btn, text);
460
- final JButton finish = createHeaderButton("OK", null);
461
- finish.setToolTipText(text);
462
- final JPanel hoz = new JPanel(new HorizontalFlowLayout(10));
463
- field.setPreferredSize(new Dimension(240,25));
464
- UIUtils.setMargin(hoz, new Insets(10,10,10,10));
465
- hoz.setOpaque(false);
466
- hoz.add(new CenterPanel(field));
467
- Box box = Box.createHorizontalBox();
468
- box.add(Box.createHorizontalGlue());
469
- box.add(finish);
470
- hoz.add(box);
471
- menu.getContentPanel().add(new CenterPanel(hoz), BorderLayout.CENTER);
472
- finish.addActionListener(new ActionListener(){
473
- @Override
474
- public void actionPerformed(ActionEvent arg0) {
475
- if(onClick != null)
476
- onClick.actionPerformed(arg0);
477
- menu.hidePopup();
478
- }
479
- });
480
- return btn;
481
- }
482
-
483
- public static JButton TreeButton(String iconName){
484
- JButton btn = new JButton(Icon.icon(iconName));
485
- btn.setVisible(false);
486
- btn.setOpaque(false);
487
- btn.setFocusable(false);
488
- UIUtils.setRound(btn, 0);
489
- //UIUtils.setShadeWidth(btn, 0);
490
- //UIUtils.setUndecorated(btn, true);
491
- return btn;
492
- }
493
348
  }
IDE/ToolBar.java CHANGED
@@ -1,15 +1,19 @@
1
+ import java.awt.BorderLayout;
1
2
  import java.awt.Dimension;
2
3
  import java.awt.FileDialog;
3
4
  import java.awt.FlowLayout;
4
5
  import java.awt.Graphics;
5
6
  import java.awt.Insets;
7
+ import java.awt.Toolkit;
6
8
  import java.awt.event.ActionEvent;
7
9
  import java.awt.event.ActionListener;
8
10
  import java.io.File;
9
11
  import java.io.IOException;
10
12
  import java.lang.ProcessBuilder.Redirect;
11
13
 
14
+ import javax.swing.BorderFactory;
12
15
  import javax.swing.JButton;
16
+ import javax.swing.JDialog;
13
17
  import javax.swing.JLabel;
14
18
  import javax.swing.JPanel;
15
19
  import javax.swing.JSeparator;
@@ -30,6 +34,7 @@ final public class ToolBar extends JPanel {
30
34
  SearchBar searchBar;
31
35
  ProcessBuilder pb;
32
36
  Process runningProcess;
37
+ OptionsPanel optionsPanel;
33
38
 
34
39
  public ToolBar(){
35
40
  super(new ToolbarLayout());
@@ -62,12 +67,12 @@ final public class ToolBar extends JPanel {
62
67
  addSpace();
63
68
  addSeparator();
64
69
  initView();
70
+ setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Style.border));
65
71
  }
66
72
 
67
73
  @Override
68
74
  public void paintComponent(Graphics g){
69
75
  Style.drawHorizontalBar(g, getWidth (), getHeight ());
70
- Style.drawBottomBorder(g, getWidth (), getHeight ());
71
76
  }
72
77
 
73
78
  void initSearch(){
@@ -79,29 +84,41 @@ final public class ToolBar extends JPanel {
79
84
  }
80
85
 
81
86
  void initAbout(){
82
- add(Style.createToolPanel("", "sabout", null));
87
+ add(Style.createToolPanel("", "sabout", new ActionListener(){
88
+ @Override
89
+ public void actionPerformed(ActionEvent arg0) {
83
- UIUtils.setUndecorated(Style.btnMap.get("sabout"), true);
90
+ JDialog dialog = new JDialog(Frame.getInstance(), "About", false);
84
- final ButtonPopup menu = new ButtonPopup(Style.btnMap.get("sabout"), PopupWay.downRight);
85
- menu.setRound(0);
91
+ dialog.setResizable(false);
92
+ dialog.getContentPane().setLayout(new BorderLayout());
86
- final JPanel popupContent = new JPanel (new VerticalFlowLayout(5, 10));
93
+ final JPanel popupContent = new JPanel (new VerticalFlowLayout(5, 10));
87
- final JButton licenseBtn = new JButton("Apache License v2.0");
94
+ final JButton licenseBtn = new JButton("Apache License v2.0");
88
- final JPanel author = new JPanel(new HorizontalFlowLayout());
95
+ final JPanel author = new JPanel(new HorizontalFlowLayout());
89
- final JPanel hoz = new JPanel(new HorizontalFlowLayout());
96
+ final JPanel hoz = new JPanel(new HorizontalFlowLayout());
90
- popupContent.add(UIUtils.setBoldFont(new JLabel("GdxStudio v"+Main.version)));
97
+ popupContent.add(UIUtils.setBoldFont(new JLabel("GdxStudio v"+Main.version)));
91
- popupContent.add(new JSeparator(SwingConstants.HORIZONTAL));
98
+ popupContent.add(new JSeparator(SwingConstants.HORIZONTAL));
92
- author.setOpaque(false);
99
+ author.setOpaque(false);
93
- author.add(new JLabel("Created by: pyros2097"));
100
+ author.add(new JLabel("Created by: pyros2097"));
94
- author.add(licenseBtn);
101
+ author.add(licenseBtn);
95
- popupContent.add(author);
102
+ popupContent.add(author);
96
- popupContent.add(new JSeparator(SwingConstants.HORIZONTAL));
103
+ popupContent.add(new JSeparator(SwingConstants.HORIZONTAL));
97
- popupContent.add(new JLabel("", Icon.icon("slibGDX"), JLabel.LEADING));
104
+ popupContent.add(new JLabel("", Icon.icon("slibGDX"), JLabel.LEADING));
98
- popupContent.add(new JLabel("", Icon.icon("sweblaf"), JLabel.LEADING));
105
+ popupContent.add(new JLabel("", Icon.icon("sweblaf"), JLabel.LEADING));
99
- hoz.setOpaque(false);
106
+ hoz.setOpaque(false);
100
- hoz.add(new JLabel("", Icon.icon("shierologo"), JLabel.LEADING));
107
+ hoz.add(new JLabel("", Icon.icon("shierologo"), JLabel.LEADING));
101
- hoz.add(new JLabel("", Icon.icon("stexturepacker"), JLabel.LEADING));
108
+ hoz.add(new JLabel("", Icon.icon("stexturepacker"), JLabel.LEADING));
102
- popupContent.add(hoz);
109
+ popupContent.add(hoz);
103
- popupContent.setOpaque(false);
110
+ UIUtils.setUndecorated(popupContent, false);
111
+ UIUtils.setMargin(popupContent, new Insets(0,0,0,0));
112
+ UIUtils.setDrawSides(popupContent, false, false, false, false);
104
- menu.setContent (popupContent);
113
+ dialog.getContentPane().add(popupContent);
114
+ dialog.pack();
115
+ dialog.setSize(525, 500);
116
+ Dimension Size = Toolkit.getDefaultToolkit().getScreenSize();
117
+ dialog.setLocation(new Double((Size.getWidth()/2) - (dialog.getWidth()/2)).intValue(),
118
+ new Double((Size.getHeight()/2) - (dialog.getHeight()/2)).intValue());
119
+ dialog.setVisible(true);
120
+ }
121
+ }));
105
122
  }
106
123
 
107
124
  void initFile(){
@@ -212,10 +229,20 @@ final public class ToolBar extends JPanel {
212
229
  }
213
230
 
214
231
  void initOptions(){
232
+ optionsPanel = new OptionsPanel();
215
233
  add(Style.createToolPanel("Options", "options", new ActionListener(){
216
234
  @Override
217
235
  public void actionPerformed(ActionEvent e) {
236
+ JDialog dialog = new JDialog(Frame.getInstance(), "Options", false);
237
+ dialog.setResizable(false);
238
+ dialog.getContentPane().setLayout(new BorderLayout());
218
- Content.toggleOptions();
239
+ dialog.getContentPane().add(optionsPanel);
240
+ dialog.pack();
241
+ dialog.setSize(525, 500);
242
+ Dimension Size = Toolkit.getDefaultToolkit().getScreenSize();
243
+ dialog.setLocation(new Double((Size.getWidth()/2) - (dialog.getWidth()/2)).intValue(),
244
+ new Double((Size.getHeight()/2) - (dialog.getHeight()/2)).intValue());
245
+ dialog.setVisible(true);
219
246
  }
220
247
 
221
248
  }));
Panel/ActorPanel.java CHANGED
@@ -1,8 +1,13 @@
1
+ import java.awt.Dimension;
1
2
  import java.awt.event.ActionEvent;
2
3
 
3
4
  import javax.swing.JButton;
5
+ import javax.swing.JComboBox;
6
+ import javax.swing.JPanel;
4
7
  import javax.swing.event.ListSelectionEvent;
5
8
 
9
+ import web.laf.lite.widget.CenterPanel;
10
+
6
11
  import com.badlogic.gdx.scenes.scene2d.Actor;
7
12
 
8
13
  public class ActorPanel extends BaseList {
@@ -11,13 +16,21 @@ public class ActorPanel extends BaseList {
11
16
  String[] btns = new String[]{
12
17
  "Cut", "cut", "Copy", "copy", "Paste", "paste", "Delete", "trash"
13
18
  };
19
+ private JComboBox<String> groupCombo = BaseTable.createComboBox();
14
20
 
15
21
  public static Actor copiedActor = null;
22
+ public static Actor cutActor = null;
16
23
 
17
24
  public ActorPanel(){
18
25
  super("Actors", "");
19
- add(Style.createButtonToolBar(this, btns));
26
+ JPanel tools = Style.createButtonToolBar(this, btns);
27
+ groupCombo.addItem("Root");
28
+ groupCombo.setPreferredSize(new Dimension(90, 17));
29
+ tools.add(new CenterPanel(groupCombo, false, true));
30
+ add(tools);
20
31
  add(scrollPane);
32
+ if(Content.sceneFileExists())
33
+ setHeaderText(Content.getSceneFile());
21
34
  }
22
35
 
23
36
  public void addActor(String actorName){
@@ -33,6 +46,19 @@ public class ActorPanel extends BaseList {
33
46
  unlock();
34
47
  }
35
48
 
49
+ public void addGroup(String groupName){
50
+ groupCombo.addItem(groupName);
51
+ }
52
+
53
+ public void removeGroup(String groupName){
54
+ // must check for root
55
+ for(int i=0;i<groupCombo.getItemCount();i++)
56
+ if(groupCombo.getItemAt(i).equals(groupCombo.getSelectedItem())){
57
+ groupCombo.removeItem(groupName);
58
+ break;
59
+ }
60
+ }
61
+
36
62
  @Override
37
63
  public void clear(){
38
64
  lock();
@@ -61,21 +87,26 @@ public class ActorPanel extends BaseList {
61
87
  lock();
62
88
  switch(((JButton)e.getSource()).getToolTipText()){
63
89
  case "Cut":
64
- copiedActor = SceneEditor.selectedActor;
90
+ cutActor = SceneEditor.selectedActor;
91
+ copiedActor = null;
65
92
  listModel2.removeElement(SceneEditor.selectedActor.getName());
66
93
  Stage.removeActor(SceneEditor.selectedActor);
67
94
  break;
68
95
 
69
96
  case "Copy":
70
- //need to make new copy
71
- //copiedActor = selectedActor;
97
+ String line = Stage.json.toJson(SceneEditor.selectedActor);
98
+ copiedActor = Stage.json.fromJson(Actor.class, line);
99
+ cutActor = null;
72
100
  break;
73
101
 
74
102
  case "Paste":
103
+ if(cutActor != null){
104
+ Content.studioPanel.setName(cutActor);
105
+ cutActor = null;
106
+ }
75
107
  if(copiedActor != null){
108
+ copiedActor = Stage.json.fromJson(Actor.class, Stage.json.toJson(SceneEditor.selectedActor));
76
- copiedActor.setName(copiedActor.getName()+"1");
109
+ Content.studioPanel.setName(copiedActor);
77
- Stage.addActor(copiedActor, Stage.mouse.x, Stage.mouse.y);
78
- addActor(copiedActor.getName());
79
110
  }
80
111
  break;
81
112
 
@@ -87,4 +118,8 @@ public class ActorPanel extends BaseList {
87
118
  }
88
119
  unlock();
89
120
  }
121
+
122
+ public void setHeaderText(String text){
123
+ header.setText(text);
124
+ }
90
125
  }
Panel/BaseList.java CHANGED
@@ -8,6 +8,7 @@ import java.util.SortedSet;
8
8
  import java.util.TreeSet;
9
9
 
10
10
  import javax.swing.AbstractListModel;
11
+ import javax.swing.BorderFactory;
11
12
  import javax.swing.DefaultListModel;
12
13
  import javax.swing.JLabel;
13
14
  import javax.swing.JList;
@@ -19,7 +20,7 @@ import javax.swing.event.ListSelectionListener;
19
20
  import web.laf.lite.layout.VerticalFlowLayout;
20
21
  import web.laf.lite.utils.UIUtils;
21
22
 
22
- public abstract class BaseList extends JPanel implements ListSelectionListener, ActionListener {
23
+ public abstract class BaseList extends JPanel implements ListSelectionListener, ActionListener {
23
24
  private static final long serialVersionUID = 1L;
24
25
  protected JList<String> list;
25
26
  protected DefaultListModel<String> listModel;
@@ -35,12 +36,14 @@ public abstract class BaseList extends JPanel implements ListSelectionListener,
35
36
  list = new JList<String>(listModel);
36
37
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
37
38
  list.addListSelectionListener(this);
39
+ UIUtils.setDecorateSelection(list, false);
38
40
  header = new Style.TitleLabel(title);
39
41
  add(header);
40
42
  scrollPane = new JScrollPane(list);
41
43
  scrollPane.setPreferredSize(new Dimension(200, 175));
42
44
  UIUtils.setDrawBorder(scrollPane, false);
43
45
  add(scrollPane);
46
+ setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Style.border));
44
47
  }
45
48
 
46
49
  BaseList(String title, boolean dontAddScroll){
@@ -56,6 +59,7 @@ public abstract class BaseList extends JPanel implements ListSelectionListener,
56
59
  scrollPane = new JScrollPane(list);
57
60
  scrollPane.setPreferredSize(new Dimension(200, 175));
58
61
  UIUtils.setDrawBorder(scrollPane, false);
62
+ setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Style.border));
59
63
  }
60
64
 
61
65
  BaseList(String title, String... items){
@@ -72,6 +76,7 @@ public abstract class BaseList extends JPanel implements ListSelectionListener,
72
76
  scrollPane.setPreferredSize(new Dimension(200, 175));
73
77
  UIUtils.setDrawBorder(scrollPane, false);
74
78
  add(scrollPane);
79
+ setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Style.border));
75
80
  }
76
81
 
77
82
  @SuppressWarnings("unchecked")
@@ -88,6 +93,7 @@ public abstract class BaseList extends JPanel implements ListSelectionListener,
88
93
  scrollPane = new JScrollPane(list);
89
94
  scrollPane.setPreferredSize(new Dimension(200, 175));
90
95
  UIUtils.setDrawBorder(scrollPane, false);
96
+ setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Style.border));
91
97
  }
92
98
 
93
99
  public void enable(){
@@ -187,4 +193,4 @@ class SortedListModel extends AbstractListModel {
187
193
  }
188
194
  return removed;
189
195
  }
190
- }
196
+ }
Panel/BaseTable.java CHANGED
@@ -34,6 +34,8 @@ import javax.swing.table.DefaultTableCellRenderer;
34
34
  import javax.swing.table.DefaultTableModel;
35
35
  import javax.swing.table.TableCellEditor;
36
36
 
37
+ import com.badlogic.gdx.scenes.scene2d.Touchable;
38
+
37
39
  import web.laf.lite.layout.ToolbarLayout;
38
40
  import web.laf.lite.layout.VerticalFlowLayout;
39
41
  import web.laf.lite.utils.UIUtils;
@@ -71,7 +73,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
71
73
  };
72
74
  protected final JScrollPane scrollPane;
73
75
  protected final List<TableCellEditor> editors = new ArrayList<TableCellEditor>(3);
74
- public final JButton headerButton;
76
+ protected final JButton headerButton;
75
77
 
76
78
  public BaseTable(String title, DefaultTableModel model, DefaultTableCellRenderer renderer){
77
79
  super(new VerticalFlowLayout());
@@ -93,7 +95,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
93
95
  tableModel.setColumnCount(2);
94
96
  tableModel.addTableModelListener(this);
95
97
  clear();
96
- headerButton = Style.createHeaderButton(title, this);
98
+ headerButton = new Style.TitleButton(title, this);
97
99
  if(!title.isEmpty()){
98
100
  add(headerButton);
99
101
  }
@@ -161,6 +163,10 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
161
163
  }
162
164
  }
163
165
 
166
+
167
+ public void setProperty(String name, String value){
168
+ }
169
+
164
170
  public void updateProperty(String key, String value, int row){
165
171
  lock();
166
172
  tableModel.setValueAt(value, row, 1);
@@ -185,6 +191,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
185
191
  UIUtils.setShadeWidth(spinner, 0);
186
192
  UIUtils.setRound(spinner, 0);
187
193
  UIUtils.setDrawFocus(spinner, false);
194
+ spinner.setFocusable(false);
188
195
  return spinner;
189
196
  }
190
197
 
@@ -195,6 +202,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
195
202
  UIUtils.setShadeWidth(spinner, 0);
196
203
  UIUtils.setRound(spinner, 0);
197
204
  UIUtils.setDrawFocus(spinner, false);
205
+ spinner.setFocusable(false);
198
206
  return spinner;
199
207
  }
200
208
 
@@ -203,6 +211,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
203
211
  UIUtils.setShadeWidth(tf, 0);
204
212
  UIUtils.setRound(tf, 0);
205
213
  UIUtils.setDrawFocus(tf, false);
214
+ tf.setFocusable(false);
206
215
  return new DefaultCellEditor(tf);
207
216
  }
208
217
 
@@ -211,6 +220,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
211
220
  UIUtils.setShadeWidth(tf, 0);
212
221
  UIUtils.setRound(tf, 0);
213
222
  UIUtils.setDrawFocus(tf, false);
223
+ tf.setFocusable(false);
214
224
  return tf;
215
225
  }
216
226
 
@@ -219,6 +229,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
219
229
  UIUtils.setShadeWidth(tf, 0);
220
230
  UIUtils.setRound(tf, 0);
221
231
  UIUtils.setDrawFocus(tf, false);
232
+ tf.setFocusable(false);
222
233
  return new DefaultCellEditor(tf);
223
234
  }
224
235
 
@@ -227,6 +238,7 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
227
238
  UIUtils.setShadeWidth(combo, 0);
228
239
  UIUtils.setRound(combo, 0);
229
240
  UIUtils.setDrawFocus(combo, false);
241
+ combo.setFocusable(false);
230
242
  return combo;
231
243
  }
232
244
 
@@ -242,11 +254,13 @@ public abstract class BaseTable extends JPanel implements ActionListener, TableM
242
254
  return new DefaultCellEditor(new JComboBox<String>(new String[]{"false", "true"}));
243
255
  }
244
256
 
245
- public static TableCellEditor createCheckBoxEditor(){
257
+ public static DefaultCellEditor createTouchableEditor(){
258
+ return new DefaultCellEditor(new JComboBox<String>(new String[]{Touchable.enabled.toString()
246
- return new CheckBoxEditor();
259
+ , Touchable.disabled.toString(), Touchable.childrenOnly.toString()}));
247
260
  }
248
261
 
249
- public void setProperty(String name, String value){
262
+ public static TableCellEditor createCheckBoxEditor(){
263
+ return new CheckBoxEditor();
250
264
  }
251
265
  }
252
266
 
@@ -487,7 +501,6 @@ class SpinnerIntegerEditor extends AbstractCellEditor implements TableCellEditor
487
501
  public SpinnerIntegerEditor() {
488
502
  spinner = BaseTable.createSpinnerInteger();
489
503
  spinner.setBorder(BorderFactory.createEmptyBorder());
490
- // ((DefaultEditor) spinner.getEditor()).getTextField().setEnabled(false);
491
504
  ((DefaultEditor) spinner.getEditor()).getTextField().setEditable(false);
492
505
  }
493
506
 
Panel/ConsolePanel.java CHANGED
@@ -19,6 +19,7 @@ import javax.swing.SwingUtilities;
19
19
 
20
20
 
21
21
 
22
+
22
23
  import web.laf.lite.layout.VerticalFlowLayout;
23
24
  import web.laf.lite.utils.UIUtils;
24
25
 
@@ -42,7 +43,7 @@ public class ConsolePanel extends JPanel implements ActionListener {
42
43
  UIUtils.setMargin(this, new Insets(0,0,0,0));
43
44
  UIUtils.setUndecorated(this, true);
44
45
  consoleAreaPane.setPreferredSize(new Dimension(500, 250));
45
- add(Style.createHeaderButton("Console", this));
46
+ add(new Style.TitleButton("Console", this));
46
47
  setVisible(false);
47
48
  add(consoleAreaPane);
48
49
  if(Content.projectExists())
Panel/DashPanel.java CHANGED
@@ -11,6 +11,7 @@ import javax.swing.JPanel;
11
11
  import javax.swing.JScrollPane;
12
12
 
13
13
  import com.badlogic.gdx.Gdx;
14
+
14
15
  import web.laf.lite.layout.VerticalFlowLayout;
15
16
  import web.laf.lite.utils.UIUtils;
16
17
 
@@ -27,7 +28,7 @@ public class DashPanel extends JPanel {
27
28
  UIUtils.setShadeWidth(this, 0);
28
29
  UIUtils.setRound(this, 0);
29
30
  setBackground(Color.black);
30
- add(Style.createHeaderButton("DashBoard", null));
31
+ add(new Style.TitleButton("DashBoard", null));
31
32
  label = new JLabel();
32
33
  label.setBackground(Color.black);
33
34
  label.setVerticalTextPosition(JLabel.CENTER);
Panel/EffectPanel.java CHANGED
@@ -1,6 +1,8 @@
1
1
  import javax.swing.DefaultCellEditor;
2
2
  import javax.swing.JComboBox;
3
3
 
4
+ import web.laf.lite.utils.UIUtils;
5
+
4
6
 
5
7
  public class EffectPanel extends BaseTable {
6
8
  private static final long serialVersionUID = 1L;
@@ -21,6 +23,7 @@ public class EffectPanel extends BaseTable {
21
23
 
22
24
  public EffectPanel(){
23
25
  super("Effects");
26
+ UIUtils.setUndecorated(this, true);
24
27
  editors.add(new DefaultCellEditor(effectComboBox));
25
28
  editors.add(createNumberField());
26
29
  editors.add(new DefaultCellEditor(durationComboBox));
Panel/OptionsPanel.java CHANGED
@@ -1,24 +1,28 @@
1
- import java.awt.Color;
2
1
  import java.awt.Component;
3
2
  import java.awt.Font;
4
3
  import java.awt.event.ActionEvent;
5
4
  import java.awt.event.ActionListener;
5
+ import java.io.File;
6
6
 
7
7
  import javax.swing.BorderFactory;
8
+ import javax.swing.JButton;
8
9
  import javax.swing.JComboBox;
9
10
  import javax.swing.JLabel;
11
+ import javax.swing.JOptionPane;
10
12
  import javax.swing.JPanel;
11
13
  import javax.swing.SpringLayout;
14
+
12
- import javax.swing.border.TitledBorder;
15
+ import com.badlogic.gdx.tools.imagepacker.TexturePacker2;
16
+ import com.badlogic.gdx.tools.imagepacker.TexturePacker2.Settings;
13
17
 
14
18
  import web.laf.lite.layout.HorizontalFlowLayout;
15
19
  import web.laf.lite.layout.ToolbarLayout;
16
20
  import web.laf.lite.layout.VerticalFlowLayout;
17
21
  import web.laf.lite.popup.AlignPanel;
18
22
  import web.laf.lite.utils.SpringUtils;
23
+ import web.laf.lite.utils.UIUtils;
19
24
  import web.laf.lite.widget.WebSwitch;
20
25
 
21
-
22
26
  public class OptionsPanel extends JPanel implements ActionListener {
23
27
  private static final long serialVersionUID = 1L;
24
28
  JPanel row1 = new JPanel(new HorizontalFlowLayout());
@@ -26,22 +30,23 @@ public class OptionsPanel extends JPanel implements ActionListener {
26
30
  JPanel content1 = new JPanel(new VerticalFlowLayout());
27
31
  JPanel content2 = new JPanel(new VerticalFlowLayout());
28
32
 
33
+ JPanel conten34Border = new JPanel(new VerticalFlowLayout());
29
34
  JPanel content34 = new JPanel(new HorizontalFlowLayout());
30
35
  JPanel content3 = new JPanel(new VerticalFlowLayout());
31
36
  JPanel content4 = new JPanel(new VerticalFlowLayout());
37
+
38
+ JPanel conten5Border = new JPanel(new VerticalFlowLayout());
32
39
  JPanel content5 = new JPanel(new SpringLayout());
40
+
41
+ JButton packButton;
33
42
 
34
43
  public OptionsPanel(){
35
- super(new VerticalFlowLayout());
44
+ super(new VerticalFlowLayout(0, 10));
45
+ UIUtils.setUndecorated(this, true);
46
+ createHeader(content1, "ToolBar");
47
+ createHeader(content2, "SearchBar");
36
- Font font = new JLabel().getFont().deriveFont(Font.BOLD, 12);
48
+ createHeader(conten34Border, "Editor");
37
- content1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
49
+ createHeader(conten5Border, "Texture Packer");
38
- "ToolBar", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font));
39
- content2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
40
- "SearchBar", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font));
41
- content34.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
42
- "Editor", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font));
43
- content5.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),
44
- "Texture Packer", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font));
45
50
  WebSwitch left = new WebSwitch();
46
51
  WebSwitch right = new WebSwitch();
47
52
  WebSwitch status = new WebSwitch();
@@ -119,8 +124,9 @@ public class OptionsPanel extends JPanel implements ActionListener {
119
124
  menuItem(content4,codeFold, "Code Folding");
120
125
  menuItem(content4,showWhitespaces, "Show WhiteSpace");
121
126
  content34.add(content4);
122
- row1.add(content34);
123
127
  add(row1);
128
+ conten34Border.add(content34);
129
+ add(conten34Border);
124
130
 
125
131
  createRow(content5, "Encoding Format", new JComboBox<String>(new String[]{"RGBA8888", "RGBA4444", "RGB888", "RGB565",
126
132
  "Alpha", "LuminanceAlpha", "Intensity"}));
@@ -152,8 +158,30 @@ public class OptionsPanel extends JPanel implements ActionListener {
152
158
  createRow(content5, "ClampY", new JComboBox<String>());
153
159
 
154
160
  SpringUtils.makeCompactGrid(content5, 6, 4, 10, 0, 10, 5);
161
+ conten5Border.add(content5);
155
- add(content5);
162
+ add(conten5Border);
163
+
156
-
164
+ packButton = new JButton("Pack All Textures");
165
+ packButton.addActionListener(new ActionListener(){
166
+ @Override
167
+ public void actionPerformed(ActionEvent arg0) {
168
+ Settings settings = new Settings();
169
+ settings.maxWidth = 2048;
170
+ settings.maxHeight = 2048;
171
+ settings.paddingX = 0;
172
+ settings.paddingY = 0;
173
+ TexturePacker2.process(settings, Content.getProject()+File.separator+"pack",
174
+ Content.getProject()+"atlas/", "pack.atlas");
175
+ for(File f: new File(Content.getProject()+File.separator+"pack").listFiles()){
176
+ if(f.isDirectory()){
177
+ TexturePacker2.process(settings, f.getPath(), Content.getProject()+"atlas/", f.getName());
178
+ JOptionPane.showMessageDialog(null, "Packed Texture: "+f.getName(), "Texture Packer",
179
+ JOptionPane.INFORMATION_MESSAGE);
180
+ }
181
+ }
182
+ }
183
+ });
184
+ add(packButton);
157
185
  // add(menuItem(tabSlider, "Tab Size"));
158
186
  //setMarginLineColor(Color.black);
159
187
  //setMarkOccurrences(true);
@@ -206,7 +234,6 @@ public class OptionsPanel extends JPanel implements ActionListener {
206
234
  Content.editor.setWhitespaceVisible(showWhitespaces.isSelected());
207
235
  }
208
236
  });
209
- setVisible(false);
210
237
  }
211
238
 
212
239
  void createRow(JPanel content, String title, Component b){
@@ -221,12 +248,19 @@ public class OptionsPanel extends JPanel implements ActionListener {
221
248
 
222
249
  void menuItem(JPanel content, final WebSwitch sw, String text){
223
250
  final JLabel label = new JLabel(" "+text);
251
+ label.setFont(label.getFont().deriveFont(Font.BOLD));
224
252
  JPanel pan = new JPanel(new ToolbarLayout());
225
253
  pan.setOpaque(false);
226
254
  pan.add(label, ToolbarLayout.START);
227
255
  pan.add(sw, ToolbarLayout.END);
228
256
  content.add(pan);
229
257
  }
258
+
259
+ void createHeader(JPanel content, String title){
260
+ //content.setBackground(Color.white);
261
+ content.add(new Style.TitleLabel(title));
262
+ content.setBorder(BorderFactory.createLineBorder(Style.border));
263
+ }
230
264
 
231
265
  @Override
232
266
  public void actionPerformed(ActionEvent e) {
Panel/ProjectPanel.java CHANGED
@@ -1,11 +1,13 @@
1
1
  import java.awt.Color;
2
2
  import java.awt.Dimension;
3
+ import java.awt.Insets;
3
4
  import java.awt.event.ActionEvent;
4
5
  import java.awt.event.ActionListener;
5
6
  import java.io.File;
6
7
  import java.util.ArrayList;
7
8
  import java.util.List;
8
9
 
10
+ import javax.swing.BorderFactory;
9
11
  import javax.swing.DefaultCellEditor;
10
12
  import javax.swing.ImageIcon;
11
13
  import javax.swing.JButton;
@@ -59,7 +61,7 @@ public class ProjectPanel extends JPanel implements ActionListener, TableModelLi
59
61
  }
60
62
  };
61
63
 
62
- JButton moreBtn = new JButton("More");
64
+ JButton moreBtn;
63
65
  static JLabel prjIcon = new JLabel();
64
66
  static List<TableCellEditor> editors = new ArrayList<TableCellEditor>(3);
65
67
  static JTextField versionField = new JTextField();
@@ -72,8 +74,10 @@ public class ProjectPanel extends JPanel implements ActionListener, TableModelLi
72
74
 
73
75
  public ProjectPanel(){
74
76
  super(new VerticalFlowLayout());
77
+ UIUtils.setUndecorated(this, true);
75
78
  UIUtils.setShadeWidth(this, 0);
76
79
  UIUtils.setRound(this, 0);
80
+ UIUtils.setDrawSides(this, false, false, false, false);
77
81
  propTable.setTableHeader(null);
78
82
  propTable.setDefaultRenderer(String.class, new BaseRenderer());
79
83
  propTable.setShowGrid(true);
@@ -89,16 +93,28 @@ public class ProjectPanel extends JPanel implements ActionListener, TableModelLi
89
93
  scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
90
94
  scrollPane.setPreferredSize(new Dimension(168, 48));
91
95
  UIUtils.setDrawBorder(scrollPane, false);
92
- add(Style.createHeaderButton("Project", this));
96
+ add(new Style.TitleButton("Project", this));
93
97
  JPanel hoz1 = new JPanel(new HorizontalFlowLayout(0));
94
- UIUtils.setUndecorated(hoz1, true);
95
98
  hoz1.setBackground(Color.black);
96
99
  hoz1.add(prjIcon);
97
100
  hoz1.add(scrollPane);
98
101
  add(hoz1);
102
+ moreBtn = new JButton("More");
99
103
  UIUtils.setUndecorated(moreBtn, true);
100
104
  UIUtils.setShadeWidth(moreBtn, 0);
105
+ UIUtils.setDrawFocus(moreBtn, false);
106
+ UIUtils.setRound(moreBtn, 0);
107
+ UIUtils.setRolloverDecoratedOnly(moreBtn, true);
108
+ moreBtn.setOpaque(false);
109
+ //moreBtn.setPreferredSize(new Dimension(100, 20));
110
+ JPanel p = new JPanel();
111
+ p.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Style.border));
112
+ //p.setPreferredSize(new Dimension(200, 20));
113
+ UIUtils.setUndecorated(p, true);
114
+ UIUtils.setMargin(p, new Insets(0,0,0,0));
115
+ UIUtils.setMargin(moreBtn, new Insets(0,0,0,0));
101
- add(moreBtn);
116
+ p.add(moreBtn);
117
+ add(p);
102
118
  if(Content.projectExists())
103
119
  update();
104
120
  propModel.addTableModelListener(this);
Panel/PropertyPanel.java CHANGED
@@ -14,6 +14,7 @@ import web.laf.lite.utils.UIUtils;
14
14
 
15
15
  import com.badlogic.gdx.graphics.Color;
16
16
  import com.badlogic.gdx.scenes.scene2d.Actor;
17
+ import com.badlogic.gdx.scenes.scene2d.Touchable;
17
18
  import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
18
19
  import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
19
20
  import com.badlogic.gdx.scenes.scene2d.ui.Label;
@@ -29,16 +30,22 @@ public class PropertyPanel extends BaseTable {
29
30
  JComboBox<String> texcombo = createComboBox();
30
31
 
31
32
  static int rowCount = 0;
33
+ static int noOfRows = 16;
32
34
 
33
35
  public PropertyPanel(){
34
36
  super("Properties", null, new PropertyRenderer());
35
- editors.add(createTextFieldEditor());
37
+ editors.add(createTextFieldEditor()); //Name
36
38
  editors.add(createIntegerSpinner("X"));
37
39
  editors.add(createIntegerSpinner("Y"));
38
40
  editors.add(createIntegerSpinner("Width"));
39
41
  editors.add(createIntegerSpinner("Height"));
42
+ editors.add(createIntegerSpinner("OriginX"));
43
+ editors.add(createIntegerSpinner("OriginY"));
44
+ editors.add(createIntegerSpinner("Rotation"));
40
45
  editors.add(createIntegerSpinner("Z-Index"));
41
46
  editors.add(new ColorEditor());
47
+ editors.add(createTouchableEditor()); //Touchable
48
+ editors.add(createBooleanEditor()); //Visible
42
49
  editors.add(createTextFieldEditor());
43
50
  editors.add(createTextFieldEditor());
44
51
  editors.add(createTextFieldEditor());
@@ -58,7 +65,7 @@ public class PropertyPanel extends BaseTable {
58
65
 
59
66
  @Override
60
67
  public void clear(String... names){
61
- super.clear("Name", "X", "Y", "Width", "Height", "Z-Index", "Color", "", "", "", "");
68
+ super.clear("Name", "X", "Y", "Width", "Height", "OriginX", "OriginY", "Rotation", "Z-Index", "Color", "Touchable", "Visible", "", "", "", "");
62
69
  }
63
70
 
64
71
  @Override
@@ -66,12 +73,17 @@ public class PropertyPanel extends BaseTable {
66
73
  rowCount = 0;
67
74
  super.update("Name", ""+SceneEditor.selectedActor.getName(), "X", ""+(int)SceneEditor.selectedActor.getX(),
68
75
  "Y", ""+(int)SceneEditor.selectedActor.getY(), "Width", ""+(int)SceneEditor.selectedActor.getWidth(),
69
- "Height", ""+(int)SceneEditor.selectedActor.getHeight(),"Z-Index", ""+(int)SceneEditor.selectedActor.getZIndex(),
76
+ "Height", ""+(int)SceneEditor.selectedActor.getHeight(), "OriginX",""+(int)SceneEditor.selectedActor.getOriginX(),
77
+ "OriginY",""+(int)SceneEditor.selectedActor.getOriginY(),"Rotation",""+(int)SceneEditor.selectedActor.getRotation(),
78
+ "Z-Index", ""+(int)SceneEditor.selectedActor.getZIndex(),
70
- "Color", ""+SceneEditor.selectedActor.getColor().toString());
79
+ "Color", ""+SceneEditor.selectedActor.getColor().toString(),
80
+ "Touchable", ""+SceneEditor.selectedActor.getTouchable().toString(),
71
- editors.set(7, createTextFieldEditor());
81
+ "Visible", ""+SceneEditor.selectedActor.isVisible()
72
- editors.set(8, createTextFieldEditor());
82
+ );
73
- editors.set(9, createTextFieldEditor());
74
- editors.set(10, createTextFieldEditor());
83
+ editors.set(12, createTextFieldEditor());
84
+ editors.set(13, createTextFieldEditor());
85
+ editors.set(14, createTextFieldEditor());
86
+ editors.set(15, createTextFieldEditor());
75
87
 
76
88
  /* From here it varies for each type */
77
89
  if(SceneEditor.selectedActor instanceof ImageJson){
@@ -79,7 +91,7 @@ public class PropertyPanel extends BaseTable {
79
91
  texcombo.removeAllItems();
80
92
  for(String tex: Asset.texMap.keys())
81
93
  texcombo.addItem(tex);
82
- editors.set(7, new DefaultCellEditor(texcombo));
94
+ editors.set(12, new DefaultCellEditor(texcombo));
83
95
  }
84
96
 
85
97
  /* FONTS */
@@ -89,7 +101,7 @@ public class PropertyPanel extends BaseTable {
89
101
  fontcombo.removeAllItems();
90
102
  for(String font: Asset.fontMap.keys())
91
103
  fontcombo.addItem(font);
92
- editors.set(7, new DefaultCellEditor(fontcombo));
104
+ editors.set(12, new DefaultCellEditor(fontcombo));
93
105
  }
94
106
 
95
107
  if(SceneEditor.selectedActor instanceof TextButton){
@@ -105,9 +117,9 @@ public class PropertyPanel extends BaseTable {
105
117
  addRow("Text", ""+((CheckBox)SceneEditor.selectedActor).getText());
106
118
 
107
119
  if(SceneEditor.selectedActor instanceof Dialog){
108
- editors.set(7, createBooleanEditor());
120
+ editors.set(12, createBooleanEditor());
109
- editors.set(8, createBooleanEditor());
121
+ editors.set(13, createBooleanEditor());
110
- editors.set(9, createBooleanEditor());
122
+ editors.set(14, createBooleanEditor());
111
123
  addRow("Modal", ""+((Dialog)SceneEditor.selectedActor).isModal()); //7
112
124
  addRow("Moveble", ""+((Dialog)SceneEditor.selectedActor).isMovable()); //8
113
125
  addRow("Resizable", ""+((Dialog)SceneEditor.selectedActor).isResizable()); //9
@@ -128,15 +140,15 @@ public class PropertyPanel extends BaseTable {
128
140
  }
129
141
  if(SceneEditor.selectedActor instanceof Sprite){
130
142
  Sprite sprite = ((Sprite)SceneEditor.selectedActor);
131
- editors.set(7, createBooleanEditor());
143
+ editors.set(12, createBooleanEditor());
132
- editors.set(8, createBooleanEditor());
144
+ editors.set(13, createBooleanEditor());
133
145
  addRow("Active", ""+sprite.isAnimationActive);
134
146
  addRow("Looping", ""+sprite.isAnimationLooping);
135
147
  addRow("Duration", ""+sprite.getDuration());
136
148
  addRow("Textures", ""+sprite.toString());
137
149
  }
138
150
  int value = getRowCount();
139
- for(int i=0;i<11-value;i++)
151
+ for(int i=0;i<noOfRows-value;i++)
140
152
  addRow("", "");
141
153
  }
142
154
 
@@ -162,13 +174,25 @@ public class PropertyPanel extends BaseTable {
162
174
  case "Y": SceneEditor.selectedActor.setY(Float.parseFloat(value));break;
163
175
  case "Width": SceneEditor.selectedActor.setWidth(Float.parseFloat(value));break;
164
176
  case "Height": SceneEditor.selectedActor.setHeight(Float.parseFloat(value));break;
177
+ case "OriginX": SceneEditor.selectedActor.setOriginX(Float.parseFloat(value));break;
178
+ case "OriginY": SceneEditor.selectedActor.setOriginY(Float.parseFloat(value));break;
179
+ case "Rotation": SceneEditor.selectedActor.setRotation(Float.parseFloat(value));break;
165
180
  case "Z-Index":
166
181
  int z = Integer.parseInt(value);
167
- //if(z<0)
168
- // updateProperty("Z-Index", ""+SceneEditor.selectedActor.getZIndex(), 0);
182
+ if(!(z<0) && !(z>Stage.getRoot().getChildren().size))
169
- //else
170
183
  SceneEditor.selectedActor.setZIndex(z);
184
+ else
185
+ updateProperty("Z-Index", ""+SceneEditor.selectedActor.getZIndex(), 0);
171
186
  break;
187
+ case "Color":
188
+ if(value.length() == 8 && value.matches("[0-9A-Fa-f]+"))
189
+ SceneEditor.selectedActor.setColor(Color.valueOf(value));
190
+ break;
191
+ case "Touchable":SceneEditor.selectedActor.setTouchable(Touchable.valueOf(value));break;
192
+ case "Visible":SceneEditor.selectedActor.setVisible(Boolean.parseBoolean(value));break;
193
+
194
+
195
+
172
196
  case "Text":
173
197
  if(SceneEditor.selectedActor instanceof Label){
174
198
  ((Label)SceneEditor.selectedActor).setText(value);
@@ -190,11 +214,6 @@ public class PropertyPanel extends BaseTable {
190
214
  }
191
215
  break;
192
216
 
193
- case "Color":
194
- if(value.length() == 8 && value.matches("[0-9A-Fa-f]+"))
195
- SceneEditor.selectedActor.setColor(Color.valueOf(value));
196
- break;
197
-
198
217
  // TextField Related Properties
199
218
  case "MessageText": ((TextField)SceneEditor.selectedActor).setMessageText(value);break;
200
219
  case "Password": ((TextField)SceneEditor.selectedActor).setPasswordMode(Boolean.parseBoolean(value));break;
@@ -261,6 +280,7 @@ public class PropertyPanel extends BaseTable {
261
280
  break;
262
281
  }
263
282
  SceneEditor.isDirty = true;
283
+ Stage.outline(SceneEditor.selectedActor);
264
284
  Frame.dashPanel.update();
265
285
  }
266
286
 
@@ -273,7 +293,7 @@ public class PropertyPanel extends BaseTable {
273
293
  case "Y": super.updateProperty(key, value, 2);break;
274
294
  case "Width": super.updateProperty(key, value, 3);break;
275
295
  case "Height": super.updateProperty(key, value, 4);break;
276
- case "Z-Index": super.updateProperty(key, value, 5);break;
296
+ case "Z-Index": super.updateProperty(key, value, 8);break;
277
297
  }
278
298
  }
279
299
  }
@@ -290,18 +310,23 @@ class PropertyRenderer extends BaseRenderer {
290
310
  checkBox.setHorizontalAlignment(JLabel.CENTER);
291
311
  return checkBox;
292
312
  }*/
313
+ //try {
314
+ Boolean.parseBoolean(value.toString());
315
+ // } catch ( java.text.ParseException e ) {
316
+ // e.printStackTrace();
317
+ // }
293
318
  setBorder(noFocusBorder);
294
319
  if(column == 0)
295
320
  return new HeaderLabel(value.toString());
296
321
  else {
297
- if(row >= 1 && row <=5){
322
+ if(row >= 1 && row <=8){
298
323
  if(!value.toString().isEmpty())
299
- spinnerInteger.setValue((Integer)Integer.parseInt(value.toString()));
324
+ spinnerInteger.setValue((int)Float.parseFloat(value.toString()));
300
325
  else
301
326
  spinnerInteger.setValue(new Integer(0));
302
327
  return spinnerInteger;
303
328
  }
304
- if(row == 6){
329
+ if(row == 9){
305
330
  label.setOpaque(true);
306
331
  label.setBorder(BorderFactory.createLineBorder(java.awt.Color.gray));
307
332
  String colorString = (String) value;
Panel/ReplacePanel.java CHANGED
@@ -4,10 +4,11 @@ import javax.swing.JPanel;
4
4
  import javax.swing.JTextField;
5
5
 
6
6
  import web.laf.lite.layout.HorizontalFlowLayout;
7
+ import web.laf.lite.utils.UIUtils;
7
8
 
8
9
  public class ReplacePanel extends JPanel {
9
10
  private static final long serialVersionUID = 1L;
10
- private JButton findButton = new JButton("Find");
11
+ //private JButton findButton = new JButton("Find");
11
12
  private JTextField replaceField = new JTextField();
12
13
  private JButton replaceButton = new JButton("Replace");
13
14
  private JButton replaceFindButton = new JButton("Replace/Find");
@@ -15,6 +16,7 @@ public class ReplacePanel extends JPanel {
15
16
 
16
17
  public ReplacePanel(){
17
18
  super(new HorizontalFlowLayout());
19
+ UIUtils.setUndecorated(this, true);
18
20
  add(new JLabel("Replace With:"));
19
21
  add(replaceField);
20
22
  add(replaceButton);
Panel/SceneEffectPanel.java CHANGED
@@ -41,9 +41,12 @@ public class SceneEffectPanel extends BaseTable {
41
41
 
42
42
  @Override
43
43
  public void update(String... values){
44
+ if(Stage.getScene() == null)
45
+ return;
46
+ Scene scene = Stage.getScene();
44
- super.update("Background", Scene.sceneBackground, "Music", Scene.sceneMusic,
47
+ super.update("Background", scene.sceneBackground, "Music", scene.sceneMusic,
45
- "Transition", Scene.sceneTransition, "Duration", ""+Scene.sceneDuration,
48
+ "Transition", scene.sceneTransition, "Duration", ""+scene.sceneDuration,
46
- "Interpolation", Scene.sceneInterpolationType.toString());
49
+ "Interpolation", scene.sceneInterpolationType.toString());
47
50
  bgComboBox.removeAllItems();
48
51
  musicComboBox.removeAllItems();
49
52
  bgComboBox.addItem("None");
@@ -58,36 +61,38 @@ public class SceneEffectPanel extends BaseTable {
58
61
  public void setProperty(String key, String value){
59
62
  if(key.isEmpty() || value.isEmpty())
60
63
  return ;
64
+ if(Stage.getScene() == null)
65
+ return;
66
+ Scene scene = Stage.getScene();
61
67
  switch(key){
62
68
  case "Background":
63
- Scene.sceneBackground = value;
69
+ scene.sceneBackground = value;
64
- if(!Scene.sceneBackground.equals("None"))
70
+ if(!scene.sceneBackground.equals("None"))
65
- Stage.setBackground(Scene.sceneBackground);
71
+ Stage.setBackground(scene.sceneBackground);
66
72
  else
67
73
  Stage.removeBackground();
68
74
  break;
69
75
  case "Music":
70
- Scene.sceneMusic = value;
76
+ scene.sceneMusic = value;
71
- if(!Scene.sceneMusic.equals("None"))
77
+ if(!scene.sceneMusic.equals("None"))
72
- Asset.musicPlay(Scene.sceneMusic);
78
+ Asset.musicPlay(scene.sceneMusic);
73
79
  break;
74
80
  case "Transition":
75
- Scene.sceneTransition = value;
81
+ scene.sceneTransition = value;
82
+ Effect.transition(TransitionType.valueOf(scene.sceneTransition),
83
+ Stage.getRoot(),scene.sceneDuration, scene.sceneInterpolationType);
76
- doTransition();break;
84
+ break;
77
85
  case "Duration":
78
- Scene.sceneDuration = Float.parseFloat(value);
86
+ scene.sceneDuration = Float.parseFloat(value);
79
- doTransition();
87
+ Effect.transition(TransitionType.valueOf(scene.sceneTransition),
88
+ Stage.getRoot(),scene.sceneDuration, scene.sceneInterpolationType);
80
89
  break;
81
90
  case "Interpolation":
82
- Scene.sceneInterpolationType = InterpolationType.valueOf(value);
91
+ scene.sceneInterpolationType = InterpolationType.valueOf(value);
83
- doTransition();
92
+ Effect.transition(TransitionType.valueOf(scene.sceneTransition),
93
+ Stage.getRoot(),scene.sceneDuration, scene.sceneInterpolationType);
84
94
  break;
85
95
  }
86
96
  SceneEditor.isDirty = true;
87
97
  }
88
-
89
- void doTransition(){
90
- Effect.transition(TransitionType.valueOf(Scene.sceneTransition),
91
- Stage.getRoot(),Scene.sceneDuration, Scene.sceneInterpolationType);
92
- }
93
98
  }
Panel/ScenePanel.java CHANGED
@@ -1,4 +1,7 @@
1
+ import java.awt.Cursor;
2
+ import java.awt.Dimension;
1
3
  import java.awt.event.ActionEvent;
4
+ import java.awt.event.ActionListener;
2
5
  import java.awt.event.ItemEvent;
3
6
  import java.awt.event.ItemListener;
4
7
  import java.io.File;
@@ -10,33 +13,42 @@ import javax.swing.JButton;
10
13
  import javax.swing.JComboBox;
11
14
  import javax.swing.JOptionPane;
12
15
  import javax.swing.JPanel;
13
- import javax.swing.JTextField;
16
+ import javax.swing.Timer;
14
17
  import javax.swing.event.ListSelectionEvent;
15
18
 
16
19
  import web.laf.lite.widget.CenterPanel;
17
20
 
18
- import com.badlogic.gdx.Gdx;
19
21
  import com.badlogic.gdx.scenes.scene2d.Actor;
20
22
  import com.badlogic.gdx.scenes.scene2d.EventListener;
23
+ import com.badlogic.gdx.scenes.scene2d.InputEvent;
24
+ import com.badlogic.gdx.scenes.scene2d.ui.List;
25
+ import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
26
+ import com.badlogic.gdx.scenes.scene2d.ui.Table;
27
+ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
28
+ import com.badlogic.gdx.scenes.scene2d.ui.TextField;
29
+ import com.badlogic.gdx.scenes.scene2d.utils.Align;
30
+ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
21
- import com.badlogic.gdx.utils.ArrayMap;
31
+ import com.badlogic.gdx.utils.Array;
22
- import com.badlogic.gdx.utils.JsonValue;
32
+ import com.badlogic.gdx.utils.Timer.Task;
23
- import com.badlogic.gdx.utils.StringBuilder;
24
- import com.sun.xml.internal.ws.util.StringUtils;
25
33
 
26
34
  final public class ScenePanel extends BaseList {
27
35
  private static final long serialVersionUID = 1L;
28
-
29
- private final static JTextField addField = new JTextField ();
30
36
 
31
- public static JComboBox<String> stateComboBox = new JComboBox<String>(new String[]{
37
+ public static JComboBox<String> stateComboBox = BaseTable.createComboBox("Scenes", "Maps", "Actors");
32
- "Scenes", "Maps", "Actors"
33
- });
34
38
  private static JButton addscene, updown ,delete, resume, pause;
35
39
 
36
40
  private static SceneState currentState = SceneState.SceneEditor;
41
+ private final Timer saveTimer = new Timer(10000, new ActionListener(){
42
+ @Override
43
+ public void actionPerformed(ActionEvent arg0) {
44
+ save();
45
+ }
46
+ });
37
47
 
38
48
  public ScenePanel(){
39
49
  super("Scenes", true);
50
+ saveTimer.start();
51
+ Serializer.registerSerializer(SceneEditor.class, new Serializer.SceneSerializer());
40
52
  initToolBar();
41
53
  add(scrollPane);
42
54
  stateComboBox.addItemListener(new ItemListener(){
@@ -55,17 +67,18 @@ final public class ScenePanel extends BaseList {
55
67
 
56
68
  void initToolBar(){
57
69
  JPanel tools = Style.createButtonToolBarPanel();
58
- addscene = Style.createExplorerToolPopButton("New Scene", "newfile", addField, this);
70
+ addscene = Style.createToolButton("New Scene", "newfile", this);
59
- updown = Style.createExplorerToolButton("ScenePriority", "updown", this);
71
+ updown = Style.createToolButton("ScenePriority", "updown", this);
60
- delete = Style.createExplorerToolButton("Delete", "trash", this);
72
+ delete = Style.createToolButton("Delete", "trash", this);
61
- resume = Style.createExplorerToolButton("Resume", "resume", this);
73
+ resume = Style.createToolButton("Resume", "resume", this);
62
- pause = Style.createExplorerToolButton("Pause", "pause", this);
74
+ pause = Style.createToolButton("Pause", "pause", this);
63
75
  pause.setEnabled(false);
64
76
  tools.add(addscene);
65
77
  tools.add(updown);
66
78
  tools.add(delete);
67
79
  tools.add(resume);
68
80
  tools.add(pause);
81
+ stateComboBox.setPreferredSize(new Dimension(65, 17));
69
82
  tools.add(new CenterPanel(stateComboBox, false, true));
70
83
  add(tools);
71
84
  }
@@ -76,9 +89,10 @@ final public class ScenePanel extends BaseList {
76
89
  listModel.clear();
77
90
  for(String s: Scene.scenesMap.keys())
78
91
  listModel.addElement(s);
79
- if(Content.sceneFileExists())
92
+ if(Content.sceneFileExists()){
80
93
  if(listModel.contains(Content.getSceneFile()))
81
94
  list.setSelectedIndex(listModel.indexOf(Content.getSceneFile()));
95
+ }
82
96
  if(!Content.sceneFileExists())
83
97
  if(listModel.get(0) != null || !listModel.get(0).isEmpty()){
84
98
  Content.setSceneFile(listModel.get(0));
@@ -90,10 +104,12 @@ final public class ScenePanel extends BaseList {
90
104
  }
91
105
 
92
106
  private void createSceneFile(){
107
+ String text = JOptionPane.showInputDialog(Frame.getInstance(), "Create a New Scene", "New Scene",
108
+ JOptionPane.OK_CANCEL_OPTION);
93
- if(addField.getText() == null || addField.getText().isEmpty())
109
+ if(text == null || text.isEmpty())
94
110
  return;
95
- String name = addField.getText().replace(".json", "").replace(".java", "");
111
+ String name = text.replace(".json", "").replace(".java", "");
96
- name = StringUtils.capitalize(name);
112
+ name = Stage.capitalize(name);
97
113
  if(listModel.contains(name)){
98
114
  JOptionPane.showConfirmDialog(null, "Error: File already exists: "+name, "Error",
99
115
  JOptionPane.OK_OPTION);
@@ -106,7 +122,6 @@ final public class ScenePanel extends BaseList {
106
122
  Scene.scenesMap.put(name, "");
107
123
  Frame.eventPanel.update();
108
124
  }
109
- addField.setText("");
110
125
  list.setSelectedIndex(listModel.indexOf(name));
111
126
  SceneEditor.isDirty = true;
112
127
  save();
@@ -213,6 +228,7 @@ final public class ScenePanel extends BaseList {
213
228
  return;
214
229
  if(resume.isEnabled())
215
230
  runStudio();
231
+ Frame.actorPanel.setHeaderText(list.getSelectedValue());
216
232
  }
217
233
  }
218
234
 
@@ -229,20 +245,21 @@ final public class ScenePanel extends BaseList {
229
245
  public void showStudio(){
230
246
  Frame.actorPanel.clear();
231
247
  Stage.getRoot().clearChildren();
232
- Stage.clearAllListeners();
248
+ Stage.clearAllHud();
233
249
  Stage.followActor(null);
234
250
  Stage.resetCamera();
235
- if(Content.sceneFileExists())
251
+ if(Content.sceneFileExists()){
236
- load(Content.getSceneFile());
252
+ //load(Content.getSceneFile());
253
+ Stage.getScene().load(Content.getSceneFile());
237
- for(Actor child: Stage.getChildren()){
254
+ for(Actor child: Stage.getChildren()){
238
- if(child.getName() != null)
255
+ if(Stage.isValidActor(child)){
239
- Frame.actorPanel.addActor(child.getName());
256
+ Frame.actorPanel.addActor(child.getName());
240
- for(EventListener l: child.getListeners())
257
+ for(EventListener l: child.getListeners())
241
- child.removeListener(l);
258
+ child.removeListener(l);
259
+ }
260
+ }
242
261
  }
243
262
  Frame.sceneEffectPanel.update();
244
- if(Stage.getScene() != null)
245
- Stage.addActor(Stage.getScene());
246
263
  }
247
264
 
248
265
  private static File classPath = new File(Content.getProject()+"bin/");
@@ -260,46 +277,263 @@ final public class ScenePanel extends BaseList {
260
277
  }
261
278
  }
262
279
 
263
- public static void load(String sceneName){
264
- Main.log("Load");
265
- String[] lines = Scene.scenesMap.get(sceneName).split("\n");
266
- for(String line: lines){
267
- if(line.trim().isEmpty())
268
- continue;
269
- JsonValue jv = Stage.jsonReader.parse(line);
270
- Serializer.deserialize(jv.get("class").asString(), line);
271
- }
272
- }
273
-
274
- public static void save(){
280
+ private void save(){
275
281
  if(currentState != SceneState.SceneEditor)
276
282
  return;
277
283
  if(!SceneEditor.isDirty)
278
284
  return;
279
- Main.log("Save");
280
- StringBuilder sb = new StringBuilder();
281
- sb.append("{class:SceneJson,");
282
- sb.append("background:\""+Scene.sceneBackground+"\",");
283
- sb.append("music:\""+Scene.sceneMusic+"\",");
284
- sb.append("transition:\""+Scene.sceneTransition+"\",");
285
- sb.append("duration:"+Scene.sceneDuration+",");
286
- sb.append("interpolation:"+Scene.sceneInterpolationType.toString()+"}");
287
- sb.append("\n");
288
- Stage.removeActor("Shape");
289
- for(Actor actor: Stage.getChildren()){
290
- if(Stage.isValidActor(actor)){
291
- //log(actor.getName());
292
- sb.append(Stage.json.toJson(actor));
293
- sb.append("\n");
294
- }
295
- }
296
- Scene.scenesMap.put(Content.getSceneFile(), sb.toString());
285
+ Stage.getScene().save(Content.getSceneFile());
297
- Gdx.files.local(Asset.basePath+"scene").writeString(Stage.json.toJson(Scene.scenesMap, ArrayMap.class, String.class), false);
298
- sb = null;
299
286
  SceneEditor.isDirty = false;
300
287
  }
301
288
  }
302
289
 
303
290
  enum SceneState{
304
291
  SceneEditor, MapEditor, ActorEditor, GameRunning
292
+ }
293
+
294
+ class SceneEditor extends Scene {
295
+ public static Actor selectedActor = null;
296
+ public static boolean reloadAssets = false;
297
+ static AddField addField;
298
+
299
+ public SceneEditor(){
300
+ super();
301
+ if(reloadAssets){
302
+ Asset.loadBlocking(); // this is the first time this Scene is created by the Stage
303
+ Content.assetPanel.updateAsset();
304
+ com.badlogic.gdx.utils.Timer.schedule(new Task(){
305
+ @Override
306
+ public void run() {
307
+ Frame.scenePanel.showStudio();
308
+ Scene.scenesMap.removeKey("SceneEditor");
309
+ Frame.scenePanel.update();
310
+ }
311
+ }, 1f);
312
+ reloadAssets = false;
313
+ addField = new AddField();
314
+ }
315
+ else{
316
+ Frame.scenePanel.showStudio();
317
+ Scene.scenesMap.removeKey("SceneEditor");
318
+ Stage.addActor(this);
319
+ }
320
+ Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
321
+ }
322
+
323
+ public static void doClick(Actor actor){
324
+ addField.remove();
325
+ Frame.actorPanel.lock();
326
+ Frame.propertyPanel.clear();
327
+ Frame.effectPanel.clear();
328
+ Frame.eventPanel.clear();
329
+ selectedActor = actor;
330
+ Stage.outline(actor);
331
+ Frame.actorPanel.list.setSelectedIndex(Frame.actorPanel.indexOf(actor.getName()));
332
+ StatusBar.updateSelected(actor.getName());
333
+ Frame.dashPanel.update();
334
+ Frame.propertyPanel.update();
335
+ Frame.effectPanel.update();
336
+ Frame.eventPanel.update();
337
+ Frame.actorPanel.unlock();
338
+ if(selectedActor instanceof List || selectedActor instanceof SelectBox){
339
+ addField.setPosition(actor.getX(), actor.getY() - addField.getHeight());
340
+ Stage.addActor(addField);
341
+ }
342
+ }
343
+
344
+
345
+ @Override
346
+ public void onClick(Actor actor) {
347
+ doClick(actor);
348
+ }
349
+
350
+ boolean dragging;
351
+ int edge;
352
+ float startX, startY, lastX, lastY;
353
+ public static boolean isDirty = false;
354
+ @Override
355
+ public void onTouchDown(Actor actor) {
356
+ if (Stage.button == 0) {
357
+ edge = 0;
358
+ float x = Stage.mouse.x;
359
+ float y = Stage.mouse.y;
360
+ if (x > actor.getX() + actor.getWidth() - 10) edge |= Align.right;
361
+ if (y > actor.getY() + actor.getHeight() - 10) edge |= Align.top;
362
+ if (x < actor.getX() + 20 && y < actor.getY() + 20) edge = Align.left;
363
+ dragging = edge != 0;
364
+ startX = x;
365
+ startY = y;
366
+ lastX = x;
367
+ lastY = y;
368
+ }
369
+ }
370
+
371
+ @Override
372
+ public void onTouchUp() {
373
+ dragging = false;
374
+ Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
375
+ }
376
+
377
+ @Override
378
+ public void onDragged() {
379
+ if(Stage.isValidActor(selectedActor)){
380
+ if(!dragging){
381
+ selectedActor.setPosition(Stage.mouse.x, Stage.mouse.y);
382
+ Frame.propertyPanel.updateProperty("X", ""+selectedActor.getX(), 0);
383
+ Frame.propertyPanel.updateProperty("Y", ""+selectedActor.getY(), 0);
384
+ StatusBar.updateXY(Stage.mouse.x, Stage.mouse.y);
385
+
386
+ }
387
+ else
388
+ {
389
+ float x = Stage.mouse.x;
390
+ float y = Stage.mouse.y;
391
+ float width = selectedActor.getWidth(), height = selectedActor.getHeight();
392
+ float windowX = selectedActor.getX(), windowY = selectedActor.getY();
393
+ if ((edge & Align.right) != 0) {
394
+ width += x - lastX;
395
+ }
396
+ if ((edge & Align.top) != 0) {
397
+ height += y - lastY;
398
+ }
399
+ if ((edge & Align.top) != 0 && (edge & Align.right) != 0) {
400
+ width += x - lastX;
401
+ height += y - lastY;
402
+ }
403
+ if (edge == Align.left){
404
+ float rot = Stage.getAngle(selectedActor.getX()+selectedActor.getOriginX(),
405
+ selectedActor.getY()+selectedActor.getOriginY(), x, y)
406
+ - selectedActor.getRotation();
407
+ selectedActor.rotate(rot);
408
+ }
409
+ lastX = x;
410
+ lastY = y;
411
+ selectedActor.setBounds(Math.round(windowX), Math.round(windowY), Math.round(width), Math.round(height));
412
+ Frame.propertyPanel.updateProperty("Width", ""+width, 0);
413
+ Frame.propertyPanel.updateProperty("Height", ""+height, 0);
414
+ }
415
+ SceneEditor.isDirty = true;
416
+ }
417
+ }
418
+
419
+ @Override
420
+ public void onGesture(GestureType type) {
421
+ }
422
+
423
+ private boolean isHand = true;
424
+ private boolean isRight = false;
425
+ private boolean isTop = false;
426
+
427
+ @Override
428
+ public void act(float delta){
429
+ if(Stage.isValidActor(selectedActor)){
430
+ isRight = false;
431
+ isTop = false;
432
+ //Stage.log("my"+Stage.mouse.y+"top"+selectedActor.getTop());
433
+ if (Stage.mouse.x > selectedActor.getRight() - 10 && Stage.mouse.x < selectedActor.getRight()) {
434
+ Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
435
+ isHand = false;
436
+ isRight = true;
437
+ }
438
+ if(Stage.mouse.y > selectedActor.getTop() - 10 && Stage.mouse.y < selectedActor.getTop()){
439
+ Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
440
+ isHand = false;
441
+ isTop = true;
442
+ }
443
+ if (isRight && isTop) {
444
+ Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
445
+ isHand = false;
446
+ }
447
+ if (!isRight && !isTop){
448
+ if(!isHand){
449
+ Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
450
+ isHand = true;
451
+ }
452
+ }
453
+ }
454
+ }
455
+
456
+ @Override
457
+ public void onKeyTyped(char key) {};
458
+ @Override
459
+ public void onKeyUp(int keycode){};
460
+ @Override
461
+ public void onKeyDown(int keycode){};
462
+ @Override
463
+ public void onPause(){};
464
+ @Override
465
+ public void onResume(){};
466
+ @Override
467
+ public void onDispose(){};
468
+ }
469
+
470
+ class AddField extends Table {
471
+ TextField tf;
472
+ TextButton addBtn;
473
+ TextButton removeBtn;
474
+
475
+ public AddField(){
476
+ super(Asset.skin);
477
+ setBackground(Asset.skin.getDrawable("dialogDim"));
478
+ tf = new TextField("", Asset.skin);
479
+ addBtn = new TextButton("Add", Asset.skin);
480
+ removeBtn = new TextButton("Remove", Asset.skin);
481
+ add(tf);
482
+ add(addBtn);
483
+ add(removeBtn);
484
+ pack();
485
+ addBtn.addListener(new ClickListener(){
486
+ @Override
487
+ public void clicked(InputEvent event, float x, float y){
488
+ super.clicked(event, x, y);
489
+ if(!tf.getText().isEmpty()){
490
+ if(SceneEditor.selectedActor instanceof List){
491
+ List list = (List) SceneEditor.selectedActor;
492
+ Array<String> arr = new Array<String>(list.getItems());
493
+ arr.add(tf.getText());
494
+ list.setItems(arr.toArray());
495
+ list.pack();
496
+ AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
497
+ }
498
+ if(SceneEditor.selectedActor instanceof SelectBox){
499
+ SelectBox list = (SelectBox) SceneEditor.selectedActor;
500
+ Array<String> arr = new Array<String>(list.getItems());
501
+ arr.add(tf.getText());
502
+ list.setItems(arr.toArray());
503
+ list.pack();
504
+ AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
505
+ }
506
+
507
+ }
508
+ }
509
+ });
510
+ removeBtn.addListener(new ClickListener(){
511
+ @Override
512
+ public void clicked(InputEvent event, float x, float y){
513
+ super.clicked(event, x, y);
514
+ if(SceneEditor.selectedActor instanceof List){
515
+ List list = (List) SceneEditor.selectedActor;
516
+ if(list.getItems().length == 0)
517
+ return;
518
+ Array<String> arr = new Array<String>(list.getItems());
519
+ list.setSelectedIndex(list.getItems().length-1);
520
+ arr.removeIndex(list.getSelectedIndex());
521
+ list.setItems(arr.toArray());
522
+ list.pack();
523
+ AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
524
+ }
525
+ if(SceneEditor.selectedActor instanceof SelectBox){
526
+ SelectBox list = (SelectBox) SceneEditor.selectedActor;
527
+ if(list.getItems().length == 0)
528
+ return;
529
+ Array<String> arr = new Array<String>(list.getItems());
530
+ list.setSelection(list.getItems().length-1);
531
+ arr.removeIndex(list.getSelectionIndex());
532
+ list.setItems(arr.toArray());
533
+ list.pack();
534
+ AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
535
+ }
536
+ }
537
+ });
538
+ }
305
539
  }
Panel/SceneTemplate.txt CHANGED
@@ -29,8 +29,16 @@ public class $$$ extends Scene {
29
29
  }
30
30
 
31
31
  @Override
32
- public void onDragged(){
32
+ public void onKeyTyped(char key){
33
- }
33
+ }
34
+
35
+ @Override
36
+ public void onKeyUp(int keycode){
37
+ }
38
+
39
+ @Override
40
+ public void onKeyDown(int keycode){
41
+ }
34
42
 
35
43
  @Override
36
44
  public void onPause(){
Panel/StudioPanel.java CHANGED
@@ -1,4 +1,3 @@
1
- import java.awt.Cursor;
2
1
  import java.awt.Dimension;
3
2
  import java.awt.Graphics;
4
3
  import java.awt.Image;
@@ -8,10 +7,6 @@ import java.awt.datatransfer.Transferable;
8
7
  import java.awt.dnd.DnDConstants;
9
8
  import java.awt.dnd.DropTarget;
10
9
  import java.awt.dnd.DropTargetDropEvent;
11
- import java.awt.event.ActionEvent;
12
- import java.awt.event.ActionListener;
13
- import java.awt.event.FocusEvent;
14
- import java.awt.event.FocusListener;
15
10
  import java.io.File;
16
11
  import java.io.IOException;
17
12
  import java.nio.ByteBuffer;
@@ -19,7 +14,6 @@ import java.nio.ByteBuffer;
19
14
  import javax.imageio.ImageIO;
20
15
  import javax.swing.JPanel;
21
16
  import javax.swing.JScrollPane;
22
- import javax.swing.Timer;
23
17
 
24
18
  import web.laf.lite.layout.VerticalFlowLayout;
25
19
  import web.laf.lite.utils.UIUtils;
@@ -33,7 +27,6 @@ import com.badlogic.gdx.graphics.Pixmap;
33
27
  import com.badlogic.gdx.graphics.Pixmap.Format;
34
28
  import com.badlogic.gdx.graphics.PixmapIO;
35
29
  import com.badlogic.gdx.scenes.scene2d.Actor;
36
- import com.badlogic.gdx.scenes.scene2d.InputEvent;
37
30
  import com.badlogic.gdx.scenes.scene2d.ui.Button;
38
31
  import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
39
32
  import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
@@ -46,266 +39,17 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
46
39
  import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
47
40
  import com.badlogic.gdx.scenes.scene2d.ui.TextField;
48
41
  import com.badlogic.gdx.scenes.scene2d.ui.Touchpad;
49
- import com.badlogic.gdx.scenes.scene2d.utils.Align;
50
- import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
51
- import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop;
52
42
  import com.badlogic.gdx.tools.hiero.HieroPanel;
53
43
  import com.badlogic.gdx.tools.particleeditor.ParticlePanel;
54
44
  import com.badlogic.gdx.tools.particleeditor.ParticleRenderer;
55
- import com.badlogic.gdx.utils.Array;
45
+ import com.badlogic.gdx.utils.Timer.Task;
56
46
 
57
- class SceneEditor extends Scene {
58
-
59
- public static Actor selectedActor = null;
60
- public static boolean reloadAssets = false;
61
- static AddField addField;
62
- DragAndDrop dragAndDrop = new DragAndDrop();
63
-
64
-
65
- public SceneEditor(){
66
- super();
67
- if(reloadAssets){
68
- Asset.loadBlocking(); // this is the first time this Scene is created by the Stage
69
- Content.assetPanel.updateAsset();
70
- Frame.scenePanel.showStudio();
71
- Scene.scenesMap.removeKey("SceneEditor");
72
- Frame.scenePanel.update();
73
- reloadAssets = false;
74
- addField = new AddField();
75
- Stage.addActor(this);
76
- }
77
- else{
78
- Frame.scenePanel.showStudio();
79
- Scene.scenesMap.removeKey("SceneEditor");
80
- Stage.addActor(this);
81
- }
82
- Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
83
- }
84
-
85
- public static void doClick(Actor actor){
86
- addField.remove();
87
- Frame.actorPanel.lock();
88
- Frame.propertyPanel.clear();
89
- Frame.effectPanel.clear();
90
- Frame.eventPanel.clear();
91
- selectedActor = actor;
92
- Stage.outline(actor);
93
- Frame.actorPanel.list.setSelectedIndex(Frame.actorPanel.indexOf(actor.getName()));
94
- StatusBar.updateSelected(actor.getName());
95
- Frame.dashPanel.update();
96
- Frame.propertyPanel.update();
97
- Frame.effectPanel.update();
98
- Frame.eventPanel.update();
99
- Frame.actorPanel.unlock();
100
- if(selectedActor instanceof List || selectedActor instanceof SelectBox){
101
- addField.setPosition(actor.getX(), actor.getY() - addField.getHeight());
102
- Stage.addActor(addField);
103
- }
104
- }
105
-
106
-
107
- @Override
108
- public void onClick(Actor actor) {
109
- doClick(actor);
110
- }
111
-
112
- boolean dragging;
113
- int edge;
114
- float startX, startY, lastX, lastY;
115
- public static boolean isDirty = false;
116
- @Override
117
- public void onTouchDown(Actor actor) {
118
- if (Stage.button == 0) {
119
- edge = 0;
120
- float x = Stage.mouse.x;
121
- float y = Stage.mouse.y;
122
- if (x > actor.getX() + actor.getWidth() - 10) edge |= Align.right;
123
- if (y > actor.getY() + actor.getHeight() - 10) edge |= Align.top;
124
- if (x < actor.getX() + 20 && y < actor.getY() + 20) edge = Align.left;
125
- dragging = edge != 0;
126
- startX = x;
127
- startY = y;
128
- lastX = x;
129
- lastY = y;
130
- }
131
- }
132
-
133
- @Override
134
- public void onTouchUp() {
135
- dragging = false;
136
- Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
137
- }
138
-
139
- @Override
140
- public void onDragged() {
141
- if(Stage.isValidActor(selectedActor)){
142
- if(!dragging){
143
- selectedActor.setPosition(Stage.mouse.x, Stage.mouse.y);
144
- Frame.propertyPanel.updateProperty("X", ""+selectedActor.getX(), 0);
145
- Frame.propertyPanel.updateProperty("Y", ""+selectedActor.getY(), 0);
146
- StatusBar.updateXY(Stage.mouse.x, Stage.mouse.y);
147
-
148
- }
149
- else
150
- {
151
- float x = Stage.mouse.x;
152
- float y = Stage.mouse.y;
153
- float width = selectedActor.getWidth(), height = selectedActor.getHeight();
154
- float windowX = selectedActor.getX(), windowY = selectedActor.getY();
155
- if ((edge & Align.right) != 0) {
156
- width += x - lastX;
157
- }
158
- if ((edge & Align.top) != 0) {
159
- height += y - lastY;
160
- }
161
- if ((edge & Align.top) != 0 && (edge & Align.right) != 0) {
162
- width += x - lastX;
163
- height += y - lastY;
164
- }
165
- if (edge == Align.left){
166
- float rot = Stage.getAngle(selectedActor.getX()+selectedActor.getOriginX(),
167
- selectedActor.getY()+selectedActor.getOriginY(), x, y)
168
- - selectedActor.getRotation();
169
- selectedActor.rotate(rot);
170
- Main.log(""+rot);
171
- }
172
- lastX = x;
173
- lastY = y;
174
- selectedActor.setBounds(Math.round(windowX), Math.round(windowY), Math.round(width), Math.round(height));
175
- Frame.propertyPanel.updateProperty("Width", ""+width, 0);
176
- Frame.propertyPanel.updateProperty("Height", ""+height, 0);
177
- }
178
- SceneEditor.isDirty = true;
179
- }
180
- }
181
-
182
- @Override
183
- public void onGesture(GestureType type) {
184
- }
185
-
186
- private boolean isHand = true;
187
- private boolean isRight = false;
188
- private boolean isTop = false;
189
-
190
- @Override
191
- public void act(float delta){
192
- if(Stage.isValidActor(selectedActor)){
193
- isRight = false;
194
- isTop = false;
195
- //Stage.log("my"+Stage.mouse.y+"top"+selectedActor.getTop());
196
- if (Stage.mouse.x > selectedActor.getRight() - 10 && Stage.mouse.x < selectedActor.getRight()) {
197
- Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
198
- isHand = false;
199
- isRight = true;
200
- }
201
- if(Stage.mouse.y > selectedActor.getTop() - 10 && Stage.mouse.y < selectedActor.getTop()){
202
- Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
203
- isHand = false;
204
- isTop = true;
205
- }
206
- if (isRight && isTop) {
207
- Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
208
- isHand = false;
209
- }
210
- if (!isRight && !isTop){
211
- if(!isHand){
212
- Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
213
- isHand = true;
214
- }
215
- }
216
- }
217
- }
218
-
219
- @Override
220
- public void onPause(){};
221
- @Override
222
- public void onResume(){};
223
- @Override
224
- public void onDispose(){};
225
- }
226
-
227
- class AddField extends Table {
228
- TextField tf;
229
- TextButton addBtn;
230
- TextButton removeBtn;
231
-
232
- public AddField(){
233
- super(Asset.skin);
234
- setBackground(Asset.skin.getDrawable("dialogDim"));
235
- tf = new TextField("", Asset.skin);
236
- addBtn = new TextButton("Add", Asset.skin);
237
- removeBtn = new TextButton("Remove", Asset.skin);
238
- add(tf);
239
- add(addBtn);
240
- add(removeBtn);
241
- pack();
242
- addBtn.addListener(new ClickListener(){
243
- @Override
244
- public void clicked(InputEvent event, float x, float y){
245
- super.clicked(event, x, y);
246
- if(!tf.getText().isEmpty()){
247
- if(SceneEditor.selectedActor instanceof List){
248
- List list = (List) SceneEditor.selectedActor;
249
- Array<String> arr = new Array<String>(list.getItems());
250
- arr.add(tf.getText());
251
- list.setItems(arr.toArray());
252
- list.pack();
253
- AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
254
- }
255
- if(SceneEditor.selectedActor instanceof SelectBox){
256
- SelectBox list = (SelectBox) SceneEditor.selectedActor;
257
- Array<String> arr = new Array<String>(list.getItems());
258
- arr.add(tf.getText());
259
- list.setItems(arr.toArray());
260
- list.pack();
261
- AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
262
- }
263
-
264
- }
265
- }
266
- });
267
- removeBtn.addListener(new ClickListener(){
268
- @Override
269
- public void clicked(InputEvent event, float x, float y){
270
- super.clicked(event, x, y);
271
- if(SceneEditor.selectedActor instanceof List){
272
- List list = (List) SceneEditor.selectedActor;
273
- if(list.getItems().length == 0)
274
- return;
275
- Array<String> arr = new Array<String>(list.getItems());
276
- list.setSelectedIndex(list.getItems().length-1);
277
- arr.removeIndex(list.getSelectedIndex());
278
- list.setItems(arr.toArray());
279
- list.pack();
280
- AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
281
- }
282
- if(SceneEditor.selectedActor instanceof SelectBox){
283
- SelectBox list = (SelectBox) SceneEditor.selectedActor;
284
- if(list.getItems().length == 0)
285
- return;
286
- Array<String> arr = new Array<String>(list.getItems());
287
- list.setSelection(list.getItems().length-1);
288
- arr.removeIndex(list.getSelectionIndex());
289
- list.setItems(arr.toArray());
290
- list.pack();
291
- AddField.this.setPosition(list.getX(), list.getY()-AddField.this.getHeight());
292
- }
293
- }
294
- });
295
- }
296
- }
297
47
 
298
48
  final public class StudioPanel extends JPanel {
299
49
  private static final long serialVersionUID = 1L;
300
50
  LwjglCanvas can;
301
51
  LwjglAWTCanvas canvas;
302
52
 
303
- final Timer saveTimer = new Timer(10000, new ActionListener(){
304
- @Override
305
- public void actionPerformed(ActionEvent arg0) {
306
- ScenePanel.save();
307
- }
308
- });
309
53
  Image img;
310
54
  public StudioPanel(){
311
55
  super(new VerticalFlowLayout());
@@ -396,18 +140,6 @@ final public class StudioPanel extends JPanel {
396
140
  }
397
141
  }
398
142
  });
399
- canvas.getCanvas().addFocusListener(new FocusListener(){
400
- @Override
401
- public void focusGained(FocusEvent arg0) {
402
- saveTimer.start();
403
- }
404
-
405
- @Override
406
- public void focusLost(FocusEvent arg0) {
407
- ScenePanel.save();
408
- saveTimer.stop();
409
- }
410
- });
411
143
  Asset.save();
412
144
  }catch(Exception ex){
413
145
  ex.printStackTrace();
@@ -431,18 +163,23 @@ final public class StudioPanel extends JPanel {
431
163
  }
432
164
 
433
165
 
434
- public void setName(Actor actor){
166
+ public void setName(final Actor actor){
167
+ com.badlogic.gdx.utils.Timer.schedule(new Task(){
168
+ @Override
169
+ public void run() {
435
- String name = actor.getClass().getSimpleName()+getNameCount(actor);
170
+ String name = actor.getClass().getSimpleName()+getNameCount(actor);
436
- if(Stage.findActor(name) == null)
171
+ if(Stage.findActor(name) == null)
437
- actor.setName(name);
172
+ actor.setName(name);
438
- else
173
+ else
439
- actor.setName(name+"_1");
174
+ actor.setName(name+"_1");
440
- actor.setX(Stage.mouse.x/2);
175
+ actor.setX(Stage.mouse.x-actor.getWidth()/2);
441
- actor.setY(Stage.mouse.y/2);
176
+ actor.setY(Stage.mouse.y-actor.getHeight()/2);
442
- Stage.addActor(actor);
177
+ Stage.addActor(actor);
443
- Frame.actorPanel.addActor(actor.getName());
178
+ Frame.actorPanel.addActor(actor.getName());
444
- SceneEditor.isDirty = true;
179
+ SceneEditor.isDirty = true;
445
- Effect.createEffect(actor, EffectType.ScaleInOut, 1.5f, 0.5f, InterpolationType.Linear);
180
+ Effect.createEffect(actor, EffectType.ScaleInOut, 1.5f, 0.5f, InterpolationType.Linear);
181
+ }
182
+ }, 0.1f);
446
183
  }
447
184
 
448
185
  public void createActor(String type){
Panel/TablePanel.java CHANGED
@@ -26,7 +26,7 @@ public class TablePanel extends JPanel implements ActionListener {
26
26
  public TablePanel(String title){
27
27
  super(new VerticalFlowLayout());
28
28
  UIUtils.setUndecorated(this, false);
29
- headerButton = Style.createHeaderButton(title, this);
29
+ headerButton = new Style.TitleButton(title, this);
30
30
  if(!title.isEmpty()){
31
31
  add(headerButton);
32
32
  }
Panel/WidgetPanel.java CHANGED
@@ -24,7 +24,7 @@ public class WidgetPanel extends BaseList implements DragSourceListener, DragGes
24
24
  super("Widgets", "Label","Image", "Sprite", "Button","TextButton", "CheckBox",
25
25
  "List", "SelectBox", "Slider", "TextField",
26
26
  "Table", "Dialog", "Touchpad", "Map");
27
- scrollPane.setPreferredSize(new Dimension(200, 100));
27
+ scrollPane.setPreferredSize(new Dimension(200, 50));
28
28
  dragSource.addDragSourceListener(this);
29
29
  dragSource.createDefaultDragGestureRecognizer(list, DnDConstants.ACTION_MOVE, this);
30
30
  }
Panel/project.properties DELETED
@@ -1,11 +0,0 @@
1
- # This file is automatically generated by Android Tools.
2
- # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
- #
4
- # This file must be checked in Version Control Systems.
5
- #
6
- # To customize properties used by the Ant build system use,
7
- # "ant.properties", and override values to adapt the script to your
8
- # project structure.
9
-
10
- # Project target.
11
- target=android-15
Stage/Asset.java CHANGED
@@ -500,23 +500,43 @@ public final class Asset {
500
500
  }
501
501
 
502
502
  /*
503
- * Load a model from the model directory
503
+ * Load a G3db model from the model directory
504
504
  * @param modelName The name of the modelFile
505
505
  * @example loadModel("ship");
506
506
  */
507
507
  public static Actor3d loadModel(String modelName){
508
+ assetMan.load(basePath+"model/"+modelName+".g3db", Model.class);
509
+ assetMan.finishLoading();
510
+ return new Actor3d(assetMan.get(basePath+"model/"+modelName+".g3db", Model.class));
511
+ }
512
+
513
+ /*
514
+ * Unload a G3db model which was previously loaded in the assetManager
515
+ * @param modelName The name of the modelFile that was loaded
516
+ * @example unloadModel("ship");
517
+ */
518
+ public static void unloadModel(String modelName){
519
+ assetMan.unload(basePath+"model/"+modelName+".g3db");
520
+ }
521
+
522
+ /*
523
+ * Load a Obj model from the model directory
524
+ * @param modelName The name of the modelFile
525
+ * @example loadModel("ship");
526
+ */
527
+ public static Actor3d loadModelObj(String modelName){
508
528
  assetMan.load(basePath+"model/"+modelName+".obj", Model.class);
509
529
  assetMan.finishLoading();
510
530
  return new Actor3d(assetMan.get(basePath+"model/"+modelName+".obj", Model.class));
511
531
  }
512
532
 
513
533
  /*
514
- * Unload a model which was previously loaded in the assetManager
534
+ * Unload a Obj model which was previously loaded in the assetManager
515
535
  * @param modelName The name of the modelFile that was loaded
516
536
  * @example unloadModel("ship");
517
537
  */
518
- public static void unloadModel(String modelName){
538
+ public static void unloadModelObj(String modelName){
519
- assetMan.unload(basePath+"model/"+modelName+".g3d");
539
+ assetMan.unload(basePath+"model/"+modelName+".obj");
520
540
  }
521
541
 
522
542
  /***********************************************************************************************************
Stage/Config.java CHANGED
@@ -35,7 +35,6 @@ public final class Config {
35
35
  public static float volMusic;
36
36
  public static float volSound;
37
37
 
38
- public static boolean usePan;
39
38
  public static boolean useDrag;
40
39
  public static boolean useKeyboard;
41
40
 
@@ -52,7 +51,7 @@ public final class Config {
52
51
  volMusic = prefs.getFloat(VOLUME_MUSIC, 1f);
53
52
  volSound = prefs.getFloat(VOLUME_SOUND, 1f);
54
53
 
55
- usePan = prefs.getBoolean(PANSCROLL, true);
54
+ Stage.usePan = prefs.getBoolean(PANSCROLL, true);
56
55
  useDrag = prefs.getBoolean(DRAGSCROLL, true);
57
56
  useKeyboard = prefs.getBoolean(KEYBOARD, true);
58
57
 
@@ -132,7 +131,7 @@ public final class Config {
132
131
  public static void setPanScroll(boolean ue){
133
132
  prefs.putBoolean(PANSCROLL, ue);
134
133
  prefs.flush();
135
- usePan = ue ;
134
+ Stage.usePan = ue ;
136
135
  }
137
136
 
138
137
  public static void setDragScroll(boolean ue){
Stage/Map.java CHANGED
@@ -1,6 +1,3 @@
1
-
2
-
3
-
4
1
  import com.badlogic.gdx.graphics.g2d.TextureRegion;
5
2
  import com.badlogic.gdx.maps.MapLayer;
6
3
  import com.badlogic.gdx.maps.MapLayers;
@@ -102,4 +99,38 @@ public class Map extends Group{
102
99
  public MapLayers getMapLayers(){
103
100
  return mlayers;
104
101
  }
102
+ }
103
+
104
+ class MapLayerg extends Group {
105
+
106
+ public MapLayerg(int index){
107
+ this.setZIndex(index);
108
+ }
109
+ }
110
+
111
+ class RPGMap {
112
+ private static RPGMap instance;
113
+ MapLayerg mapLayer1;
114
+ MapLayerg mapLayer2;
115
+ MapLayerg mapLayer3;
116
+ MapLayerg mapLayer4;
117
+ MapLayerg mapLayer5;
118
+ MapLayerg mapLayer6;
119
+ MapLayerg mapLayer7;
120
+
121
+ private RPGMap(){
122
+ mapLayer1 = new MapLayerg(1);
123
+ mapLayer2 = new MapLayerg(2);
124
+ mapLayer3 = new MapLayerg(3);
125
+ mapLayer4 = new MapLayerg(4);
126
+ mapLayer5 = new MapLayerg(5);
127
+ mapLayer6 = new MapLayerg(6);
128
+ mapLayer7 = new MapLayerg(7);
129
+ }
130
+
131
+ public static RPGMap getInstance(){
132
+ if(instance == null)
133
+ instance = new RPGMap();
134
+ return instance;
135
+ }
105
136
  }
Stage/Scene.java CHANGED
@@ -1,7 +1,6 @@
1
1
  import com.badlogic.gdx.Gdx;
2
2
  import com.badlogic.gdx.scenes.scene2d.Actor;
3
3
  import com.badlogic.gdx.utils.ArrayMap;
4
- import com.badlogic.gdx.utils.JsonValue;
5
4
  import com.badlogic.gdx.utils.StringBuilder;
6
5
 
7
6
  abstract public class Scene extends Actor {
@@ -9,20 +8,20 @@ abstract public class Scene extends Actor {
9
8
  public static final ArrayMap<String, String> scenesMap = new ArrayMap<String, String>();
10
9
 
11
10
  private String sceneName = "";
12
- public static String sceneBackground = "";
11
+ public String sceneBackground = "None";
13
- public static String sceneMusic = "";
12
+ public String sceneMusic = "None";
14
- public static String sceneTransition = "";
13
+ public String sceneTransition = "None";
15
- public static float sceneDuration = 0;
14
+ public float sceneDuration = 0;
16
- public static InterpolationType sceneInterpolationType = InterpolationType.Linear;
15
+ public InterpolationType sceneInterpolationType = InterpolationType.Linear;
17
16
 
18
17
  public Scene(){
19
18
  setPosition(0, 0);
20
19
  setSize(0, 0);
21
20
  setBounds(0,0, 0, 0);
22
- Stage.addActor(this);
23
21
  sceneName = this.getClass().getName();
22
+ setName(sceneName);
24
23
  Stage.log("Current Scene: "+sceneName);
25
- load();
24
+ load(sceneName);
26
25
  }
27
26
 
28
27
  public abstract void onClick(Actor actor);
@@ -30,33 +29,41 @@ abstract public class Scene extends Actor {
30
29
  public abstract void onTouchUp();
31
30
  public abstract void onDragged();
32
31
  public abstract void onGesture(GestureType gestureType);
32
+ public abstract void onKeyTyped(char key);
33
+ public abstract void onKeyUp(int keycode);
34
+ public abstract void onKeyDown(int keycode);
33
35
  public abstract void onPause();
34
36
  public abstract void onResume();
35
37
  public abstract void onDispose();
36
38
 
37
- private void load(){
39
+ public void load(String sceneName){
40
+ Stage.log("Load");
38
41
  String[] lines = Scene.scenesMap.get(sceneName).split("\n");
39
42
  for(String line: lines){
40
43
  if(line.trim().isEmpty())
41
44
  continue;
42
- JsonValue jv = Stage.jsonReader.parse(line);
45
+ Stage.addActor(Stage.json.fromJson(Actor.class, line));
43
- Serializer.deserialize(jv.get("class").asString(), line);
44
46
  }
47
+ if(!sceneBackground.equals("None"))
48
+ Stage.setBackground(sceneBackground);
49
+ if(!sceneMusic.equals("None"))
50
+ Asset.musicPlay(sceneMusic);
51
+ if(!sceneTransition.equals("None"))
52
+ Effect.transition(TransitionType.valueOf(sceneTransition),
53
+ Stage.getRoot(), sceneDuration, sceneInterpolationType);
45
54
  }
46
55
 
47
- public void save(){
56
+ protected void save(){
57
+ save(sceneName);
58
+ }
59
+
60
+ public void save(String sceneName){
61
+ Stage.log("Save");
48
62
  StringBuilder sb = new StringBuilder();
49
- sb.append("{class:SceneJson,");
50
- sb.append("background:\""+sceneBackground+"\",");
51
- sb.append("music:\""+sceneMusic+"\",");
52
- sb.append("transition:\""+sceneTransition+"\",");
53
- sb.append("duration:"+sceneDuration+",");
54
- sb.append("interpolation:"+sceneInterpolationType.toString()+"}");
55
- sb.append("\n");
56
63
  Stage.removeActor("Shape");
57
64
  for(Actor actor: Stage.getChildren()){
58
65
  if(Stage.isValidActor(actor)){
59
- //log(actor.getName());
66
+ //Stage.log(actor.getName());
60
67
  sb.append(Stage.json.toJson(actor));
61
68
  sb.append("\n");
62
69
  }
Stage/Serializer.java CHANGED
@@ -1,6 +1,7 @@
1
1
  import com.badlogic.gdx.graphics.Color;
2
2
  import com.badlogic.gdx.scenes.scene2d.Actor;
3
3
  import com.badlogic.gdx.scenes.scene2d.Group;
4
+ import com.badlogic.gdx.scenes.scene2d.Touchable;
4
5
  import com.badlogic.gdx.scenes.scene2d.ui.Button;
5
6
  import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
6
7
  import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
@@ -16,44 +17,22 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
16
17
  import com.badlogic.gdx.scenes.scene2d.ui.TextField;
17
18
  import com.badlogic.gdx.scenes.scene2d.ui.Touchpad;
18
19
  import com.badlogic.gdx.scenes.scene2d.ui.Tree;
20
+ import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup;
21
+ import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
22
+ import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
19
23
  import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
20
24
  import com.badlogic.gdx.utils.Json;
21
25
  import com.badlogic.gdx.utils.JsonValue;
22
26
 
23
27
  public class Serializer {
24
28
 
25
- public static void deserialize(String className, String value){
26
- if(className.equals("SceneJson")){
27
- JsonValue jv = Stage.jsonReader.parse(value);
28
- Scene.sceneBackground = jv.getString("background");
29
- Scene.sceneMusic = jv.getString("music");
30
- Scene.sceneTransition = jv.getString("transition");
31
- Scene.sceneDuration = jv.getFloat("duration");
32
- Scene.sceneInterpolationType = InterpolationType.valueOf(jv.getString("interpolation"));
33
- if(!Scene.sceneBackground.equals("None"))
34
- Stage.setBackground(Scene.sceneBackground);
35
- if(!Scene.sceneMusic.equals("None"))
36
- Asset.musicPlay(Scene.sceneMusic);
37
- Effect.transition(TransitionType.valueOf(Scene.sceneTransition),
38
- Stage.getRoot(),Scene.sceneDuration, Scene.sceneInterpolationType);
39
- }
40
- else{
41
- try {
42
- Class cc = Class.forName(className);
43
- Stage.addActor((Actor)Stage.json.fromJson(cc, value));
44
- }
45
- catch (ClassNotFoundException e) {
46
- e.printStackTrace();
47
- }
48
- }
49
- }
50
-
51
29
  public static void registerSerializer(Class clazz, Json.Serializer serializer){
52
30
  Stage.json.setSerializer(clazz, serializer);
53
31
  }
54
32
 
55
33
  public static void initialize(){
56
34
  registerSerializer(Actor.class, new ActorSerializer());
35
+ registerSerializer(Scene.class, new SceneSerializer());
57
36
  registerSerializer(ImageJson.class, new ImageJson());
58
37
  registerSerializer(Label.class, new LabelSerializer());
59
38
  registerSerializer(Button.class, new ButtonSerializer());
@@ -64,9 +43,18 @@ public class Serializer {
64
43
  registerSerializer(List.class, new ListSerializer());
65
44
  registerSerializer(Slider.class, new SliderSerializer());
66
45
  registerSerializer(TextField.class, new TextFieldSerializer());
67
- registerSerializer(Dialog.class, new DialogSerializer());
68
46
  registerSerializer(Touchpad.class, new TouchpadSerializer());
69
47
  registerSerializer(Sprite.class, new SpriteSerializer());
48
+
49
+ registerSerializer(Dialog.class, new DialogSerializer());
50
+ registerSerializer(SplitPane.class, new SplitPaneSerializer());
51
+ registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
52
+ registerSerializer(Stack.class, new StackSerializer());
53
+ registerSerializer(Tree.class, new TreeSerializer());
54
+ registerSerializer(Table.class, new TableSerializer());
55
+ registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
56
+ registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
57
+ registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
70
58
  }
71
59
 
72
60
  public static class ActorSerializer implements Json.Serializer<Actor> {
@@ -91,7 +79,13 @@ public class Serializer {
91
79
  actor.setY(jv.getFloat("y"));
92
80
  actor.setWidth(jv.getFloat("width"));
93
81
  actor.setHeight(jv.getFloat("height"));
82
+ actor.setOriginX(jv.getFloat("ox"));
83
+ actor.setOriginY(jv.getFloat("oy"));
84
+ actor.setRotation(jv.getFloat("rotation"));
85
+ //actor.setZIndex(jv.getInt("zindex"));
94
86
  actor.setColor(Color.valueOf(jv.getString("color")));
87
+ actor.setTouchable(Touchable.valueOf(jv.getString("touchable")));
88
+ actor.setVisible(jv.getBoolean("visible"));
95
89
  }
96
90
 
97
91
  public static void writeActor(Json json, Actor actor){
@@ -101,32 +95,44 @@ public class Serializer {
101
95
  json.writeValue("y", actor.getY());
102
96
  json.writeValue("width", actor.getWidth());
103
97
  json.writeValue("height", actor.getHeight());
104
- json.writeValue("color", actor.getColor().toString());
105
98
  json.writeValue("ox", actor.getOriginX());
106
99
  json.writeValue("oy", actor.getOriginY());
107
100
  json.writeValue("rotation", actor.getRotation());
101
+ json.writeValue("zindex", actor.getZIndex());
102
+ json.writeValue("color", actor.getColor().toString());
103
+ json.writeValue("touchable", actor.getTouchable().toString());
104
+ json.writeValue("visible", actor.isVisible());
108
105
  }
109
106
 
110
107
  }
111
-
108
+
112
- public static class GroupSerializer extends ActorSerializer {
109
+ public static class SceneSerializer extends ActorSerializer {
113
-
114
110
  @Override
115
111
  public Actor read(Json json, JsonValue jv, Class arg2) {
116
- Group group = new Group();
112
+ Scene scene = Stage.getScene();
113
+ scene.sceneBackground = jv.getString("background");
117
- readActor(jv, group);
114
+ scene.sceneMusic = jv.getString("music");
115
+ scene.sceneTransition = jv.getString("transition");
116
+ scene.sceneDuration = jv.getFloat("duration");
117
+ scene.sceneInterpolationType = InterpolationType.valueOf(jv.getString("interpolation"));
118
- return group;
118
+ return scene;
119
119
  }
120
120
 
121
121
  @Override
122
- public void write(Json json, Actor actor, Class arg2) {
122
+ public void write(Json json, Actor label, Class arg2) {
123
123
  json.writeObjectStart();
124
- writeActor(json, actor);
124
+ Scene scene = (Scene) label;
125
+ json.writeValue("class", "Scene");
126
+ json.writeValue("background", scene.sceneBackground);
127
+ json.writeValue("music", scene.sceneMusic);
128
+ json.writeValue("transition", scene.sceneTransition);
129
+ json.writeValue("duration", scene.sceneDuration);
130
+ json.writeValue("interpolation", scene.sceneInterpolationType.toString());
125
131
  json.writeObjectEnd();
126
132
  }
127
133
  }
128
134
 
129
- private static class LabelSerializer extends ActorSerializer {
135
+ public static class LabelSerializer extends ActorSerializer {
130
136
 
131
137
  @Override
132
138
  public Actor read(Json json, JsonValue jv, Class arg2) {
@@ -251,31 +257,6 @@ public class Serializer {
251
257
 
252
258
  }
253
259
 
254
- private static class DialogSerializer extends ActorSerializer {
255
-
256
- @Override
257
- public Actor read(Json json, JsonValue jv, Class arg2) {
258
- Dialog dialog = new Dialog(jv.getString("title"), Asset.skin);
259
- readActor(jv, dialog);
260
- dialog.setModal(jv.getBoolean("modal"));
261
- dialog.setMovable(jv.getBoolean("move"));
262
- dialog.setResizable(jv.getBoolean("resize"));
263
- return dialog;
264
- }
265
-
266
- @Override
267
- public void write(Json json, Actor dialog, Class arg2) {
268
- json.writeObjectStart();
269
- writeActor(json, dialog);
270
- json.writeValue("title", ((Dialog)dialog).getTitle());
271
- json.writeValue("modal", ((Dialog)dialog).isModal());
272
- json.writeValue("move", ((Dialog)dialog).isMovable());
273
- json.writeValue("resize", ((Dialog)dialog).isResizable());
274
- json.writeObjectEnd();
275
- }
276
-
277
- }
278
-
279
260
  public static class TouchpadSerializer extends ActorSerializer {
280
261
  public static float deadZoneRadius = 5f;
281
262
  @Override
@@ -330,124 +311,246 @@ public class Serializer {
330
311
  json.writeObjectEnd();
331
312
  }
332
313
  }
314
+
315
+
333
316
 
334
- private static class SplitPaneSerializer extends ActorSerializer {
317
+ private static class SpriteSerializer extends ActorSerializer {
318
+
319
+ @Override
320
+ public Actor read(Json arg0, JsonValue jv, Class arg2) {
321
+ Sprite sprite;
322
+ if(jv.getInt("frameCount") != 1){
323
+ sprite = new Sprite(jv.getString("textures").split(",")[0], jv.getInt("frameCount"),
324
+ jv.getFloat("duration"));
325
+ }
326
+ else{
327
+ sprite = new Sprite(jv.getFloat("duration"), jv.getString("textures").split(","));
328
+ }
329
+ ActorSerializer.readActor(jv, sprite);
330
+ sprite.isAnimationActive = jv.getBoolean("active");
331
+ sprite.isAnimationLooping = jv.getBoolean("looping");
332
+ return sprite;
333
+ }
334
+
335
+
336
+ @Override
337
+ public void write(Json json, Actor sprite, Class arg2) {
338
+ json.writeObjectStart();
339
+ ActorSerializer.writeActor(json, sprite);
340
+ json.writeValue("textures", sprite.toString());
341
+ json.writeValue("duration", ((Sprite)sprite).getDuration());
342
+ json.writeValue("active", ((Sprite)sprite).isAnimationActive);
343
+ json.writeValue("looping", ((Sprite)sprite).isAnimationLooping);
344
+ json.writeValue("frameCount", ((Sprite)sprite).getFrameCount());
345
+ json.writeObjectEnd();
346
+ }
347
+
348
+ }
349
+
350
+ public static class GroupSerializer implements Json.Serializer<Group> {
351
+
352
+ @Override
353
+ public Group read(Json json, JsonValue jv, Class arg2) {
354
+ Group group = new Group();
355
+ readGroup(jv, group);
356
+ return group;
357
+ }
358
+
359
+ @Override
360
+ public void write(Json json, Group group, Class arg2) {
361
+ json.writeObjectStart();
362
+ writeGroup(json, group);
363
+ json.writeObjectEnd();
364
+ }
365
+
366
+ public void writeGroup(Json json, Group group){
367
+ ActorSerializer.writeActor(json, group);
368
+ //Array<String> actorsJson = new Array<String>();
369
+ //for(Actor actor: group.getChildren()){
370
+ // actorsJson.add(Stage.json.toJson(actor));
371
+ //}
372
+ //json.writeValue("children", actorsJson, Array.class, String.class);
373
+ //not working
374
+ }
375
+
376
+ public void readGroup(JsonValue jv, Group group){
377
+ ActorSerializer.readActor(jv, group);
378
+ //Array<String> array = (Array<String>)Stage.json.readValue(Array.class, String.class,
379
+ // jv.get("children"));
380
+ //for(String actorJson: array.items){
381
+ // Stage.log(actorJson);
382
+ // //group.addActor(Stage.json.fromJson(actor));
383
+ //}
384
+ }
385
+
386
+ public void iterateActors(){
387
+
388
+ }
389
+ }
390
+
391
+ private static class DialogSerializer extends ActorSerializer {
335
392
 
336
393
  @Override
337
394
  public Actor read(Json json, JsonValue jv, Class arg2) {
395
+ Dialog dialog = new Dialog(jv.getString("title"), Asset.skin);
396
+ readActor(jv, dialog);
397
+ dialog.setModal(jv.getBoolean("modal"));
398
+ dialog.setMovable(jv.getBoolean("move"));
399
+ dialog.setResizable(jv.getBoolean("resize"));
400
+ return dialog;
401
+ }
402
+
403
+ @Override
404
+ public void write(Json json, Actor dialog, Class arg2) {
405
+ json.writeObjectStart();
406
+ writeActor(json, dialog);
407
+ json.writeValue("title", ((Dialog)dialog).getTitle());
408
+ json.writeValue("modal", ((Dialog)dialog).isModal());
409
+ json.writeValue("move", ((Dialog)dialog).isMovable());
410
+ json.writeValue("resize", ((Dialog)dialog).isResizable());
411
+ json.writeObjectEnd();
412
+ }
413
+
414
+ }
415
+
416
+ private static class SplitPaneSerializer extends GroupSerializer {
417
+
418
+ @Override
419
+ public Group read(Json json, JsonValue jv, Class arg2) {
338
420
  SplitPane label = new SplitPane(null, null, false, Asset.skin);
339
- readActor(jv, label);
421
+ readGroup(jv, label);
340
422
  return label;
341
423
  }
342
424
 
343
425
  @Override
344
- public void write(Json json, Actor label, Class arg2) {
426
+ public void write(Json json, Group label, Class arg2) {
345
427
  json.writeObjectStart();
346
- writeActor(json, label);
428
+ writeGroup(json, label);
347
429
  json.writeObjectEnd();
348
430
  }
349
431
  }
350
432
 
351
- private static class ScrollPaneSerializer extends ActorSerializer {
433
+ private static class ScrollPaneSerializer extends GroupSerializer {
352
434
 
353
435
  @Override
354
- public Actor read(Json json, JsonValue jv, Class arg2) {
436
+ public Group read(Json json, JsonValue jv, Class arg2) {
355
437
  ScrollPane label = new ScrollPane(null);
356
- readActor(jv, label);
438
+ readGroup(jv, label);
357
439
  return label;
358
440
  }
359
441
 
360
442
  @Override
361
- public void write(Json json, Actor label, Class arg2) {
443
+ public void write(Json json, Group label, Class arg2) {
362
444
  json.writeObjectStart();
363
- writeActor(json, label);
445
+ writeGroup(json, label);
364
446
  json.writeObjectEnd();
365
447
  }
366
448
  }
367
449
 
368
- private static class StackSerializer extends ActorSerializer {
450
+ private static class StackSerializer extends GroupSerializer {
369
451
 
370
452
  @Override
371
- public Actor read(Json json, JsonValue jv, Class arg2) {
453
+ public Group read(Json json, JsonValue jv, Class arg2) {
372
454
  Stack label = new Stack();
373
- readActor(jv, label);
455
+ readGroup(jv, label);
374
456
  return label;
375
457
  }
376
458
 
377
459
  @Override
378
- public void write(Json json, Actor label, Class arg2) {
460
+ public void write(Json json, Group label, Class arg2) {
379
461
  json.writeObjectStart();
380
- writeActor(json, label);
462
+ writeGroup(json, label);
381
463
  json.writeObjectEnd();
382
464
  }
383
465
  }
384
466
 
385
- private static class TreeSerializer extends ActorSerializer {
467
+ private static class TreeSerializer extends GroupSerializer {
386
468
 
387
469
  @Override
388
- public Actor read(Json json, JsonValue jv, Class arg2) {
470
+ public Group read(Json json, JsonValue jv, Class arg2) {
389
471
  Tree label = new Tree(Asset.skin);
390
- readActor(jv, label);
472
+ readGroup(jv, label);
391
473
  return label;
392
474
  }
393
475
 
394
476
  @Override
395
- public void write(Json json, Actor label, Class arg2) {
477
+ public void write(Json json, Group label, Class arg2) {
396
478
  json.writeObjectStart();
397
- ActorSerializer.writeActor(json, label);
479
+ writeGroup(json, label);
398
480
  json.writeObjectEnd();
399
481
  }
400
482
  }
401
483
 
402
- private static class TableSerializer extends ActorSerializer {
484
+ private static class TableSerializer extends GroupSerializer {
403
485
 
404
486
  @Override
405
- public Actor read(Json json, JsonValue jv, Class arg2) {
487
+ public Group read(Json json, JsonValue jv, Class arg2) {
406
488
  Table table = new Table(Asset.skin);
489
+ //table.getPadBottom()
490
+ //table.getCell(null).get
407
- readActor(jv, table);
491
+ readGroup(jv, table);
408
492
  return table;
409
493
  }
410
494
 
411
495
  @Override
412
- public void write(Json json, Actor table, Class arg2) {
496
+ public void write(Json json, Group table, Class arg2) {
413
497
  json.writeObjectStart();
414
- writeActor(json, table);
498
+ writeGroup(json, table);
415
499
  json.writeObjectEnd();
416
500
  }
417
501
 
418
502
  }
503
+
504
+ private static class ButtonGroupSerializer extends GroupSerializer {
419
505
 
506
+ @Override
420
- private static class SpriteSerializer extends ActorSerializer {
507
+ public Group read(Json json, JsonValue jv, Class arg2) {
508
+ Table table = new Table(Asset.skin);
509
+ readGroup(jv, table);
510
+ return table;
511
+ }
421
512
 
422
513
  @Override
423
- public Actor read(Json arg0, JsonValue jv, Class arg2) {
514
+ public void write(Json json, Group table, Class arg2) {
424
- Sprite sprite;
425
- if(jv.getInt("frameCount") != 1){
426
- sprite = new Sprite(jv.getString("textures").split(",")[0], jv.getInt("frameCount"),
427
- jv.getFloat("duration"));
428
- }
429
- else{
430
- sprite = new Sprite(jv.getFloat("duration"), jv.getString("textures").split(","));
431
- }
432
- ActorSerializer.readActor(jv, sprite);
515
+ json.writeObjectStart();
433
- sprite.isAnimationActive = jv.getBoolean("active");
434
- sprite.isAnimationLooping = jv.getBoolean("looping");
435
- return sprite;
516
+ writeGroup(json, table);
517
+ json.writeObjectEnd();
436
518
  }
437
519
 
520
+ }
521
+
522
+ private static class HorizontalGroupSerializer extends GroupSerializer {
438
523
 
439
524
  @Override
525
+ public Group read(Json json, JsonValue jv, Class arg2) {
526
+ HorizontalGroup hg = new HorizontalGroup();
527
+ readGroup(jv, hg);
528
+ return hg;
529
+ }
530
+
531
+ @Override
440
- public void write(Json json, Actor sprite, Class arg2) {
532
+ public void write(Json json, Group table, Class arg2) {
441
533
  json.writeObjectStart();
442
- ActorSerializer.writeActor(json, sprite);
534
+ writeGroup(json, table);
443
- json.writeValue("textures", sprite.toString());
444
- json.writeValue("duration", ((Sprite)sprite).getDuration());
445
- json.writeValue("active", ((Sprite)sprite).isAnimationActive);
446
- json.writeValue("looping", ((Sprite)sprite).isAnimationLooping);
447
- json.writeValue("frameCount", ((Sprite)sprite).getFrameCount());
448
535
  json.writeObjectEnd();
449
536
  }
450
537
 
451
538
  }
539
+
540
+ private static class VerticalGroupSerializer extends GroupSerializer {
541
+
542
+ @Override
543
+ public Group read(Json json, JsonValue jv, Class arg2) {
544
+ VerticalGroup vg = new VerticalGroup();
545
+ readGroup(jv, vg);
546
+ return vg;
547
+ }
452
548
 
549
+ @Override
550
+ public void write(Json json, Group vg, Class arg2) {
551
+ json.writeObjectStart();
552
+ writeGroup(json, vg);
553
+ json.writeObjectEnd();
554
+ }
555
+ }
453
556
  }
Stage/Sprite.java CHANGED
@@ -41,7 +41,8 @@ public class Sprite extends Actor {
41
41
  super.draw(batch, parentAlpha);
42
42
  if (isAnimationActive && animation != null) {
43
43
  keyFrame = animation.getKeyFrame(Stage.stateTime, isAnimationLooping);
44
- batch.draw(keyFrame, getX(), getY(), getWidth(), getHeight());
44
+ batch.draw(keyFrame, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(),
45
+ getScaleX(), getScaleY(), getRotation());
45
46
  }
46
47
  }
47
48
 
Stage/Stage.java CHANGED
@@ -4,7 +4,7 @@ import java.awt.Toolkit;
4
4
  import com.badlogic.gdx.ApplicationListener;
5
5
  import com.badlogic.gdx.Gdx;
6
6
  import com.badlogic.gdx.Files.FileType;
7
- import com.badlogic.gdx.Input.Keys;
7
+ import com.badlogic.gdx.InputMultiplexer;
8
8
  import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
9
9
  import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
10
10
  import com.badlogic.gdx.graphics.Color;
@@ -120,6 +120,7 @@ public final class Stage implements ApplicationListener {
120
120
  private static OrthographicCamera camera;
121
121
  private static Label fpsLabel;
122
122
  private static Stage3d stage3d;
123
+ public static InputMultiplexer inputMux = new InputMultiplexer();
123
124
  private static CameraInputController camController;
124
125
  public static boolean use3d = true;
125
126
 
@@ -229,14 +230,13 @@ public final class Stage implements ApplicationListener {
229
230
  camera.setToOrtho(false, targetWidth, targetHeight);
230
231
  camera.position.set(targetWidth/2, targetHeight/2, 0);
231
232
  stage2d.setCamera(camera);
232
- Gdx.input.setCatchBackKey(true);
233
- Gdx.input.setCatchMenuKey(true);
234
- Gdx.input.setInputProcessor(stage2d);
233
+ inputMux.addProcessor(stage2d);
235
234
  stage2d.addListener(touchInput);
236
235
  if(use3d){
237
236
  stage3d = new Stage3d();
238
237
  camController = new CameraInputController(stage3d.getCamera());
238
+ inputMux.addProcessor(stage3d);
239
- //Gdx.input.setInputProcessor(camController);
239
+ inputMux.addProcessor(camController);
240
240
  }
241
241
  shapeRenderer = new ShapeRenderer();
242
242
  Serializer.initialize();
@@ -246,6 +246,9 @@ public final class Stage implements ApplicationListener {
246
246
  setScene(Scene.scenesMap.firstKey());
247
247
  xlines = (int)Gdx.graphics.getWidth()/dots;
248
248
  ylines = (int)Gdx.graphics.getHeight()/dots;
249
+ Gdx.input.setCatchBackKey(true);
250
+ Gdx.input.setCatchMenuKey(true);
251
+ Gdx.input.setInputProcessor(inputMux);
249
252
  }
250
253
 
251
254
  /*
@@ -262,14 +265,14 @@ public final class Stage implements ApplicationListener {
262
265
  Gdx.gl.glClearColor(bgColor.r, bgColor.g, bgColor.b, bgColor.a);
263
266
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT |GL20.GL_DEPTH_BUFFER_BIT);
264
267
  Asset.load();
265
- stage2d.act();//Gdx.graphics.getDeltaTime();
266
- stage2d.draw();
267
- updateController();
268
268
  if(use3d){
269
269
  stage3d.act();
270
270
  stage3d.draw();
271
271
  camController.update();
272
272
  }
273
+ stage2d.act();//Gdx.graphics.getDeltaTime();
274
+ stage2d.draw();
275
+ updateController();
273
276
  if(debug){
274
277
  shapeRenderer.begin(ShapeType.Point);
275
278
  shapeRenderer.setColor(Color.BLACK);
@@ -359,10 +362,6 @@ public final class Stage implements ApplicationListener {
359
362
  return stage2d.getRoot();
360
363
  }
361
364
 
362
- public static void clearAllListeners(){
363
- hudActors.clear();
364
- }
365
-
366
365
  /**
367
366
  * Get screen time from start in format of HH:MM:SS. It is calculated from
368
367
  * "secondsTime" parameter.
@@ -409,6 +408,7 @@ public final class Stage implements ApplicationListener {
409
408
  stage2d.getRoot().setPosition(0, 0);
410
409
  stage2d.getRoot().setSize(targetWidth, targetHeight);
411
410
  stage2d.getRoot().setBounds(0,0,targetWidth,targetHeight);
411
+ stage2d.getRoot().setCullingArea(getBounds(stage2d.getRoot()));
412
412
  stage2d.getRoot().setColor(1f, 1f, 1f, 1f);
413
413
  stage2d.getRoot().setVisible(true);
414
414
  stage3d.getRoot().setPosition(0, 0, 0);
@@ -501,12 +501,15 @@ public final class Stage implements ApplicationListener {
501
501
  }
502
502
 
503
503
  public static void addActor(Actor actor){
504
+ if(actor != null)
504
- stage2d.addActor(actor);
505
+ stage2d.addActor(actor);
505
506
  }
506
507
 
507
508
  public static void addActor(Actor actor, float x, float y){
509
+ if(actor != null){
508
- actor.setPosition(x, y);
510
+ actor.setPosition(x, y);
509
- stage2d.addActor(actor);
511
+ stage2d.addActor(actor);
512
+ }
510
513
  }
511
514
 
512
515
  public static void addActorWithDelay(final Actor actor, float delay){
@@ -521,8 +524,10 @@ public final class Stage implements ApplicationListener {
521
524
  /* If you want to make any elements/actors to move along with the camera
522
525
  * like HUD's add them using this method */
523
526
  public static void addHud(Actor actor){
527
+ if(actor != null){
524
- addActor(actor);
528
+ addActor(actor);
525
- hudActors.add(actor);
529
+ hudActors.add(actor);
530
+ }
526
531
  }
527
532
 
528
533
  /* If you want to any elements/actors which was a Hud the use this */
@@ -589,7 +594,7 @@ public final class Stage implements ApplicationListener {
589
594
  public static void clear(){
590
595
  if(currentScene != null)
591
596
  currentScene.onDispose();
592
- disablePanning();
597
+ usePan = false;
593
598
  followActor(null);
594
599
  hudActors.clear();
595
600
  resetCamera();
@@ -636,7 +641,7 @@ public final class Stage implements ApplicationListener {
636
641
  dialog.button("No", "No");
637
642
  dialog.pack();
638
643
  dialog.show(stage2d);
639
- //if(dialog.result().equals("Yes")) //update Gdx
644
+ //if(dialog.result().equals("Yes")) FIXME update Gdx
640
645
  // return true;
641
646
  return false;
642
647
  }
@@ -651,7 +656,6 @@ public final class Stage implements ApplicationListener {
651
656
  private static float lastPercent;
652
657
  private static float percentDelta;
653
658
  private static float panSpeedX, panSpeedY;
654
- //private static final Vector3 mousePos = new Vector3();
655
659
 
656
660
  public void moveTo(float x, float y) {
657
661
  moveTo(x, y, 0f);
@@ -790,10 +794,8 @@ public final class Stage implements ApplicationListener {
790
794
  mouse.y = Gdx.graphics.getHeight() - Gdx.input.getY();
791
795
  if(!moveCompleted)
792
796
  moveByAction(stateTime);
793
- if(hasControl){
797
+ if(usePan)
794
- if(Config.usePan) panCameraWithMouse();
798
+ panCameraWithMouse();
795
- if(Config.useKeyboard) panCameraWithKeyboard();
796
- }
797
799
  if(followedActor != null)
798
800
  follow();
799
801
  }
@@ -801,29 +803,7 @@ public final class Stage implements ApplicationListener {
801
803
  /***********************************************************************************************************
802
804
  * 2d Controller Related Functions *
803
805
  ************************************************************************************************************/
804
- private static boolean hasControl = false;
805
-
806
- /*
807
- * This will allow you to move the camera using the keyboard key up, left, right, down
808
- * when Config.useKeyboard is true.
809
- * This will allow you to move the camera using the mouse when the mouse reaches the edges of the screen
810
- * when Config.usePan is true.
811
- * This will allow you to move the camera using the mouse when dragging the mouse
812
- * when Config.useDrag is true.
813
- */
814
- public static void enablePanning(){
806
+ public static boolean usePan;
815
- hasControl = true;
816
- }
817
-
818
- /*
819
- * This disables all automatic panning and moving of camera
820
- */
821
- public static void disablePanning(){
822
- hasControl = false;
823
- }
824
-
825
-
826
-
827
807
  private float panSpeed = 5f;
828
808
  private float panXLeftOffset = 100;
829
809
  private float panXRightOffset = 0;//Gdx.graphics.getWidth() - 100;
@@ -871,21 +851,6 @@ public final class Stage implements ApplicationListener {
871
851
  else if(mouse.y < panYUpOffset && camera.position.y < mapOffsetY -5) moveBy(0, 1f, panSpeed);
872
852
  else if(mouse.y > panYDownOffset && camera.position.y > camOffsetYBot +5) moveBy(0, -1f, panSpeed);
873
853
  }
874
-
875
- private void panCameraWithKeyboard(){
876
- if(Gdx.input.isKeyPressed(Keys.LEFT))
877
- //if(camera.position.x > camOffsetX +5)
878
- moveBy(-panSpeed, 0);
879
- else if(Gdx.input.isKeyPressed(Keys.RIGHT))
880
- //if(camera.position.x < mapOffsetX - 5)
881
- moveBy(panSpeed, 0);
882
- else if(Gdx.input.isKeyPressed(Keys.UP))
883
- //if(camera.position.y < mapOffsetY -5)
884
- moveBy(0, panSpeed);
885
- else if(Gdx.input.isKeyPressed(Keys.DOWN))
886
- //if(camera.position.y > camOffsetYBot +5)
887
- moveBy(0, -panSpeed);
888
- }
889
854
 
890
855
  /*
891
856
  * Gesture related
@@ -986,7 +951,6 @@ public final class Stage implements ApplicationListener {
986
951
 
987
952
  @Override
988
953
  public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){
989
- super.touchDown(event, x, y, pointer, button);
990
954
  mouse.set(x, y);
991
955
  Stage.pointer = pointer;
992
956
  Stage.button = button;
@@ -996,7 +960,7 @@ public final class Stage implements ApplicationListener {
996
960
  validActor = hit(x,y);
997
961
  if(isValidActor(validActor))
998
962
  currentScene.onTouchDown(validActor);
999
- return true;
963
+ return super.touchDown(event, x, y, pointer, button);
1000
964
  }
1001
965
 
1002
966
 
@@ -1014,8 +978,8 @@ public final class Stage implements ApplicationListener {
1014
978
  currentScene.onGesture(getGestureDirection());
1015
979
  }
1016
980
  }
1017
- if(hasControl)
981
+ if(Config.useDrag)
1018
- if(Config.useDrag) dragCam((int)x, (int)-y);
982
+ dragCam((int)x, (int)-y);
1019
983
  }
1020
984
 
1021
985
  @Override
@@ -1037,10 +1001,26 @@ public final class Stage implements ApplicationListener {
1037
1001
  prevDifY = 0.0f;
1038
1002
  // reset Gesture
1039
1003
  currentScene.onTouchUp();
1040
- if(hasControl)
1041
- last.set(-1, -1, -1);
1004
+ last.set(-1, -1, -1);
1042
1005
  gestureStarted = false;
1043
1006
  }
1007
+
1008
+ @Override
1009
+ public boolean keyTyped(InputEvent event, char key) {
1010
+ currentScene.onKeyTyped(key);
1011
+ return super.keyUp(event, key);
1012
+ }
1013
+
1014
+ @Override
1015
+ public boolean keyUp(InputEvent event, int keycode) {
1016
+ currentScene.onKeyUp(keycode);
1017
+ return super.keyUp(event, keycode);
1018
+ }
1019
+ @Override
1020
+ public boolean keyDown(InputEvent event, int keycode) {
1021
+ currentScene.onKeyDown(keycode);
1022
+ return super.keyDown(event, keycode);
1023
+ }
1044
1024
  };
1045
1025
 
1046
1026
  /***********************************************************************************************************
@@ -1082,6 +1062,11 @@ public final class Stage implements ApplicationListener {
1082
1062
  * Utilities Related Functions *
1083
1063
  ************************************************************************************************************/
1084
1064
 
1065
+ /*
1066
+ * The the angle in degrees of the inclination of a line
1067
+ * @param cx, cy The center point x, y
1068
+ * @param tx, ty The target point x, y
1069
+ */
1085
1070
  public static float getAngle(float cx, float cy, float tx, float ty) {
1086
1071
  float angle = (float) Math.toDegrees(MathUtils.atan2(tx - cx, ty - cy));
1087
1072
  //if(angle < 0){
@@ -1090,16 +1075,15 @@ public final class Stage implements ApplicationListener {
1090
1075
  return angle;
1091
1076
  }
1092
1077
 
1078
+ private static Vector2 distVector = new Vector2();
1093
1079
  public static final float getDistance(Actor a, Actor b){
1080
+ distVector.set(a.getX(), a.getY());
1094
- float dx = java.lang.Math.abs(a.getX() - b.getX());
1081
+ return distVector.dst(b.getX(), b.getY());
1095
- float dy = java.lang.Math.abs(a.getY() - b.getY());
1096
- return (float)java.lang.Math.sqrt(dx*dx + dy*dy);
1097
1082
  }
1098
1083
 
1099
1084
  public static final float getDistance(float x1, float y1, float x2, float y2){
1100
- float dx = java.lang.Math.abs(x1 - x2);
1085
+ distVector.set(x1, y1);
1101
- float dy = java.lang.Math.abs(y1 - y2);
1102
- return (float)java.lang.Math.sqrt(dx*dx + dy*dy);
1086
+ return distVector.dst(x2, y2);
1103
1087
  }
1104
1088
 
1105
1089
  /*
@@ -1119,7 +1103,7 @@ public final class Stage implements ApplicationListener {
1119
1103
  return text.substring(0, 1).toLowerCase()+text.substring(1);
1120
1104
  }
1121
1105
 
1122
- public static Rectangle getBoundingBox(Actor actor) {
1106
+ public static Rectangle getBounds(Actor actor) {
1123
1107
  float posX = actor.getX();
1124
1108
  float posY = actor.getY();
1125
1109
  float width = actor.getWidth();
@@ -1128,7 +1112,7 @@ public final class Stage implements ApplicationListener {
1128
1112
  }
1129
1113
 
1130
1114
  public static boolean collides(Actor actor, float x, float y) {
1131
- Rectangle rectA1 = getBoundingBox(actor);
1115
+ Rectangle rectA1 = getBounds(actor);
1132
1116
  Rectangle rectA2 = new Rectangle(x, y, 5, 5);
1133
1117
  // Check if rectangles collides
1134
1118
  if (Intersector.overlaps(rectA1, rectA2)) {
@@ -1139,8 +1123,8 @@ public final class Stage implements ApplicationListener {
1139
1123
  }
1140
1124
 
1141
1125
  public static boolean collides(Actor actor1, Actor actor2) {
1142
- Rectangle rectA1 = getBoundingBox(actor1);
1126
+ Rectangle rectA1 = getBounds(actor1);
1143
- Rectangle rectA2 = getBoundingBox(actor2);
1127
+ Rectangle rectA2 = getBounds(actor2);
1144
1128
  // Check if rectangles collides
1145
1129
  if (Intersector.overlaps(rectA1, rectA2)) {
1146
1130
  return true;
@@ -1152,18 +1136,18 @@ public final class Stage implements ApplicationListener {
1152
1136
  /*
1153
1137
  * TEA Encryption and Decryption
1154
1138
  */
1155
- public static String teaKey = "Default";
1139
+ public static String encryptKey = "Default";
1156
- private static final int delta = 0x9E3779B9;
1140
+ private static final int encryptDelta = 0x9E3779B9;
1157
1141
  private static final int MX(int sum, int y, int z, int p, int e, int[] k) {
1158
1142
  return (z >>> 5 ^ y << 2) + (y >>> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z);
1159
1143
  }
1160
1144
 
1161
1145
  public static final byte[] encrypt(String data) {
1162
- return encrypt(data.getBytes(), teaKey.getBytes());
1146
+ return encrypt(data.getBytes(), encryptKey.getBytes());
1163
1147
  }
1164
1148
 
1165
1149
  public static final byte[] decrypt(String data) {
1166
- return decrypt(data.getBytes(), teaKey.getBytes());
1150
+ return decrypt(data.getBytes(), encryptKey.getBytes());
1167
1151
  }
1168
1152
 
1169
1153
  public static final byte[] encrypt(String data, String key) {
@@ -1202,7 +1186,7 @@ public final class Stage implements ApplicationListener {
1202
1186
  int p, q = 6 + 52 / (n + 1);
1203
1187
 
1204
1188
  while (q-- > 0) {
1205
- sum = sum + delta;
1189
+ sum = sum + encryptDelta;
1206
1190
  e = sum >>> 2 & 3;
1207
1191
  for (p = 0; p < n; p++) {
1208
1192
  y = v[p + 1];
@@ -1229,7 +1213,7 @@ public final class Stage implements ApplicationListener {
1229
1213
  int z = v[n], y = v[0], sum, e;
1230
1214
  int p, q = 6 + 52 / (n + 1);
1231
1215
 
1232
- sum = q * delta;
1216
+ sum = q * encryptDelta;
1233
1217
  while (sum != 0) {
1234
1218
  e = sum >>> 2 & 3;
1235
1219
  for (p = n; p > 0; p--) {
@@ -1238,7 +1222,7 @@ public final class Stage implements ApplicationListener {
1238
1222
  }
1239
1223
  z = v[n];
1240
1224
  y = v[0] -= MX(sum, y, z, p, e, k);
1241
- sum = sum - delta;
1225
+ sum = sum - encryptDelta;
1242
1226
  }
1243
1227
  return v;
1244
1228
  }
test/asset CHANGED
@@ -1 +1 @@
1
- {font:"arial.fnt,font1.fnt,font2.fnt,font3.fnt,normal.fnt,",atlas:"charset.atlas,imageatlas.atlas,tic.atlas,",sound:"click.mp3,",music:""}
1
+ {font:"arial.fnt,font1.fnt,font2.fnt,font3.fnt,normal.fnt,",atlas:"imageatlas.atlas,tic.atlas,pack.atlas,charset.atlas,",sound:"click.mp3,",music:""}
test/atlas/charset.atlas CHANGED
@@ -3,311 +3,311 @@ charset.png
3
3
  format: RGBA8888
4
4
  filter: Nearest,Nearest
5
5
  repeat: none
6
- porcalais
7
- rotate: false
8
- xy: 0, 4
9
- size: 60, 60
6
+ 661
10
- orig: 60, 60
11
- offset: 0, 0
12
- index: -1
13
- porsabra
14
- rotate: false
15
- xy: 60, 4
16
- size: 60, 60
17
- orig: 60, 60
18
- offset: 0, 0
19
- index: -1
20
- porgarett
21
- rotate: false
22
- xy: 120, 4
23
- size: 60, 60
24
- orig: 60, 60
25
- offset: 0, 0
26
- index: -1
27
- portiberon
28
7
  rotate: false
29
- xy: 180, 4
8
+ xy: 643, 58
30
- size: 60, 60
9
+ size: 6, 6
31
- orig: 60, 60
10
+ orig: 6, 6
32
11
  offset: 0, 0
33
12
  index: -1
34
- poralfador
13
+ 662
35
14
  rotate: false
36
- xy: 240, 4
15
+ xy: 620, 19
37
- size: 60, 60
16
+ size: 6, 6
38
- orig: 60, 60
17
+ orig: 6, 6
39
18
  offset: 0, 0
40
19
  index: -1
41
- porbaldarov
20
+ 663
42
21
  rotate: false
43
- xy: 300, 4
22
+ xy: 627, 26
44
- size: 60, 60
23
+ size: 6, 6
45
- orig: 60, 60
24
+ orig: 6, 6
46
25
  offset: 0, 0
47
26
  index: -1
48
- porserpentknight
27
+ 771
49
28
  rotate: false
50
- xy: 360, 4
29
+ xy: 636, 57
51
- size: 60, 60
30
+ size: 7, 7
52
- orig: 60, 60
31
+ orig: 7, 7
53
32
  offset: 0, 0
54
33
  index: -1
55
- porlord
34
+ 772
56
35
  rotate: false
57
- xy: 420, 4
36
+ xy: 620, 25
58
- size: 60, 60
37
+ size: 7, 7
59
- orig: 60, 60
38
+ orig: 7, 7
60
39
  offset: 0, 0
61
40
  index: -1
62
- porwizard
41
+ 775
63
42
  rotate: false
64
- xy: 480, 4
43
+ xy: 636, 50
65
- size: 60, 60
44
+ size: 7, 7
66
- orig: 60, 60
45
+ orig: 7, 7
67
46
  offset: 0, 0
68
47
  index: -1
69
- baldarov01
48
+ alfador00
70
49
  rotate: false
71
50
  xy: 540, 48
72
51
  size: 16, 16
73
52
  orig: 16, 16
74
53
  offset: 0, 0
75
54
  index: -1
76
- calais00
55
+ alfador01
77
56
  rotate: false
78
- xy: 540, 32
57
+ xy: 540, 48
79
58
  size: 16, 16
80
59
  orig: 16, 16
81
60
  offset: 0, 0
82
61
  index: -1
83
- calais01
62
+ baldarov00
84
63
  rotate: false
85
64
  xy: 540, 32
86
65
  size: 16, 16
87
66
  orig: 16, 16
88
67
  offset: 0, 0
89
68
  index: -1
90
- earcher
69
+ baldarov01
91
70
  rotate: false
92
71
  xy: 556, 48
93
72
  size: 16, 16
94
73
  orig: 16, 16
95
74
  offset: 0, 0
96
75
  index: -1
97
- esoldier
76
+ calais00
98
77
  rotate: false
99
78
  xy: 540, 16
100
79
  size: 16, 16
101
80
  orig: 16, 16
102
81
  offset: 0, 0
103
82
  index: -1
104
- garett01
83
+ calais01
105
84
  rotate: false
106
- xy: 540, 0
85
+ xy: 540, 16
107
86
  size: 16, 16
108
87
  orig: 16, 16
109
88
  offset: 0, 0
110
89
  index: -1
111
- garett00
90
+ citizen
112
91
  rotate: false
113
- xy: 556, 32
92
+ xy: 540, 0
114
93
  size: 16, 16
115
94
  orig: 16, 16
116
95
  offset: 0, 0
117
96
  index: -1
118
- lord00
97
+ earcher
119
98
  rotate: false
120
- xy: 572, 48
99
+ xy: 556, 32
121
100
  size: 16, 16
122
101
  orig: 16, 16
123
102
  offset: 0, 0
124
103
  index: -1
125
- lord01
104
+ elemental
126
105
  rotate: false
127
106
  xy: 572, 48
128
107
  size: 16, 16
129
108
  orig: 16, 16
130
109
  offset: 0, 0
131
110
  index: -1
132
- merman
111
+ esoldier
133
112
  rotate: false
134
113
  xy: 556, 16
135
114
  size: 16, 16
136
115
  orig: 16, 16
137
116
  offset: 0, 0
138
117
  index: -1
139
- psoldier
118
+ garett00
140
119
  rotate: false
141
120
  xy: 556, 0
142
121
  size: 16, 16
143
122
  orig: 16, 16
144
123
  offset: 0, 0
145
124
  index: -1
146
- sabra00
125
+ garett01
147
126
  rotate: false
148
127
  xy: 572, 32
149
128
  size: 16, 16
150
129
  orig: 16, 16
151
130
  offset: 0, 0
152
131
  index: -1
153
- sabra01
132
+ lizardman
154
133
  rotate: false
155
- xy: 572, 32
134
+ xy: 588, 48
156
135
  size: 16, 16
157
136
  orig: 16, 16
158
137
  offset: 0, 0
159
138
  index: -1
160
- baldarov00
139
+ lord00
161
140
  rotate: false
162
- xy: 588, 48
141
+ xy: 572, 16
163
142
  size: 16, 16
164
143
  orig: 16, 16
165
144
  offset: 0, 0
166
145
  index: -1
167
- mina
146
+ lord01
168
147
  rotate: false
169
148
  xy: 572, 16
170
149
  size: 16, 16
171
150
  orig: 16, 16
172
151
  offset: 0, 0
173
152
  index: -1
174
- citizen
153
+ merman
175
154
  rotate: false
176
155
  xy: 572, 0
177
156
  size: 16, 16
178
157
  orig: 16, 16
179
158
  offset: 0, 0
180
159
  index: -1
181
- serpentknight00
160
+ mina
182
161
  rotate: false
183
162
  xy: 588, 32
184
163
  size: 16, 16
185
164
  orig: 16, 16
186
165
  offset: 0, 0
187
166
  index: -1
188
- serpentknight01
167
+ pguardian
189
168
  rotate: false
190
- xy: 588, 32
169
+ xy: 604, 48
191
170
  size: 16, 16
192
171
  orig: 16, 16
193
172
  offset: 0, 0
194
173
  index: -1
195
- shaka
174
+ poralfador
196
175
  rotate: false
197
- xy: 604, 48
176
+ xy: 0, 4
198
- size: 16, 16
177
+ size: 60, 60
199
- orig: 16, 16
178
+ orig: 60, 60
200
179
  offset: 0, 0
201
180
  index: -1
181
+ porbaldarov
182
+ rotate: false
183
+ xy: 60, 4
184
+ size: 60, 60
185
+ orig: 60, 60
186
+ offset: 0, 0
187
+ index: -1
188
+ porcalais
189
+ rotate: false
190
+ xy: 120, 4
191
+ size: 60, 60
192
+ orig: 60, 60
193
+ offset: 0, 0
194
+ index: -1
195
+ porgarett
196
+ rotate: false
197
+ xy: 180, 4
198
+ size: 60, 60
199
+ orig: 60, 60
200
+ offset: 0, 0
201
+ index: -1
202
+ porlord
203
+ rotate: false
204
+ xy: 240, 4
205
+ size: 60, 60
206
+ orig: 60, 60
207
+ offset: 0, 0
208
+ index: -1
209
+ porsabra
210
+ rotate: false
211
+ xy: 300, 4
212
+ size: 60, 60
213
+ orig: 60, 60
214
+ offset: 0, 0
215
+ index: -1
216
+ porserpentknight
217
+ rotate: false
218
+ xy: 360, 4
219
+ size: 60, 60
220
+ orig: 60, 60
221
+ offset: 0, 0
222
+ index: -1
202
- tribeman
223
+ portiberon
224
+ rotate: false
225
+ xy: 420, 4
226
+ size: 60, 60
227
+ orig: 60, 60
228
+ offset: 0, 0
229
+ index: -1
230
+ porwizard
231
+ rotate: false
232
+ xy: 480, 4
233
+ size: 60, 60
234
+ orig: 60, 60
235
+ offset: 0, 0
236
+ index: -1
237
+ psoldier
203
238
  rotate: false
204
239
  xy: 588, 16
205
240
  size: 16, 16
206
241
  orig: 16, 16
207
242
  offset: 0, 0
208
243
  index: -1
209
- alfador00
244
+ sabra00
210
245
  rotate: false
211
246
  xy: 588, 0
212
247
  size: 16, 16
213
248
  orig: 16, 16
214
249
  offset: 0, 0
215
250
  index: -1
216
- alfador01
251
+ sabra01
217
252
  rotate: false
218
253
  xy: 588, 0
219
254
  size: 16, 16
220
255
  orig: 16, 16
221
256
  offset: 0, 0
222
257
  index: -1
223
- tiberon00
258
+ serpentknight00
224
259
  rotate: false
225
260
  xy: 604, 32
226
261
  size: 16, 16
227
262
  orig: 16, 16
228
263
  offset: 0, 0
229
264
  index: -1
230
- tiberon01
265
+ serpentknight01
231
266
  rotate: false
232
267
  xy: 604, 32
233
268
  size: 16, 16
234
269
  orig: 16, 16
235
270
  offset: 0, 0
236
271
  index: -1
237
- pguardian
272
+ shaka
238
273
  rotate: false
239
274
  xy: 620, 48
240
275
  size: 16, 16
241
276
  orig: 16, 16
242
277
  offset: 0, 0
243
278
  index: -1
244
- elemental
279
+ tiberon00
245
280
  rotate: false
246
281
  xy: 604, 16
247
282
  size: 16, 16
248
283
  orig: 16, 16
249
284
  offset: 0, 0
250
285
  index: -1
251
- wizard00
286
+ tiberon01
252
287
  rotate: false
253
- xy: 604, 0
288
+ xy: 604, 16
254
289
  size: 16, 16
255
290
  orig: 16, 16
256
291
  offset: 0, 0
257
292
  index: -1
258
- wizard01
293
+ tribeman
259
294
  rotate: false
260
295
  xy: 604, 0
261
296
  size: 16, 16
262
297
  orig: 16, 16
263
298
  offset: 0, 0
264
299
  index: -1
265
- lizardman
300
+ wizard00
266
301
  rotate: false
267
302
  xy: 620, 32
268
303
  size: 16, 16
269
304
  orig: 16, 16
270
305
  offset: 0, 0
271
306
  index: -1
272
- 771
273
- rotate: false
274
- xy: 636, 57
275
- size: 7, 7
307
+ wizard01
276
- orig: 7, 7
277
- offset: 0, 0
278
- index: -1
279
- 772
280
- rotate: false
281
- xy: 620, 25
282
- size: 7, 7
283
- orig: 7, 7
284
- offset: 0, 0
285
- index: -1
286
- 775
287
- rotate: false
288
- xy: 636, 50
289
- size: 7, 7
290
- orig: 7, 7
291
- offset: 0, 0
292
- index: -1
293
- 661
294
- rotate: false
295
- xy: 643, 58
296
- size: 6, 6
297
- orig: 6, 6
298
- offset: 0, 0
299
- index: -1
300
- 662
301
- rotate: false
302
- xy: 620, 19
303
- size: 6, 6
304
- orig: 6, 6
305
- offset: 0, 0
306
- index: -1
307
- 663
308
308
  rotate: false
309
- xy: 627, 26
309
+ xy: 620, 32
310
- size: 6, 6
310
+ size: 16, 16
311
- orig: 6, 6
311
+ orig: 16, 16
312
312
  offset: 0, 0
313
313
  index: -1
test/atlas/charset.png CHANGED
Binary file
test/atlas/pack.atlas ADDED
@@ -0,0 +1,325 @@
1
+
2
+ pack.png
3
+ format: RGBA8888
4
+ filter: Nearest,Nearest
5
+ repeat: none
6
+ concrete
7
+ rotate: false
8
+ xy: 0, 0
9
+ size: 512, 512
10
+ orig: 512, 512
11
+ offset: 0, 0
12
+ index: -1
13
+
14
+ pack2.png
15
+ format: RGBA8888
16
+ filter: Nearest,Nearest
17
+ repeat: none
18
+ charset/661
19
+ rotate: false
20
+ xy: 643, 58
21
+ size: 6, 6
22
+ orig: 6, 6
23
+ offset: 0, 0
24
+ index: -1
25
+ charset/662
26
+ rotate: false
27
+ xy: 620, 19
28
+ size: 6, 6
29
+ orig: 6, 6
30
+ offset: 0, 0
31
+ index: -1
32
+ charset/663
33
+ rotate: false
34
+ xy: 627, 26
35
+ size: 6, 6
36
+ orig: 6, 6
37
+ offset: 0, 0
38
+ index: -1
39
+ charset/771
40
+ rotate: false
41
+ xy: 636, 57
42
+ size: 7, 7
43
+ orig: 7, 7
44
+ offset: 0, 0
45
+ index: -1
46
+ charset/772
47
+ rotate: false
48
+ xy: 620, 25
49
+ size: 7, 7
50
+ orig: 7, 7
51
+ offset: 0, 0
52
+ index: -1
53
+ charset/775
54
+ rotate: false
55
+ xy: 636, 50
56
+ size: 7, 7
57
+ orig: 7, 7
58
+ offset: 0, 0
59
+ index: -1
60
+ charset/alfador00
61
+ rotate: false
62
+ xy: 540, 48
63
+ size: 16, 16
64
+ orig: 16, 16
65
+ offset: 0, 0
66
+ index: -1
67
+ charset/alfador01
68
+ rotate: false
69
+ xy: 540, 48
70
+ size: 16, 16
71
+ orig: 16, 16
72
+ offset: 0, 0
73
+ index: -1
74
+ charset/baldarov00
75
+ rotate: false
76
+ xy: 540, 32
77
+ size: 16, 16
78
+ orig: 16, 16
79
+ offset: 0, 0
80
+ index: -1
81
+ charset/baldarov01
82
+ rotate: false
83
+ xy: 556, 48
84
+ size: 16, 16
85
+ orig: 16, 16
86
+ offset: 0, 0
87
+ index: -1
88
+ charset/calais00
89
+ rotate: false
90
+ xy: 540, 16
91
+ size: 16, 16
92
+ orig: 16, 16
93
+ offset: 0, 0
94
+ index: -1
95
+ charset/calais01
96
+ rotate: false
97
+ xy: 540, 16
98
+ size: 16, 16
99
+ orig: 16, 16
100
+ offset: 0, 0
101
+ index: -1
102
+ charset/citizen
103
+ rotate: false
104
+ xy: 540, 0
105
+ size: 16, 16
106
+ orig: 16, 16
107
+ offset: 0, 0
108
+ index: -1
109
+ charset/earcher
110
+ rotate: false
111
+ xy: 556, 32
112
+ size: 16, 16
113
+ orig: 16, 16
114
+ offset: 0, 0
115
+ index: -1
116
+ charset/elemental
117
+ rotate: false
118
+ xy: 572, 48
119
+ size: 16, 16
120
+ orig: 16, 16
121
+ offset: 0, 0
122
+ index: -1
123
+ charset/esoldier
124
+ rotate: false
125
+ xy: 556, 16
126
+ size: 16, 16
127
+ orig: 16, 16
128
+ offset: 0, 0
129
+ index: -1
130
+ charset/garett00
131
+ rotate: false
132
+ xy: 556, 0
133
+ size: 16, 16
134
+ orig: 16, 16
135
+ offset: 0, 0
136
+ index: -1
137
+ charset/garett01
138
+ rotate: false
139
+ xy: 572, 32
140
+ size: 16, 16
141
+ orig: 16, 16
142
+ offset: 0, 0
143
+ index: -1
144
+ charset/lizardman
145
+ rotate: false
146
+ xy: 588, 48
147
+ size: 16, 16
148
+ orig: 16, 16
149
+ offset: 0, 0
150
+ index: -1
151
+ charset/lord00
152
+ rotate: false
153
+ xy: 572, 16
154
+ size: 16, 16
155
+ orig: 16, 16
156
+ offset: 0, 0
157
+ index: -1
158
+ charset/lord01
159
+ rotate: false
160
+ xy: 572, 16
161
+ size: 16, 16
162
+ orig: 16, 16
163
+ offset: 0, 0
164
+ index: -1
165
+ charset/merman
166
+ rotate: false
167
+ xy: 572, 0
168
+ size: 16, 16
169
+ orig: 16, 16
170
+ offset: 0, 0
171
+ index: -1
172
+ charset/mina
173
+ rotate: false
174
+ xy: 588, 32
175
+ size: 16, 16
176
+ orig: 16, 16
177
+ offset: 0, 0
178
+ index: -1
179
+ charset/pguardian
180
+ rotate: false
181
+ xy: 604, 48
182
+ size: 16, 16
183
+ orig: 16, 16
184
+ offset: 0, 0
185
+ index: -1
186
+ charset/poralfador
187
+ rotate: false
188
+ xy: 0, 4
189
+ size: 60, 60
190
+ orig: 60, 60
191
+ offset: 0, 0
192
+ index: -1
193
+ charset/porbaldarov
194
+ rotate: false
195
+ xy: 60, 4
196
+ size: 60, 60
197
+ orig: 60, 60
198
+ offset: 0, 0
199
+ index: -1
200
+ charset/porcalais
201
+ rotate: false
202
+ xy: 120, 4
203
+ size: 60, 60
204
+ orig: 60, 60
205
+ offset: 0, 0
206
+ index: -1
207
+ charset/porgarett
208
+ rotate: false
209
+ xy: 180, 4
210
+ size: 60, 60
211
+ orig: 60, 60
212
+ offset: 0, 0
213
+ index: -1
214
+ charset/porlord
215
+ rotate: false
216
+ xy: 240, 4
217
+ size: 60, 60
218
+ orig: 60, 60
219
+ offset: 0, 0
220
+ index: -1
221
+ charset/porsabra
222
+ rotate: false
223
+ xy: 300, 4
224
+ size: 60, 60
225
+ orig: 60, 60
226
+ offset: 0, 0
227
+ index: -1
228
+ charset/porserpentknight
229
+ rotate: false
230
+ xy: 360, 4
231
+ size: 60, 60
232
+ orig: 60, 60
233
+ offset: 0, 0
234
+ index: -1
235
+ charset/portiberon
236
+ rotate: false
237
+ xy: 420, 4
238
+ size: 60, 60
239
+ orig: 60, 60
240
+ offset: 0, 0
241
+ index: -1
242
+ charset/porwizard
243
+ rotate: false
244
+ xy: 480, 4
245
+ size: 60, 60
246
+ orig: 60, 60
247
+ offset: 0, 0
248
+ index: -1
249
+ charset/psoldier
250
+ rotate: false
251
+ xy: 588, 16
252
+ size: 16, 16
253
+ orig: 16, 16
254
+ offset: 0, 0
255
+ index: -1
256
+ charset/sabra00
257
+ rotate: false
258
+ xy: 588, 0
259
+ size: 16, 16
260
+ orig: 16, 16
261
+ offset: 0, 0
262
+ index: -1
263
+ charset/sabra01
264
+ rotate: false
265
+ xy: 588, 0
266
+ size: 16, 16
267
+ orig: 16, 16
268
+ offset: 0, 0
269
+ index: -1
270
+ charset/serpentknight00
271
+ rotate: false
272
+ xy: 604, 32
273
+ size: 16, 16
274
+ orig: 16, 16
275
+ offset: 0, 0
276
+ index: -1
277
+ charset/serpentknight01
278
+ rotate: false
279
+ xy: 604, 32
280
+ size: 16, 16
281
+ orig: 16, 16
282
+ offset: 0, 0
283
+ index: -1
284
+ charset/shaka
285
+ rotate: false
286
+ xy: 620, 48
287
+ size: 16, 16
288
+ orig: 16, 16
289
+ offset: 0, 0
290
+ index: -1
291
+ charset/tiberon00
292
+ rotate: false
293
+ xy: 604, 16
294
+ size: 16, 16
295
+ orig: 16, 16
296
+ offset: 0, 0
297
+ index: -1
298
+ charset/tiberon01
299
+ rotate: false
300
+ xy: 604, 16
301
+ size: 16, 16
302
+ orig: 16, 16
303
+ offset: 0, 0
304
+ index: -1
305
+ charset/tribeman
306
+ rotate: false
307
+ xy: 604, 0
308
+ size: 16, 16
309
+ orig: 16, 16
310
+ offset: 0, 0
311
+ index: -1
312
+ charset/wizard00
313
+ rotate: false
314
+ xy: 620, 32
315
+ size: 16, 16
316
+ orig: 16, 16
317
+ offset: 0, 0
318
+ index: -1
319
+ charset/wizard01
320
+ rotate: false
321
+ xy: 620, 32
322
+ size: 16, 16
323
+ orig: 16, 16
324
+ offset: 0, 0
325
+ index: -1
test/atlas/pack.png ADDED
Binary file
test/atlas/pack2.png ADDED
Binary file
test/config CHANGED
@@ -2,8 +2,8 @@
2
2
  title: Game1,
3
3
  version: "0.45",
4
4
  hasIcon: true,
5
- targetSize: "860x650",
5
+ targetSize: "800x480",
6
- screenSize: "860x650",
6
+ screenSize: "800x480",
7
7
  audioBufferCount: "10",
8
8
  resize: "false",
9
9
  forceExit: "false",
@@ -15,5 +15,5 @@ keepAspectRatio: "false",
15
15
  showFPS: "true",
16
16
  loggingEnabled: "true",
17
17
  project: "C:/CODE/RpgIDE/test/",
18
- target: Android
18
+ target: Desktop
19
19
  }
test/model/skydome.g3db ADDED
Binary file
test/model/skydome.png ADDED
Binary file
test/pack/charset/661.png ADDED
Binary file
test/pack/charset/662.png ADDED
Binary file
test/pack/charset/663.png ADDED
Binary file
test/pack/charset/771.png ADDED
Binary file
test/pack/charset/772.png ADDED
Binary file
test/pack/charset/775.png ADDED
Binary file
test/pack/charset/Thumbs.db ADDED
Binary file
test/pack/charset/alfador00.png ADDED
Binary file
test/pack/charset/alfador01.png ADDED
Binary file
test/pack/charset/baldarov00.png ADDED
Binary file
test/pack/charset/baldarov01.png ADDED
Binary file
test/pack/charset/calais00.png ADDED
Binary file
test/pack/charset/calais01.png ADDED
Binary file
test/pack/charset/citizen.png ADDED
Binary file
test/pack/charset/earcher.png ADDED
Binary file
test/pack/charset/elemental.png ADDED
Binary file
test/pack/charset/esoldier.png ADDED
Binary file
test/pack/charset/garett00.png ADDED
Binary file
test/pack/charset/garett01.png ADDED
Binary file
test/pack/charset/lizardman.png ADDED
Binary file
test/pack/charset/lord00.png ADDED
Binary file
test/pack/charset/lord01.png ADDED
Binary file
test/pack/charset/merman.png ADDED
Binary file
test/pack/charset/mina.png ADDED
Binary file
test/pack/charset/pguardian.png ADDED
Binary file
test/pack/charset/poralfador.png ADDED
Binary file
test/pack/charset/porbaldarov.png ADDED
Binary file
test/pack/charset/porcalais.png ADDED
Binary file
test/pack/charset/porgarett.png ADDED
Binary file
test/pack/charset/porlord.png ADDED
Binary file
test/pack/charset/porsabra.png ADDED
Binary file
test/pack/charset/porserpentknight.png ADDED
Binary file
test/pack/charset/portiberon.png ADDED
Binary file
test/pack/charset/porwizard.png ADDED
Binary file
test/pack/charset/psoldier.png ADDED
Binary file
test/pack/charset/sabra00.png ADDED
Binary file
test/pack/charset/sabra01.png ADDED
Binary file
test/pack/charset/serpentknight00.png ADDED
Binary file
test/pack/charset/serpentknight01.png ADDED
Binary file
test/pack/charset/shaka.png ADDED
Binary file
test/pack/charset/tiberon00.png ADDED
Binary file
test/pack/charset/tiberon01.png ADDED
Binary file
test/pack/charset/tribeman.png ADDED
Binary file
test/pack/charset/wizard00.png ADDED
Binary file
test/pack/charset/wizard01.png ADDED
Binary file
test/pack/concrete.png ADDED
Binary file
test/scene CHANGED
@@ -1,59 +1,57 @@
1
- {Splash:"{class:SceneJson,background:\"None\",music:\"None\",transition:\"None\",duration:1.0,interpolation:Bounce}
2
- ",Menu:"{class:SceneJson,background:\"img_bg_1_\",music:\"None\",transition:\"FadeIn\",duration:1.0,interpolation:Exp10In}
3
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Options,x:251.96078,y:262,width:329,height:73.270874,color:ccccffff,ox:0,oy:0,rotation:0,text:Options,fontName:font2}
4
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Play,x:307.84314,y:406,width:199.86148,height:84,color:ffccccff,ox:0,oy:0,rotation:0,text:Play,fontName:font2}
5
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Exit,x:316.6667,y:68,width:159,height:84,color:\"000000ff\",ox:0,oy:0,rotation:0,text:Exit,fontName:font1}
6
- {class:Sprite,name:Sprite1,x:41.176453,y:232,width:59.99997,height:60,color:ffffffff,ox:0,oy:0,rotation:0,textures:\"porgarett,portiberon\",duration:0.5,active:true,looping:true,frameCount:1}
7
- {class:ImageJson,name:Image1,x:200.6209,y:88,width:60,height:68.125,color:ffffffff,ox:0,oy:0,rotation:0,texName:porgarett,effect:PatrolX,value:50,duration:0.7,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:SceneCreated,onEvent:DoEffect,eventScene:None}
8
- {class:ImageJson,name:ImageJson2,x:604.902,y:296,width:122,height:116,color:ffffffff,ox:0,oy:0,rotation:0,texName:img_btn_pause,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
9
- {class:ImageJson,name:ImageJson3,x:473.52942,y:422,width:325,height:60,color:ffffffff,ox:0,oy:0,rotation:0,texName:anim_green_santa,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:Clicked,onEvent:SetScene,eventScene:Options}
10
- {class:ImageJson,name:ImageJson4,x:607.84314,y:263,width:40,height:40,color:ffffffff,ox:0,oy:0,rotation:0,texName:img_obj_snowflake,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
11
- {class:ImageJson,name:ImageJson5,x:565.6863,y:173,width:40,height:40,color:ffffffff,ox:0,oy:0,rotation:0,texName:img_obj_snowflake,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
12
- {class:ImageJson,name:ImageJson6,x:211.52426,y:1,width:325,height:60,color:ffffffff,ox:0,oy:0,rotation:0,texName:anim_black_ghost,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
13
- {class:ImageJson,name:ImageJson7,x:122.54901,y:244,width:40,height:40,color:ffffffff,ox:0,oy:0,rotation:0,texName:img_obj_snowflake,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
14
- {class:ImageJson,name:ImageJson8,x:651.9608,y:7566.8667,width:40,height:40,color:ffffffff,ox:0,oy:0,rotation:0,texName:img_obj_snowflake,effect:PatrolY,value:600,duration:4,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:SceneCreated,onEvent:DoEffect,eventScene:\"\"}
15
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Play3d,x:260.53268,y:345,width:287,height:67,color:ffcc00ff,ox:0,oy:0,rotation:0,text:Play3d,fontName:font1}
16
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label3,x:304.90195,y:169,width:180,height:84,color:\"0707beff\",ox:0,oy:0,rotation:0,text:Help,fontName:font1}
17
- {class:ImageJson,name:ImageJson9,x:174.50981,y:338,width:60,height:60,color:ffffffff,ox:0,oy:0,rotation:0,texName:porcalais,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
18
- ",Options:"{class:SceneJson,background:\"img_bg_1_\",music:\"None\",transition:\"downToUp\",duration:1.0,interpolation:Elastic}
19
- {class:ImageJson,name:Image1,x:63.725494,y:318,width:58.013855,height:69,color:ffffffff,ox:0,oy:0,rotation:0,texName:porgarett,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
20
- {class:com.badlogic.gdx.scenes.scene2d.ui.SelectBox,name:SelectBox1,x:618.62744,y:66,width:76,height:33,color:ffffffff,ox:0,oy:0,rotation:0,text:\"First,Second,Third,Next,Next,\"}
21
- {class:com.badlogic.gdx.scenes.scene2d.ui.List,name:List1,x:583.3334,y:209,width:100,height:100,color:ffffffff,ox:0,oy:0,rotation:0,text:\"Menu,Options,Exit,\"}
22
- {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox1,x:599.213,y:448,width:58,height:25,color:ffffffff,ox:0,oy:0,rotation:0,text:Check}
23
- {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox2,x:596.836,y:407.62714,width:58,height:25,color:ffffffff,ox:0,oy:0,rotation:0,text:Check}
24
- {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox3,x:598.82214,y:368.56702,width:58,height:25,color:ffffffff,ox:0,oy:0,rotation:0,text:Check}
25
- {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox4,x:595.84296,y:330.50848,width:58,height:25,color:ffffffff,ox:0,oy:0,rotation:0,text:Check}
26
- {class:ImageJson,name:Image2,x:159.80391,y:318,width:60,height:60,color:ffffffff,ox:0,oy:0,rotation:0,texName:poralfador,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
27
- {class:ImageJson,name:Image3,x:55.882355,y:231,width:55.0347,height:64,color:ffffffff,ox:0,oy:0,rotation:0,texName:porbaldarov,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
28
- {class:com.badlogic.gdx.scenes.scene2d.ui.TextButton,name:TextButton2,x:457.80597,y:404.6225,width:87,height:27,color:ffffffff,ox:0,oy:0,rotation:0,text:TextButton}
29
- {class:com.badlogic.gdx.scenes.scene2d.ui.TextButton,name:TextButton3,x:455.87964,y:363,width:87,height:27,color:ffffffff,ox:0,oy:0,rotation:0,text:TextButton}
30
- {class:com.badlogic.gdx.scenes.scene2d.ui.TextButton,name:TextButton4,x:462.7714,y:324.49924,width:87,height:27,color:\"00ff00ff\",ox:0,oy:0,rotation:0,text:TextButton}
31
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button1,x:315.68628,y:286,width:107.94458,height:51,color:ffffffff,ox:0,oy:0,rotation:0}
32
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button2,x:319.60785,y:348,width:101.986176,height:63,color:ff0000ff,ox:0,oy:0,rotation:0}
33
- {class:com.badlogic.gdx.scenes.scene2d.ui.List,name:List2,x:698.12933,y:218,width:88.77136,height:100,color:ffffffff,ox:0,oy:0,rotation:0,text:\"First,New,Third,Options,\"}
34
- {class:com.badlogic.gdx.scenes.scene2d.ui.Touchpad,name:Touchpad1,x:8.937653,y:21,width:200,height:200,color:ffffffff,ox:0,oy:0,rotation:0,deadzoneRadius:5}
35
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Back,x:308,y:27,width:180,height:84,color:ffffffff,ox:0,oy:0,rotation:63.97888,text:Back,fontName:font1}
36
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button3,x:625.4902,y:154,width:50,height:50,color:ffffffff,ox:0,oy:0,rotation:-75.012436}
37
- {class:com.badlogic.gdx.scenes.scene2d.ui.Dialog,name:Dialog1,x:296.07843,y:134,width:188,height:131,color:ffffffff,ox:0,oy:0,rotation:0,title:Title,modal:false,move:true,resize:true}
38
- ",Game:"{class:SceneJson,background:\"None\",music:\"None\",transition:\"None\",duration:1.0,interpolation:Exp10In}
39
- {class:ImageJson,name:Player,x:244,y:248,width:60,height:60,color:ffffffff,ox:0,oy:0,rotation:1.3639275,texName:baldarov00,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
40
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Right,x:208.82353,y:107,width:70.85452,height:50,color:ffffffff,ox:0,oy:0,rotation:0}
41
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Back,x:335.29413,y:10,width:180,height:84,color:ffffffff,ox:0,oy:0,rotation:0,text:Back,fontName:font1}
42
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Timer,x:30.392181,y:405,width:245,height:84,color:ffffffff,ox:0,oy:0,rotation:0,text:\"Timer:\",fontName:font1}
43
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Left,x:21.568634,y:98,width:66.61896,height:58,color:ffffffff,ox:0,oy:0,rotation:0}
44
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Up,x:115.68628,y:162,width:69.59813,height:59,color:ffffffff,ox:0,oy:0,rotation:0}
45
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Down,x:110.7843,y:25,width:73.57042,height:57.999985,color:ffffffff,ox:0,oy:0,rotation:0}
46
- {class:ImageJson,name:Enemy,x:613.72546,y:326.4234,width:70.61896,height:59,color:ffffffff,ox:0,oy:0,rotation:0,texName:lord00,effect:PatrolY,value:200,duration:1.5,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:SceneCreated,onEvent:DoEffect,eventScene:\"\"}
47
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Fire,x:651.9608,y:114.99999,width:66.6189,height:47.00003,color:ff6666ff,ox:0,oy:0,rotation:0}
48
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label3,x:31.372559,y:375,width:473,height:31,color:\"000000ff\",ox:0,oy:0,rotation:0,text:\"Collide with enemy within 30 seconds\",fontName:arial}
49
- ",GameWin:"{class:SceneJson,background:\"img_bg_1_\",music:\"None\",transition:\"rightToLeft\",duration:1.0,interpolation:Exp10In}
50
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label1,x:245.09804,y:226,width:294,height:84,color:ffffffff,ox:0,oy:0,rotation:0,text:\"You Win\",fontName:font1}
51
- ",GameOver:"{class:SceneJson,background:\"img_bg_1_\",music:\"None\",transition:\"FadeOut\",duration:3.0,interpolation:Exp10In}
52
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label1,x:229.39955,y:341,width:339,height:84,color:ffffffff,text:\"You Lose\",fontName:font1}
53
- ",Game3d:"{class:SceneJson,background:\"img_bg_1_\",music:\"None\",transition:\"FadeIn\",duration:1.0,interpolation:Exp10In}
54
- {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button1,x:55.882355,y:81,width:50,height:50,color:ffffffff,ox:0,oy:0,rotation:0}
55
- ",TicTacToe:"{class:SceneJson,background:\"None\",music:\"None\",transition:\"FadeIn\",duration:1.0,interpolation:Exp10In}
56
- {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label1,x:238.33719,y:553,width:380,height:84,color:\"000000ff\",ox:0,oy:0,rotation:0,text:TicTacToe,fontName:font1}
57
- ",BasicDemo:"{class:SceneJson,background:\"img_bg_1_\",music:\"None\",transition:\"FadeIn\",duration:1.0,interpolation:Exp10In}
58
- {class:ImageJson,name:PauseButton,x:327.451,y:275,width:120,height:120,color:ffffffff,ox:0,oy:0,rotation:0,texName:img_btn_pause,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
1
+ {Splash:"{class:Scene,background:\"None\",music:\"None\",transition:\"None\",duration:1.0,interpolation:Bounce}
2
+ ",Menu:"{class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Play,x:286.79245,y:402,width:199.86148,height:84,ox:0,oy:0,rotation:0,zindex:1,color:ffccccff,touchable:enabled,visible:true,text:Play,fontName:font2}
3
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Exit,x:305.66037,y:84.999985,width:159,height:84,ox:0,oy:0,rotation:0,zindex:2,color:\"000000ff\",touchable:enabled,visible:true,text:Exit,fontName:font1}
4
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Options,x:221.69812,y:257,width:329,height:73,ox:0,oy:0,rotation:0,zindex:3,color:ccccffff,touchable:enabled,visible:true,text:Options,fontName:font2}
5
+ {class:ImageJson,name:Image1,x:1103.2814,y:82,width:60,height:68.125,ox:30,oy:30,rotation:30,zindex:4,color:ffffffff,touchable:enabled,visible:true,texName:porgarett,effect:PatrolX,value:50,duration:0.7,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:SceneCreated,onEvent:DoEffect,eventScene:None}
6
+ {class:ImageJson,name:ImageJson3,x:486.79248,y:403,width:325,height:60,ox:0,oy:0,rotation:0,zindex:5,color:ffffffff,touchable:enabled,visible:true,texName:anim_green_santa,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:Clicked,onEvent:SetScene,eventScene:Options}
7
+ {class:ImageJson,name:ImageJson5,x:583.9623,y:329,width:40,height:40,ox:0,oy:0,rotation:0,zindex:6,color:ffffffff,touchable:enabled,visible:true,texName:img_obj_snowflake,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
8
+ {class:ImageJson,name:ImageJson6,x:209.43396,y:11,width:325,height:60,ox:0,oy:0,rotation:0,zindex:7,color:ffffffff,touchable:enabled,visible:true,texName:anim_black_ghost,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
9
+ {class:ImageJson,name:ImageJson7,x:624.5283,y:196,width:40,height:40,ox:0,oy:0,rotation:0,zindex:8,color:ffffffff,touchable:enabled,visible:true,texName:img_obj_snowflake,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
10
+ {class:ImageJson,name:ImageJson8,x:564.15094,y:9828.126,width:40,height:40,ox:0,oy:0,rotation:0,zindex:9,color:ffffffff,touchable:enabled,visible:true,texName:img_obj_snowflake,effect:PatrolY,value:600,duration:4,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:SceneCreated,onEvent:DoEffect,eventScene:\"\"}
11
+ {class:ImageJson,name:ImageJson4,x:607.84314,y:263,width:40,height:40,ox:0,oy:0,rotation:0,zindex:10,color:ffffffff,touchable:enabled,visible:true,texName:img_obj_snowflake,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
12
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label3,x:287.73584,y:154,width:180,height:84,ox:0,oy:0,rotation:0,zindex:11,color:\"0707beff\",touchable:enabled,visible:true,text:Help,fontName:font1}
13
+ {class:Sprite,name:Sprite1,x:40,y:236,width:60,height:60,ox:0,oy:0,rotation:0,zindex:12,color:ffffffff,touchable:enabled,visible:true,textures:\"porgarett,portiberon\",duration:0.5,active:true,looping:true,frameCount:1}
14
+ {class:ImageJson,name:ImageJson2,x:NaN,y:NaN,width:125,height:146,ox:0,oy:0,rotation:0,zindex:13,color:ffffffff,touchable:enabled,visible:true,texName:img_btn_pause,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
15
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Play3d,x:244.33963,y:336,width:307,height:67,ox:0,oy:0,rotation:0,zindex:14,color:ffcc00ff,touchable:enabled,visible:true,text:Play3d,fontName:font1}
16
+ {class:Scene,background:img_obj_soil_1_,music:None,transition:rightToLeft,duration:1,interpolation:Circle}
17
+ ",Options:"{class:ImageJson,name:Image1,x:57.54715,y:308,width:58.013855,height:69,ox:0,oy:0,rotation:0,zindex:1,color:ffffffff,touchable:enabled,visible:true,texName:porgarett,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
18
+ {class:com.badlogic.gdx.scenes.scene2d.ui.SelectBox,name:SelectBox1,x:618.62744,y:66,width:76,height:33,ox:0,oy:0,rotation:0,zindex:2,color:ffffffff,touchable:enabled,visible:true,text:\"First,Second,Third,Next,Next,\"}
19
+ {class:com.badlogic.gdx.scenes.scene2d.ui.List,name:List1,x:583.3334,y:209,width:100,height:100,ox:0,oy:0,rotation:0,zindex:3,color:ffffffff,touchable:enabled,visible:true,text:\"Menu,Options,Exit,\"}
20
+ {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox1,x:599.213,y:448,width:58,height:25,ox:0,oy:0,rotation:0,zindex:4,color:ffffffff,touchable:enabled,visible:true,text:Check}
21
+ {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox2,x:596.836,y:407.62714,width:58,height:25,ox:0,oy:0,rotation:0,zindex:5,color:ffffffff,touchable:enabled,visible:true,text:Check}
22
+ {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox3,x:598.82214,y:368.56702,width:58,height:25,ox:0,oy:0,rotation:0,zindex:6,color:ffffffff,touchable:enabled,visible:true,text:Check}
23
+ {class:com.badlogic.gdx.scenes.scene2d.ui.CheckBox,name:CheckBox4,x:595.84296,y:330.50848,width:58,height:25,ox:0,oy:0,rotation:0,zindex:7,color:ffffffff,touchable:enabled,visible:true,text:Check}
24
+ {class:ImageJson,name:Image2,x:57.54715,y:394,width:60,height:60,ox:0,oy:0,rotation:0,zindex:8,color:ffffffff,touchable:enabled,visible:true,texName:poralfador,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
25
+ {class:com.badlogic.gdx.scenes.scene2d.ui.TextButton,name:TextButton2,x:457.80597,y:404.6225,width:87,height:27,ox:0,oy:0,rotation:0,zindex:9,color:ffffffff,touchable:enabled,visible:true,text:TextButton}
26
+ {class:com.badlogic.gdx.scenes.scene2d.ui.TextButton,name:TextButton3,x:455.87964,y:363,width:87,height:27,ox:0,oy:0,rotation:0,zindex:10,color:ffffffff,touchable:enabled,visible:true,text:TextButton}
27
+ {class:com.badlogic.gdx.scenes.scene2d.ui.TextButton,name:TextButton4,x:452.83017,y:316,width:87,height:27,ox:0,oy:0,rotation:0,zindex:11,color:\"00ff00ff\",touchable:enabled,visible:true,text:TextButton}
28
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button1,x:300.9434,y:313,width:107.94458,height:51,ox:0,oy:0,rotation:0,zindex:12,color:ffffffff,touchable:enabled,visible:true}
29
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button2,x:306.60376,y:370,width:101.986176,height:63,ox:0,oy:0,rotation:0,zindex:13,color:ff0000ff,touchable:enabled,visible:true}
30
+ {class:com.badlogic.gdx.scenes.scene2d.ui.List,name:List2,x:698.12933,y:218,width:88.77136,height:100,ox:0,oy:0,rotation:0,zindex:14,color:ffffffff,touchable:enabled,visible:true,text:\"First,New,Third,Options,\"}
31
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Touchpad,name:Touchpad1,x:8.937653,y:21,width:200,height:200,ox:0,oy:0,rotation:0,zindex:15,color:ffffffff,touchable:enabled,visible:true,deadzoneRadius:5}
32
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Back,x:320.7547,y:23,width:180,height:84,ox:0,oy:0,rotation:0,zindex:16,color:ffffffff,touchable:enabled,visible:true,text:Back,fontName:font1}
33
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button3,x:625.4902,y:154,width:50,height:50,ox:0,oy:0,rotation:0,zindex:17,color:ffffffff,touchable:enabled,visible:true}
34
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Dialog,name:Dialog1,x:308.49057,y:105,width:150,height:150,ox:0,oy:0,rotation:0,zindex:18,color:ffffffff,touchable:enabled,visible:true,title:Title,modal:false,move:true,resize:false}
35
+ {class:Scene,background:img_bg_1_,music:None,transition:upToDown,duration:1,interpolation:Circle}
36
+ ",Game:"{class:Scene,background:\"None\",music:\"None\",transition:\"None\",duration:1.0,interpolation:Exp10In}
37
+ {class:ImageJson,name:Player,x:131.13208,y:280,width:60,height:60,ox:0,oy:0,rotation:0,zindex:0,color:ffffffff,touchable:enabled,visible:true,texName:baldarov00,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
38
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Right,x:208.82353,y:107,width:70.85452,height:50,ox:0,oy:0,rotation:0,zindex:1,color:ffffffff,touchable:enabled,visible:true}
39
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Back,x:335.29413,y:10,width:180,height:84,ox:0,oy:0,rotation:0,zindex:2,color:ffffffff,touchable:enabled,visible:true,text:Back,fontName:font1}
40
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Timer,x:30.392181,y:405,width:245,height:84,ox:0,oy:0,rotation:0,zindex:3,color:ffffffff,touchable:enabled,visible:true,text:\"Timer:\",fontName:font1}
41
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Left,x:21.568634,y:98,width:66.61896,height:58,ox:0,oy:0,rotation:0,zindex:4,color:ffffffff,touchable:enabled,visible:true}
42
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Up,x:115.68628,y:162,width:69.59813,height:59,ox:0,oy:0,rotation:0,zindex:5,color:ffffffff,touchable:enabled,visible:true}
43
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Down,x:110.7843,y:25,width:73.57042,height:57.999985,ox:0,oy:0,rotation:0,zindex:6,color:ffffffff,touchable:enabled,visible:true}
44
+ {class:ImageJson,name:Enemy,x:613.72546,y:681.9183,width:70.61896,height:59,ox:0,oy:0,rotation:0,zindex:7,color:ffffffff,touchable:enabled,visible:true,texName:lord00,effect:PatrolY,value:200,duration:1.5,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:SceneCreated,onEvent:DoEffect,eventScene:\"\"}
45
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Fire,x:651.9608,y:114.99999,width:66.6189,height:47.00003,ox:0,oy:0,rotation:0,zindex:8,color:ff6666ff,touchable:enabled,visible:true}
46
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label3,x:31.372559,y:375,width:473,height:31,ox:0,oy:0,rotation:0,zindex:9,color:\"000000ff\",touchable:enabled,visible:true,text:\"Collide with enemy within 30 seconds\",fontName:arial}
47
+ ",GameWin:"{class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label1,x:216.98112,y:329,width:294,height:84,ox:0,oy:0,rotation:0,zindex:1,color:ffffffff,touchable:enabled,visible:true,text:\"You Win\",fontName:font1}
48
+ {class:Scene,background:img_bg_1_,music:None,transition:rightToLeft,duration:1,interpolation:Exp10In}
49
+ ",GameOver:"{class:Scene,background:img_bg_1_,music:None,transition:FadeOut,duration:3,interpolation:Exp10In}
50
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label1,x:205.66037,y:338,width:339,height:84,ox:0,oy:0,rotation:0,zindex:2,color:ffffffff,touchable:enabled,visible:true,text:\"You Lose\",fontName:font1}
51
+ ",Game3d:"{class:Scene,background:None,music:None,transition:FadeIn,duration:1,interpolation:Bounce}
52
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Button,name:Button1,x:81.13208,y:126.99999,width:50,height:50,ox:0,oy:0,rotation:45,zindex:1,color:ffffffff,touchable:enabled,visible:true}
53
+ ",TicTacToe:"{class:Scene,background:\"None\",music:\"None\",transition:\"None\",duration:1.0,interpolation:Exp10In}
54
+ {class:com.badlogic.gdx.scenes.scene2d.ui.Label,name:Label1,x:117.92453,y:429,width:128,height:31,ox:0,oy:0,rotation:0,zindex:0,color:\"000000ff\",touchable:enabled,visible:true,text:TicTacToe,fontName:arial}
55
+ ",BasicDemo:"{class:Scene,background:\"img_bg_1_\",music:\"None\",transition:\"FadeIn\",duration:1.0,interpolation:Exp10In}
56
+ {class:ImageJson,name:PauseButton,x:354.71698,y:346,width:120,height:120,ox:0,oy:0,rotation:0,zindex:1,color:ffffffff,touchable:enabled,visible:true,texName:img_btn_pause,effect:None,value:0,duration:0,interpolation:Linear,addActorDelay:0,addEffectDelay:0,event:None,onEvent:DoEffect,eventScene:\"\"}
59
57
  "}
test/source/BasicDemo.java CHANGED
@@ -4,12 +4,12 @@ import com.badlogic.gdx.scenes.scene2d.Touchable;
4
4
  import com.badlogic.gdx.scenes.scene2d.actions.Actions;
5
5
  import com.badlogic.gdx.scenes.scene2d.ui.Image;
6
6
 
7
- /** A Basic Demo Game Scene
7
+ /** A Basic Demo Game Scene
8
- * <p>
8
+ * <p>
9
- * This Scene showcases all the different features of the inbuilt Stage framework
9
+ * This Scene showcases all the different features of the inbuilt Stage framework
10
- * <p>
10
+ * <p>
11
- * @author pyros2097 */
11
+ * @author pyros2097 */
12
-
12
+
13
13
  public class BasicDemo extends Scene {
14
14
  Image pauseImage;
15
15
  Image pauseBtn;
@@ -50,6 +50,18 @@ public class BasicDemo extends Scene {
50
50
 
51
51
  @Override
52
52
  public void onGesture(GestureType type){}
53
+
54
+ @Override
55
+ public void onKeyTyped(char key){
56
+ }
57
+
58
+ @Override
59
+ public void onKeyUp(int keycode){
60
+ }
61
+
62
+ @Override
63
+ public void onKeyDown(int keycode){
64
+ }
53
65
 
54
66
  @Override
55
67
  public void onPause() {
test/source/Game.java CHANGED
@@ -86,6 +86,18 @@ public class Game extends Scene {
86
86
 
87
87
  @Override
88
88
  public void onGesture(GestureType type){}
89
+
90
+ @Override
91
+ public void onKeyTyped(char key){
92
+ }
93
+
94
+ @Override
95
+ public void onKeyUp(int keycode){
96
+ }
97
+
98
+ @Override
99
+ public void onKeyDown(int keycode){
100
+ }
89
101
 
90
102
  @Override
91
103
  public void onPause(){
test/source/Game3d.java CHANGED
@@ -1,12 +1,36 @@
1
1
  import com.badlogic.gdx.scenes.scene2d.Actor;
2
+ import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder;
3
+ import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
4
+ import com.badlogic.gdx.graphics.VertexAttributes.Usage;
5
+ import com.badlogic.gdx.graphics.g3d.Material;
6
+ import com.badlogic.gdx.graphics.GL20;
7
+ import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
2
8
 
3
9
  public class Game3d extends Scene {
4
10
  Actor3d ship;
11
+ Actor3d skydome;
12
+ Actor3d knight;
13
+ Actor3d floor;
14
+ ModelBuilder builder;
5
15
 
6
16
  public Game3d(){
7
- ship = Asset.loadModel("ship");
17
+ ship = Asset.loadModelObj("ship");//loads an obj model
8
18
  ship.scale(3f);
19
+ skydome = Asset.loadModel("skydome"); //loads a g3db model
20
+ builder = new ModelBuilder();
21
+ builder.begin();
22
+ MeshPartBuilder part = builder.part("floor", GL20.GL_TRIANGLES, Usage.Position |
23
+ Usage.TextureCoordinates | Usage.Normal, new Material());
24
+ for (float x = -200f; x < 200f; x += 10f) {
25
+ for (float z = -200f; z < 200f; z += 10f) {
26
+ part.rect(x, 0, z + 10f, x + 10f, 0, z + 10f, x + 10f, 0, z, x, 0, z, 0, 1, 0);
27
+ }
28
+ }
29
+ floor = new Actor3d(builder.end());
30
+ floor.materials.get(0).set(TextureAttribute.createDiffuse(Asset.tex("concrete").getTexture()));
31
+ Stage.addActor3d(floor);
32
+ Stage.addActor3d(skydome);
9
- Stage.addActor3d(ship);
33
+ Stage.addActor3d(ship);
10
34
  }
11
35
 
12
36
  @Override
@@ -27,6 +51,18 @@ public class Game3d extends Scene {
27
51
  @Override
28
52
  public void onGesture(GestureType type){}
29
53
 
54
+ @Override
55
+ public void onKeyTyped(char key){
56
+ }
57
+
58
+ @Override
59
+ public void onKeyUp(int keycode){
60
+ }
61
+
62
+ @Override
63
+ public void onKeyDown(int keycode){
64
+ }
65
+
30
66
  @Override
31
67
  public void onPause(){
32
68
  }
test/source/GameOver.java CHANGED
@@ -1,10 +1,10 @@
1
1
  import com.badlogic.gdx.scenes.scene2d.Actor;
2
2
 
3
- /** A Basic Game Over Scene for the Game
3
+ /** A Basic Game Over Scene for the Game
4
- * <p>
4
+ * <p>
5
- * The Game Scene displays that the player has lost the game and then switches to Menu
5
+ * The Game Scene displays that the player has lost the game and then switches to Menu
6
- * <p>
6
+ * <p>
7
- * @author pyros2097 */
7
+ * @author pyros2097 */
8
8
  public class GameOver extends Scene{
9
9
 
10
10
  public GameOver(){
@@ -25,6 +25,18 @@ public class GameOver extends Scene{
25
25
 
26
26
  @Override
27
27
  public void onGesture(GestureType type){}
28
+
29
+ @Override
30
+ public void onKeyTyped(char key){
31
+ }
32
+
33
+ @Override
34
+ public void onKeyUp(int keycode){
35
+ }
36
+
37
+ @Override
38
+ public void onKeyDown(int keycode){
39
+ }
28
40
 
29
41
  @Override
30
42
  public void onPause(){
test/source/GameWin.java CHANGED
@@ -1,10 +1,10 @@
1
1
  import com.badlogic.gdx.scenes.scene2d.Actor;
2
2
 
3
- /** A Basic Game Win Scene for the Game
3
+ /** A Basic Game Win Scene for the Game
4
- * <p>
4
+ * <p>
5
- * The Game Scene displays that the player has won the game and then switches to Menu
5
+ * The Game Scene displays that the player has won the game and then switches to Menu
6
- * <p>
6
+ * <p>
7
- * @author pyros2097 */
7
+ * @author pyros2097 */
8
8
  public class GameWin extends Scene {
9
9
 
10
10
  public GameWin(){
@@ -25,6 +25,18 @@ public class GameWin extends Scene {
25
25
 
26
26
  @Override
27
27
  public void onGesture(GestureType type){}
28
+
29
+ @Override
30
+ public void onKeyTyped(char key){
31
+ }
32
+
33
+ @Override
34
+ public void onKeyUp(int keycode){
35
+ }
36
+
37
+ @Override
38
+ public void onKeyDown(int keycode){
39
+ }
28
40
 
29
41
  @Override
30
42
  public void onPause(){
test/source/Menu.java CHANGED
@@ -1,11 +1,11 @@
1
1
  import com.badlogic.gdx.scenes.scene2d.Actor;
2
2
 
3
- /** A Basic Main Menu for the Game
3
+ /** A Basic Main Menu for the Game
4
- * <p>
4
+ * <p>
5
- * The Main Menu Displays all the scenes to which the game can switch too. Based on which button or
5
+ * The Main Menu Displays all the scenes to which the game can switch too. Based on which button or
6
- * image or widget pressed the scene can be switched.
6
+ * image or widget pressed the scene can be switched.
7
- * <p>
7
+ * <p>
8
- * @author pyros2097 */
8
+ * @author pyros2097 */
9
9
  public class Menu extends Scene {
10
10
 
11
11
  public Menu(){
@@ -44,6 +44,18 @@ public class Menu extends Scene {
44
44
  Stage.log("Down");
45
45
  }
46
46
 
47
+ @Override
48
+ public void onKeyTyped(char key){
49
+ }
50
+
51
+ @Override
52
+ public void onKeyUp(int keycode){
53
+ }
54
+
55
+ @Override
56
+ public void onKeyDown(int keycode){
57
+ }
58
+
47
59
  @Override
48
60
  public void onPause(){
49
61
  }
test/source/Options.java CHANGED
@@ -1,12 +1,12 @@
1
1
  import com.badlogic.gdx.scenes.scene2d.Actor;
2
2
 
3
- /** A Basic Options Scene for the Game
3
+ /** A Basic Options Scene for the Game
4
- * <p>
4
+ * <p>
5
- * The Options Scene displays the necessary settings which can be modified by the user like
5
+ * The Options Scene displays the necessary settings which can be modified by the user like
6
- * musicOn, soundOn, panCamera, battleAnimations etc. The widgets once changed must persist
6
+ * musicOn, soundOn, panCamera, battleAnimations etc. The widgets once changed must persist
7
- * the changes to the preferences which can be accessed by Config.prefs
7
+ * the changes to the preferences which can be accessed by Config.prefs
8
- * <p>
8
+ * <p>
9
- * @author pyros2097 */
9
+ * @author pyros2097 */
10
10
  public class Options extends Scene {
11
11
 
12
12
  public Options(){
@@ -30,6 +30,18 @@ public class Options extends Scene {
30
30
 
31
31
  @Override
32
32
  public void onGesture(GestureType type){}
33
+
34
+ @Override
35
+ public void onKeyTyped(char key){
36
+ }
37
+
38
+ @Override
39
+ public void onKeyUp(int keycode){
40
+ }
41
+
42
+ @Override
43
+ public void onKeyDown(int keycode){
44
+ }
33
45
 
34
46
  @Override
35
47
  public void onPause(){
test/source/Splash.java CHANGED
@@ -73,13 +73,25 @@ public class Splash extends Scene {
73
73
  @Override
74
74
  public void onGesture(GestureType type){}
75
75
 
76
- @Override
76
+ @Override
77
- public void onPause(){
77
+ public void onKeyTyped(char key){
78
78
  }
79
79
 
80
80
  @Override
81
- public void onResume(){
81
+ public void onKeyUp(int keycode){
82
82
  }
83
+
84
+ @Override
85
+ public void onKeyDown(int keycode){
86
+ }
87
+
88
+ @Override
89
+ public void onPause(){
90
+ }
91
+
92
+ @Override
93
+ public void onResume(){
94
+ }
83
95
 
84
96
  @Override
85
97
  public void onDispose() {
test/source/TicTacToe.java CHANGED
@@ -7,7 +7,8 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
7
7
  import java.util.Random;
8
8
 
9
9
  /**
10
- * A Basic TicTacToe Game
11
10
  Scene
11
+ * A Basic TicTacToe Game
12
+ Scene
12
13
  *
13
14
  * @author pyros2097 */
14
15
  public class TicTacToe extends Scene {
@@ -144,6 +145,18 @@ public class TicTacToe extends Scene {
144
145
 
145
146
  @Override
146
147
  public void onGesture(GestureType type){}
148
+
149
+ @Override
150
+ public void onKeyTyped(char key){
151
+ }
152
+
153
+ @Override
154
+ public void onKeyUp(int keycode){
155
+ }
156
+
157
+ @Override
158
+ public void onKeyDown(int keycode){
159
+ }
147
160
 
148
161
  @Override
149
162
  public void onPause(){