itt 2014 - mario zechner - libgdx 101
TRANSCRIPT
libGDX bootcamp
What is libGDX?
• Cross-platform game development framework • Java + C/C++ for performance hungry code • Use Java, Scala, Kotlin, ... • Write once ...
http://libgdx.badlogicgames.com http://github.com/libgdx/libgdx
@badlogicgames, @libgdx
Deploy to
Develop with
Who‘s using it?
Who‘s using it?
Features
Features
Low-Level
Mid-Level
High-Level
Features
Low-Level
Mid-Level
High-Level Application Management File I/O Networking Audio Graphics (OpenGL ES 2.0/3.0) Input
Features
Low-Level
Mid-Level
High-Level Meshes, Shaders, Textures, ... Sprite & Polygon Batching Texture Atlas, Bitmap Font Asset Manager Math Library Custom Collections JSON/XML (de-)serialization
Features
Low-Level
Mid-Level
High-Level
Box2D & Bullet Physics Map Loading 2D Scene Graph + UI Toolkit 3D API
It‘s a framework, not an engine Mix & Match, use and combine features from any level
Read The Fine Manual!
http://libgdx.badlogicgames.com/documentation.html
Lets write a game
Actually, we‘ll just quickly prototyp a game
A real game needs more code and assets
The plane that couldn‘t fly good
Thanks Kenney! http://kenney.nl/
Assets
Plane, 3 frames, 88x73px
Ground, 808x71px
Rock, up & down, 108x239px Background, 800x480
music.mp3
explode.wav
arial.fnt, arial.png
Live-Coding Session https://github.com/badlogic/theplanethatcould
ntflygood
Thanks!
Low-Level Layer
Application Management • Lifecycle events • Window management • Rendering loop • Threading Gdx.app, ApplicationListener, LwjglApplication, AndroidApplication, IOSApplication, GwtApplication ,...
Low-Level Layer
File I/O
• Unified across platforms
• Preferences (persistent map)
• Sane file manipulation API
Gdx.files, FileHandle, ...
Low-Level Layer
Networking
• Open URL in browser
• HTTP, HTTPs API ala HttpClient
• Socket API
Gdx.net, HttpRequest, HttpResponse, Socket,
ServerSocket, ...
Low-Level Layer
Audio
• Streaming playback for music
• In-memory playback for sound effects
• PCM read/write
• Panning, volume, pitch
Gdx.audio, Sound, Music, AudioDevice, ...
Low-Level Layer
Graphics
• OpenGL ES 2.0, 3.0
• Display mode API
• Continuous & non-continuous rendering
• Custom 2D Bitmap manipulation API
Gdx.graphics, GL20, GL30, Pixmap, PixmapIO, ...
Low-Level Layer
Input
• Keyboard, Mouse, Touch
• Accelerometer, Compass, Vibrator
• On-screen Keyboard
Gdx.input, InputProcessor, ...
Mid-Level Layer
Graphic Utilities • Shaders, textures, meshes, framebuffer objects • Polygon & spritebatch, texture regions, texture
atlas, bitmap fonts, 2D particle system, shape renderer
ShaderProgram, Texture, TextureRegion, Mesh, Framebuffer, PolygonBatch, SpriteBatch, TextureAtlas, BitmapFont, ...
Mid-Level Layer
Input
• Input Multiplexing
• Gesture Detector
InputMultiplexer, GestureDetector
Mid-Level Layer
Math • Matrices, vectors, quaternions • Bounding shapes, Intersection testing • Cameras • Splines • Triangulation Matrix4, Matrix3, Vector2, Vector3, Quaternion, BoundingBox, Rectangle, Circle, OrthographicCamera, PerspectiveCamera, CatmullRomSpline, DelaunayTriangulator, ...
Mid-Level Layer
Asset Manager
• Threaded
• Asynchronous loading
• Reference counting
• Pluggable API
AssetManager, ...
Mid-Level Layer
Custom Collections & Serialization
• Lists, maps, sets, pools
• Garbage Collector aware
• JSON POJO (de-)serialization
• XML parsing/writting
Array, ObjectMap, Pool, Json, XmlReader, ...
High-Level Layer
Physics
• Box2D JNI wrapper
• Bullet JNI wrapper
High-Level Layer
Map Loading
• Orthographic & isometric tile maps
• Generic API
High-Level Layer
2D Scene Graph
• Tweening
• Skinable UI toolkit
• Table-based layouting
• Viewport management
Stage, Skin, Button, Table, ...
High-Level Layer
3D API (WIP!) • FBX, DAE, OBJ support • GPU Skinning • Material system • Shadow Mapping, Cube Mapping, ... • Extremely flexible Batching API ModelBatch, ModelInstance, Material, Environment, Renderable, RenderableProvider, Shader, ...
Extensions
• Not part of the core API
• gdx-freetype (desktop, Android, iOS)
• gdx-bullet (desktop, Android, iOS)
• gdx-box2d (desktop, Android, iOS, HTML)
• gdx-controllers (desktop, Android, iOS, HTML)