I have never used this engine or any multiple platform engine, So I am just curious If i wrote a code that changed the game screen when i clicked in a certain area on the game (on computer version) would I have to write something different to get this to work on an android version of the app? I have never used an engine really before so I am not sure about this. And where would a good place to learn libgdx be?
Things like screen size (small Android devices vs desktop monitors), input (finger touch vs. mouse and keyboard), data storage (class-path on desktop/Android vs not on HTML) and so forth will obviously need to be taken into consideration. With that said, most of your code should be application independent, as long as you are being smart about things.
(For example, instead of using absolute UI positions and sizes which won’t work on multiple resolutions, you might use layouts and resizable content.)
But if you are new to programming and gamedev, then I would suggest learning by writing several games for a single platform (e.g. desktop) before you try writing a multi-platform game.
Plenty of resources on LibGDX if you google it:
http://libgdx.badlogicgames.com/documentation.html
In comparison, I’d say that libgdx is the only possible solution for having 99% of your code being able to be executed on all platforms: PC, Android, iOS (unsure) and html5.
If you do it right, of course.
Thanks for the advice but im not that new to java or gamedev I have made a pc and android game before. And im not sure if your aware but libgdx supports multiple platforms so I wasnt sure if I was the one who had to do this porting or libgdx offered some help
I’d say 99% of everyone on this forum is aware of libGDX’s abilities.
Overall:
from http://steigert.blogspot.com.au/2012/02/1-libgdx-tutorial-introduction.html
I started gamedev with java2d, why? All tuts are about java2d. After that I tried myself at jogl, I soon realized that most of the tuts are deprecated, that’s why I switched to lwjgl. With some help of the forum I got familiar with it, the community is absolutely noobfriendly ;D
Now I am using libgdx for android, it’s really worth it. If you use libgdx u get access to some really beginnerfriendly functions. The filesystem/rendering is completely platform independent. Furthermore I enjoy box2d, the “physics engine” I wrote by my self wasn’t that accurate.
Lastly I don’t like the android sdk that much, I prefere libgdx
best regards
how did u learn libgdx? i really want to start using it but im not sure how. this wont be my first game, i haev coded my own android game and made a pc game using slick2d and another pc without an engine. so im not too much of a newb lol
I know some of you might say google this, but im curious of what you guys have used to learn using libgdx for android and what has and hasnt been sucessful for you
This is quite good http://code.google.com/p/libgdx/wiki/SimpleApp
Other parts of the wiki was also quite helpfull. Google is king after that.
Try and error by myself, and hit google (mostly user wiki) when something wrong.
Yes, with libgdx you can port to Windows, Linux, Mac, Android, iOS (yes!) & HTML5. ;D
Have a look at the demos too. superjumper for example has been ported to all platforms that I listed above:
https://github.com/libgdx/libgdx/tree/master/demos/superjumper
Thanks alot guys I really appreciate this. !
Most of the time I google my errors, but there are a lot of deprecated, outdated, “you shouldn’t programm like that”, let them call “tutorials” out there. After I can’t find any good solution I post it in the newbie-section -> There’s always a good guy/woman(haven’t recognised one jet but don’t want to discriminate them), who likes to help me ;D
There’s a leack of good up-to-date java tuts.
- That’s my favorite: http://code.google.com/p/libgdx/wiki/SimpleApp
- Of course the api is quite helpfull: http://libgdx.badlogicgames.com/nightlies/docs/api/
- That’s about box2d: http://www.iforce2d.net/b2dtut/forces (it’s in C++ but you will get it)
- The java-gaming.org community
best regards
quick question about libgdx cross-compilation, is there are blog post or wiki page which lists all the things one must think of when cross-compiling to another platform.
Like what classes are forbidden to use and how to use libraries and so on.
not that I know of, generally you really have only a few things to think about.
IF you want to do direct opengl calls, I think it is best to use “Gdx.graphics.getGLCommon()” instead of “Gdx.graphics.getGL10()” for example - I THINK.
ehm… in applet you cannot use FileHandle.list() - for obvious reasons. However I made this mistake a couple of times, since I would have a folder and load everything in it…
I cant really think of anything else… the HTML 5 port has some more stuff you cannot use, like System.nanoTime(), but upon convert/compiling it will tell you when a line cannot be used.
since I have not learned opengl yet would it be beneficial to me to do so before using libgdx?
Not necessarily, you can always call opengl commands through libGDX anyways, and the learning curve of opengl might be too steep.
It works like tihs:
If your app uses GL20 (e.g. it was specified in application config or is required by the platform you’re distributing to) then Gdx.gl20 will be non-null, and Gdx.gl10 will be null.
For apps that don’t have “useGL20=true”, then Gdx.gl20 will be null, and Gdx.gl10 will be non-null.
Gdx.gl (or Gdx.graphics.getGLCommon) should never return null.
For example, the following is standard practice:
if (Gdx.graphics.isGL20Available()) {
Gdx.gl20.glXXX
} else {
Gdx.gl10.glXXX
}
Side-question @davedes:
What if I have a [icode]OrthographicCamera[/icode] set up, and I want to use [icode]camera.apply(Gdx.gl10);[/icode]?
It wants to have a GL10, but I can’t feed him one, if I only have a gl20 available…
“Apply” sets up fixed-function matrices to the specified camera’s projection and view matrix:
public void apply (GL10 gl) {
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadMatrixf(projection.val, 0);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadMatrixf(view.val, 0);
}
So the equivalent in GL20 would be to send a projection and/or modelview matrix to your shader. Typically it might look like:
shader.begin();
shader.setUniformMatrix("u_projView", camera.combined); //combined matrix
shader.end();
If you use SpriteBatch and Stage for 2D rendering, you shouldn’t need to call apply() or setUniformMatrix().