gdx-studio

#libgdx#java#desktop

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

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


README.md
c44607a 1
# Deprecated
6e77b7d 2
This project could have done pretty well but I didn't get enough time to complete it. Since I joined the startup culture I don't get much time to work on open source projects anymore. But the **Idea** was
366f081 3
really good and you know you could create games in java and json just like that. I thought of crowdfunding this at kickstarter as it seemed pretty good when it was working on my system but then I found out kickstarter is for US citizens only so that was a bummer. Then the I joined Playlyfe. And from then on it was something on the lines like this,
366f081 4
366f081 5
>
366f081 6
I am a busy guy. When I first started this I was out of college searching for a job and had a lot of free time, which is way different from being in The Real World today.
366f081 7
My life consists of waking up -> getting stuck in a traffic -> working for 4 hours -> lunch for an hour -> working for 5 more hours -> getting stuck in traffic on the way home -> shower and sleep -> repeat 5 days a week. On weekends I have to run errands and research to stay competitive in an incredibly cut throat industry. I have very little time to spare.
366f081 8
An Excerpt taken from http://lazyfoo.net/contact.php
366f081 9
366f081 10
## GdxStudio 0.7.1
f6c8846 11
GdxStudio is used for creating awesome games using libGdx.  
f6c8846 12
It has all the features of libgdx built-in so you can easily,start creating games with it.  
f6c8846 13
Tools like Font Editor, Particle Editor, Texture Packer, SceneEditor, MapEditor, ActorEditor, ImagingTools are already built into it. 
f6c8846 14
It also has a powerful Game Framework based on libGDX inbuilt which allows the game coder to concentrate on the logic of the game and not bother about setting up assets or configuration.  
f6c8846 15
Automatic Asset Loading including Atlas, TextureRegions, BitmapFonts, Music, Sound.  
f6c8846 16
It has the libGdx(v0.9.9) inside it so you don't need to download the libGdx at all, when exporting your game to jar for desktop it automatically loads these libraries into it.  
f6c8846 17
f6c8846 18
(Will update this project to latest libgdx since I might get some time to work on this again and fix those issues)
29a6200 19
29a6200 20
>**Disclaimer**  This is not an official libdgx project so don't ask them for bug fixes  
29a6200 21
29a6200 22
Features
29a6200 23
---------
95501ea 24
**1. Automatic Build System**  
95501ea 25
Uses an Batch Builder system based on eclipse, so on the fly building so you can instantly
95501ea 26
run or debug your application. Using the famous Eclipse Java Compiler(ECJ).  
95501ea 27
**2. Automatic File Saving**  
95501ea 28
All Files are automatically save when you switch tabs or change views. No more wasting time pressing
95501ea 29
CTRL+S or clicking the save button (inspired by Xcode).  
95501ea 30
**3. Source Editor**  
95501ea 31
An eclipse like editor which supports code completion, batch compiling and compile errors as you type.  
29a6200 32
**4. Scene Editor**  
95501ea 33
Completely design your game scenes with effects using the scene editor and access these components 
95501ea 34
in the source editor and add your logic code. Your scenes are saved in scene.json file is automatically loaded.  
29a6200 35
**5. Map Editor**  
95501ea 36
All your game maps can be designed using it. This supports 3 map layers and 3 object layers. 
29a6200 37
You can drag and drop your custom actors/objects onto the map. There is no fixed size for a map. 
95501ea 38
Each tile can be anything you want it to be.  
29a6200 39
**6. Actor Editor**  
95501ea 40
You can create custom actors/objects which consist of the basic widgets like images, sprites etc.
95501ea 41
And you can drag and drop these into your game scenes and maps. Makes it easier instead of doing it by code.  
29a6200 42
**7. Export**  
95501ea 43
All the libgdx libraries and class files are directly exported to your package.
95501ea 44
Your game can be exported to jar for Desktop, apk for android and ipa for iOS  
29a6200 45
**8. Platform Independent**  
95501ea 46
Write Once Deploy Everywhere. You only need to write you game logic for one platform, cross building
95501ea 47
for different platforms and exporting is done automatically.(android and ios not done)  
29a6200 48
**9. Dynamic Compilation**  
95501ea 49
You can edit your scenes and add logic to your game and at the same time see the outcome in the studio.
29a6200 50
Your source files are automatically compiled and loaded into the class loader and displayed in the studio.
95501ea 51
So your don't need to follow the monotonous approach compile->build->run exe. This saves a lot of time.  
a9b2a64 52
c44607a 53
Screenshots
c44607a 54
-----------
0000000 55
<img src = "shots/shot2.png">
0000000 56
<img src = "shots/shot3.png">
0000000 57
<img src = "shots/shot4.png">
0000000 58
<img src = "shots/shot5.png">
0000000 59
<img src = "shots/shot6.png">
c44607a 60
a9b2a64 61
Using
a9b2a64 62
------
a9b2a64 63
```java
a9b2a64 64
 //This is our first Scene and it shows the libgdx logo until all the assets are loaded 
a9b2a64 65
    //then it automatically switches to the Menu scene
a9b2a64 66
    public class  Splash extends Scene {
a9b2a64 67
		
a9b2a64 68
		public Splash() {
a9b2a64 69
			splashDuration = 5f; // This will make my splash scene to wait 5 seconds after assets are all loaded
a9b2a64 70
			final Texture bg1 = new Texture("splash/libgdx.png");
a9b2a64 71
			final Image imgbg1 = new Image(bg1);
a9b2a64 72
			imgbg1.setFillParent(true);
a9b2a64 73
			addActor(imgbg1);
a9b2a64 74
	    } 
a9b2a64 75
   }
a9b2a64 76
   
a9b2a64 77
    //This is Scene gets called once the assets are loaded
a9b2a64 78
    public class Menu extends Scene {
a9b2a64 79
    
a9b2a64 80
		public Menu() {
a9b2a64 81
			//create some actors
a9b2a64 82
			// if you used sink studio and create a scene like Menu.json then
a9b2a64 83
			// it will automatically call load("Menu") it will populate your scene after parsing the json file
a9b2a64 84
			
a9b2a64 85
			//you can access these objects like this
a9b2a64 86
			TextButton btn = (TextButton) findActor("TextButton1");
a9b2a64 87
			Image img = (Image) findActor("Image5");
a9b2a64 88
			
a9b2a64 89
			// these actors are loaded from the json file and are give names which allows
a9b2a64 90
			// easy access to them
a9b2a64 91
		}
a9b2a64 92
	}
a9b2a64 93
```				  	  					  	  					  	
29a6200 94
29a6200 95
Credits
29a6200 96
--------
29a6200 97
Thanks to all these awesome frameworks  
29a6200 98
[Libgdx](http://libgdx.badlogicgames.com)  
29a6200 99
[WebLookAndFeel](http://weblookandfeel.com)  
29a6200 100
[RSyntaxTextArea](http://fifesoft.com/rsyntaxtextarea)  
29a6200 101
[WebLookAndFeelLite](https://github.com/pyros2097/WebLookAndFeelLite)  
29a6200 102
[Scene3d](https://github.com/pyros2097/Scene3d)  
29a6200 103
[Sink](https://github.com/pyros2097/Sink)  
29a6200 104
[EclipseCompiler](http://download.eclipse.org/eclipse/downloads/)  
29a6200 105
[ANTLR](http://www.antlr.org/)  
29a6200 106
[ProGuard](http://proguard.sourceforge.net)  
a9b2a64 107
c44607a 108
Todo
c44607a 109
-----
c44607a 110
1. MapEditor
c44607a 111
2. ActorEditor
c44607a 112
3. Automatic Updates
c44607a 113
4. Make a signals/slots method for connecting actors with events (maybe make an interpreter)
a9b2a64 114
a9b2a64 115
Documentation
a9b2a64 116
-------------
a9b2a64 117
Scene
a9b2a64 118
-----
3551885 119
```
a9b2a64 120
<p>
a9b2a64 121
It consists of a single Stage2d, Stage3d, Camera2d, and Camera3d which are all initialized based on the config file.
a9b2a64 122
The root of the stage can be accessed in a statically {@link Scene#getRoot()} and methods related to camera like moveTo, moveBy,
a9b2a64 123
are also accessed the same way.<br>
a9b2a64 124
It has extra things like stateTime, gameUptime, pauseState<br>
a9b2a64 125
a9b2a64 126
It has automatic asset unloading and disposing and you can use {@link #exit()} to quit your game safely
a9b2a64 127
a9b2a64 128
Note: Your TMX maps have to be unloaded manually as they can be huge resources needing to be freed early.
a9b2a64 129
a9b2a64 130
It has static methods which can be used for panning the camera using mouse, keyboard, drag.. etc.
a9b2a64 131
It can also automatically follow a actor by using followActor(Actor actor)<br>
a9b2a64 132
a9b2a64 133
This class will register all your scenes based on your scene.json file and then you can switch you scenes by using {@link #setScene}
a9b2a64 134
method with the sceneClassName.<br>
a9b2a64 135
All your assets are loaded in the background(asynchronously) in the first scene and then automatically 
a9b2a64 136
the next scene in the list is set.
a9b2a64 137
You can stop the stage from switching to the next scene by setting Asset.loadAsynchronous = false in your first scene but then
a9b2a64 138
you have to load all the assets by using the blocking call Asset.loadBlocking()
a9b2a64 139
a9b2a64 140
If you want to display your splash screen for more time after the assets have loaded then you can change
a9b2a64 141
Stage.splashDuration to the amount of time you want you splash screen to show. By default the splash screen's
a9b2a64 142
lifetime is finished once the assets are loaded and then the next scene is set.
a9b2a64 143
</p>
3551885 144
```
a9b2a64 145
Camera
a9b2a64 146
------
a9b2a64 147
```java
a9b2a64 148
/*
a9b2a64 149
 *  This is to set the offsets of camera position when following the actor
a9b2a64 150
 *  When the camera follows the actor its (x,y) position is set to actor's (x,y) position
a9b2a64 151
 *  based on followSpeed. The offsets are used to position the camera in such a way that the actor
a9b2a64 152
 *  doesn't need to be at the center of the camera always
a9b2a64 153
 */
a9b2a64 154
public static Rectangle followOffset;
a9b2a64 155
public static boolean usePan;
a9b2a64 156
public static boolean useDrag;
a9b2a64 157
a9b2a64 158
/*
a9b2a64 159
 *  This sets the boundary of the camera till what position can it move or pan in the
a9b2a64 160
 *  directions left, right, top, down. This is to prevent is from panning overboard the game area.
a9b2a64 161
 *  Usually the bounds of the camera is like a rectangle. This must be calculated carefully
a9b2a64 162
 *  as the camera's position is based on its center.
a9b2a64 163
*/
a9b2a64 164
public static Rectangle bounds;
a9b2a64 165
a9b2a64 166
/*
a9b2a64 167
 * Moves the camera to x,y over a time duration
a9b2a64 168
 */
a9b2a64 169
public void moveTo(float x, float y, float duration);
a9b2a64 170
a9b2a64 171
/*
a9b2a64 172
 * Moves the camera by amountX, amountY over a time duration
a9b2a64 173
 */
a9b2a64 174
public static void moveBy (float amountX, float amountY, float duration);
a9b2a64 175
a9b2a64 176
/*
a9b2a64 177
 * Moves the camera by amountX, amountY over a time duration and interpolation interp
a9b2a64 178
 */
a9b2a64 179
public static void moveBy (float amountX, float amountY, float dur, Interpolation interp);
a9b2a64 180
/*
a9b2a64 181
 * This makes the camera follow the actor once and only once. Once the camera reaches its
a9b2a64 182
 * target, it stops following the actor.
a9b2a64 183
 */
a9b2a64 184
public static void followActor(Actor actor);
a9b2a64 185
/*
a9b2a64 186
 * This makes the camera follow the actor continuously, even after the camera reaches its
a9b2a64 187
 * target, it keeps following the if the actor changes its position.
a9b2a64 188
 */
a9b2a64 189
public static void followActorContinuously(Actor actor);
a9b2a64 190
/*
a9b2a64 191
 * Sets the speed at which the camera follows the actor. By default it moves 1px for a duration of 1f
a9b2a64 192
 * so its speed is 1px/f. So reduce the duration to increase its speed.
a9b2a64 193
 * ex: setPanSpeed(0.5) will change its speed to 2px/f
a9b2a64 194
 * Here: f can/maybe also indicate seconds
a9b2a64 195
 */
a9b2a64 196
public static void setFollowSpeed(float duration);
a9b2a64 197
a9b2a64 198
/*
a9b2a64 199
 * Sets the speed at which the camera pans. By default it moves 1px for a duration a 1f
a9b2a64 200
 * so its speed is 1px/f. So reduce the duration to increase its speed.
a9b2a64 201
 * ex: setPanSpeed(0.5) will change its speed to 2px/f
a9b2a64 202
 * Here: f can/maybe also indicate seconds 
a9b2a64 203
 */
a9b2a64 204
public void setPanSpeed(float duration);
a9b2a64 205
a9b2a64 206
/* If you want to make any elements/actors to move along with the camera 
a9b2a64 207
 * like HUD's add them using this method */
a9b2a64 208
public static void addHud(Actor actor);
a9b2a64 209
a9b2a64 210
/* If you want to any elements/actors which was a Hud the use this */
a9b2a64 211
public static void removeHud(Actor actor);
a9b2a64 212
a9b2a64 213
/*
a9b2a64 214
 * Clears all hud's registerd with the camera
a9b2a64 215
 */
a9b2a64 216
public static void clearAllHud();
a9b2a64 217
a9b2a64 218
/*
a9b2a64 219
 * Returns the x postion of the camera
a9b2a64 220
 */
a9b2a64 221
public static float getX();
a9b2a64 222
/*
a9b2a64 223
 * Returns the y postion of the camera
a9b2a64 224
 */
a9b2a64 225
public static float getY();		
a9b2a64 226
```
a9b2a64 227
Asset
a9b2a64 228
-----
a9b2a64 229
<b>#Important </b> <br>
a9b2a64 230
All asset files must be lowercase only.. otherwise it causes problems with android <br> 
a9b2a64 231
Automatic Asset Loading the directory Structure should be like this <br>
a9b2a64 232
This class automatically loads all the assets in the prescribed folders into the appropriate 
a9b2a64 233
class types. All This can be accessed using an neat api.
a9b2a64 234
a9b2a64 235
icon.png  --- your game icon to be displayed on the window<br>
a9b2a64 236
atlas/  --- all your Texture Atlas files .atlas and .png go here<br>
a9b2a64 237
font/  --- all your BitmapFont files .fnt and .png go here<br>
a9b2a64 238
music/  --- all your Music files .mp3 go here<br>
a9b2a64 239
sound/  --- all your Music files .mp3 go here<br>
a9b2a64 240
particle/  --- all your Particle files .part go here<br>
a9b2a64 241
map/  --- all your TMX map files along with tilesets go here<br>
a9b2a64 242
pack/  --- all your image files which are to be packed are to be stored here<br>
a9b2a64 243
 					  so that they are automatically packed by the texture packer and stored in
a9b2a64 244
 					  the atlas folder
a9b2a64 245
 					  
a9b2a64 246
All the assets are read from their particular folders and an asset.json file is created with
a9b2a64 247
the filenames:
a9b2a64 248
ex: asset.json 			
a9b2a64 249
	{ 
a9b2a64 250
	  	"font": "arial.fnt, font1",
a9b2a64 251
  		"atlas": "image.atlas",
a9b2a64 252
  		"sound": "click.mp3,gg.mp3",
a9b2a64 253
  		"music": "title.mp3,"bg.mp3",
a9b2a64 254
	}
a9b2a64 255
```java
a9b2a64 256
//All assets are accessed this way, To load TextureRegion
a9b2a64 257
TextureRegion cat = Asset.tex("cat");
a9b2a64 258
a9b2a64 259
//To load Animation
a9b2a64 260
Animation catAnim = Asset.anim("cat");
a9b2a64 261
BitmapFont font1 = Asset.font("font1");
a9b2a64 262
a9b2a64 263
//The music and sound files are automatically cached and can be played by invoking:
a9b2a64 264
Asset.musicPlay("musicname");
a9b2a64 265
Asset.soundPlay("soundname");
a9b2a64 266
a9b2a64 267
//The asset functions will return null for Font, TextureRegion and Animation if the asset cannot be found
e8c405b 268
```
e8c405b 269