Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 1 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 0 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 1 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 0 / 31 Introductory Videos

Introduction

Martin Tourneboeuf libGdx 11 Avril 2017 1 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Introductory Videos

—– FBX - Gesture detector - Camera —– Input multiplexer - Tile map - Particle editor

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Font -Sprite Texture- -GUI —– Shader - -Interpolation ——– Introductory Videos

—– FBX - Gesture detector - Camera —– Input multiplexer - Tile map - Particle editor

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31 Font -Sprite Texture- -GUI —– Shader Box2D- -Interpolation ——– Introductory Videos

—– FBX - Gesture detector - Camera —– Input multiplexer - Tile map - Particle editor

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31

File I/O - Input - Accelerometer - Matrice —– Application - OpenGl - Asset Manager - JSON ——– Font -Sprite Texture- -GUI —– Shader Box2D- -Interpolation ——– Introductory Videos

—– FBX - Gesture detector - Camera —– HTTP -TCP Audio- -Compass -Touch screen —– Input multiplexer - Tile map - Particle editor —– FFT -Serialisation Preferences- -PCM playback

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31

File I/O - Input - Accelerometer - Matrice —– Application - OpenGl - Asset Manager - JSON ——– Font -Sprite Texture- -GUI —– Shader Box2D- -Interpolation ——– Introductory Videos

—– FBX - Gesture detector - Camera —– HTTP -TCP Audio- -Compass -Touch screen —– Input multiplexer - Tile map - Particle editor —– FFT -Serialisation Preferences- -PCM playback

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31

File I/O - Input - Accelerometer - Matrice —– Application - OpenGl - Asset Manager - JSON ——– Font -Sprite Texture- -GUI —– Shader Box2D- -Interpolation ——– Introductory Videos the open- cross-platform

—– FBX - Gesture detector - Camera —– HTTP -TCP Audio- -Compass -Touch screen —– Input multiplexer - Tile map - Particle editor —– FFT -Serialisation Preferences- -PCM playback

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31

File I/O - Input - Accelerometer - Matrice —– Application - OpenGl - Asset Manager - JSON ——– Font -Sprite Texture- -GUI —– Shader Box2D- -Interpolation ——– Introductory Videos the Java open-source cross-platform

—– FBX - Gesture detector - Camera —– HTTP -TCP Audio- -Compass -Touch screen —– Input multiplexer - Tile map - Particle editor —– FFT -Serialisation Preferences- -PCM playback

game framework

Martin Tourneboeuf libGdx 11 Avril 2017 2 / 31

File I/O - Input - Accelerometer - Matrice —– Application - OpenGl - Asset Manager - JSON ——– Introductory Videos

Martin Tourneboeuf libGdx 11 Avril 2017 3 / 31 Introductory Videos

— Introductory Videos 1 Overview of libGdx What is libGdx ? Who uses libGdx ? How can all that be “easy” ? 2 Low level bindings example : openGL Android Desktop GLES 3 High level Api Architecture Tests — Conclusion Martin Tourneboeuf libGdx 11 Avril 2017 4 / 31 Overview of libGdx Plan

— Introductory Videos

1 Overview of libGdx What is libGdx ? Who uses libGdx ? How can all that be “easy” ?

2 Low level bindings example : openGL Android Desktop GLES

3 High level Api Architecture Tests — Conclusion

Martin Tourneboeuf libGdx 11 Avril 2017 5 / 31 “LibGdx is big framework accessible with little difficutly” (me)

Overview of libGdx What is libGdx ?

”libgdx is a cross-platform game development framework. Write your game once in Java, deploy to Windows, , Mac OS X, Steam, Android, iOS, HTML5/WebGL” Initiated in 2010 by Mario Zechner Open Source : https://github.com/libgdx/libgdx Community : 5000 forks + nice wiki Website : http://libgdx.badlogicgames.com with a game repo

Martin Tourneboeuf libGdx 11 Avril 2017 6 / 31 (me)

Overview of libGdx What is libGdx ?

”libgdx is a cross-platform game development framework. Write your game once in Java, deploy to Windows, Linux, Mac OS X, Steam, Android, iOS, HTML5/WebGL” Initiated in 2010 by Mario Zechner Open Source : https://github.com/libgdx/libgdx Community : 5000 forks + nice wiki Website : http://libgdx.badlogicgames.com with a game repo

“LibGdx is big framework accessible with little difficutly”

Martin Tourneboeuf libGdx 11 Avril 2017 6 / 31 Overview of libGdx What is libGdx ?

”libgdx is a cross-platform game development framework. Write your game once in Java, deploy to Windows, Linux, Mac OS X, Steam, Android, iOS, HTML5/WebGL” Initiated in 2010 by Mario Zechner Open Source : https://github.com/libgdx/libgdx Community : 5000 forks + nice wiki Website : http://libgdx.badlogicgames.com with a game repo

“LibGdx is big framework accessible with little difficutly” (me)

Martin Tourneboeuf libGdx 11 Avril 2017 6 / 31 Overview of libGdx What is libGdx ? Features

Low level Mid Level High Level Graphics Texture UI skinnable SpriteBatch 3D (fbx support) Input Gesture detector Box2d Input multiplexer Bullet (via jni) File I/O AssetManager Serialisation Threaded IO Audio Math Utility FFT mp3/ogg decoding Application Disposable Screen management Managment Networking !! Extensions :

Martin Tourneboeuf libGdx 11 Avril 2017 7 / 31 Overview of libGdx Who uses libGdx ?

From www.appbrain.com/stats/libraries/tag/game-framework/ android-game-frameworks

Martin Tourneboeuf libGdx 11 Avril 2017 8 / 31 Overview of libGdx Who uses libGdx ?

+10M download. From https://play.google.com/store/apps/details?id=com. nianticproject.ingress

Martin Tourneboeuf libGdx 11 Avril 2017 9 / 31 Overview of libGdx Who uses libGdx ?

+500k download at 2$. From https://play.google.com/store/apps/details?id=com. bithack.apparatus

Martin Tourneboeuf libGdx 11 Avril 2017 10 / 31 Overview of libGdx How can all that be “easy” ?

Martin Tourneboeuf libGdx 11 Avril 2017 11 / 31 Overview of libGdx How can all that be “easy” ?

1 package com. tutorial .helloGame; 2 3 import com.badlogic.gdx.ApplicationAdapter; 4 import com.badlogic.gdx.Gdx; 5 import com.badlogic.gdx.graphics.GL20; 6 import com.badlogic.gdx.graphics.Texture; 7 import com.badlogic.gdx.graphics.g2d. SpriteBatch ; 8 9 public class HellloGame extends ApplicationAdapter { 10 SpriteBatch batch; 11 Texture img; 12 13 @Override 14 public void create () { 15 batch= new SpriteBatch(); 16 img= new Texture(”badlogic.jpg”); 17 } 18 19 @Override 20 public void render () { 21 Gdx.gl.glClearColor(1, 0, 0, 1); 22 Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) ; 23 batch.begin(); 24 batch.draw(img, 0, 0); 25 batch.end(); 26 } 27 }

Martin Tourneboeuf libGdx 11 Avril 2017 11 / 31 Overview of libGdx How can all that be “easy” ?

1 package com. tutorial .helloGame; 2 3 import com.badlogic.gdx.ApplicationAdapter; 4 import com.badlogic.gdx.Gdx; 5 import com.badlogic.gdx.graphics.GL20; 6 import com.badlogic.gdx.graphics.Texture; 7 import com.badlogic.gdx.graphics.g2d. SpriteBatch ; 8 9 public class HellloGame extends ApplicationAdapter { 10 SpriteBatch batch; 11 Texture img; 12 13 @Override 14 public void create () { 15 batch= new SpriteBatch(); 16 img= new Texture(”badlogic.jpg”); 17 } 18 19 @Override 20 public void render () { 21 Gdx.gl.glClearColor(1, 0, 0, 1); 22 Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) ; 23 batch.begin(); 24 batch.draw(img, 0, 0); 25 batch.end(); 26 } 27 }

Martin Tourneboeuf libGdx 11 Avril 2017 11 / 31 Overview of libGdx How can all that be “easy” ?

1 package com. tutorial .helloGame; 2 3 import com.badlogic.gdx.ApplicationAdapter; 4 import com.badlogic.gdx.Gdx; 5 import com.badlogic.gdx.graphics.GL20; 6 import com.badlogic.gdx.graphics.Texture; 7 import com.badlogic.gdx.graphics.g2d. SpriteBatch ; 8 9 public class HellloGame extends ApplicationAdapter { 10 SpriteBatch batch; 11 Texture img; 12 13 @Override 14 public void create () { 15 batch= new SpriteBatch(); 16 img= new Texture(”badlogic.jpg”); 17 } 18 19 @Override 20 public void render () { 21 Gdx.gl.glClearColor(1, 0, 0, 1); 22 Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) ; 23 batch.begin(); 24 batch.draw(img, 0, 0); 25 batch.end(); 26 } 27 }

Martin Tourneboeuf libGdx 11 Avril 2017 11 / 31 Overview of libGdx How can all that be “easy” ?

Martin Tourneboeuf libGdx 11 Avril 2017 12 / 31 Low level bindings example : openGL Plan

— Introductory Videos

1 Overview of libGdx What is libGdx ? Who uses libGdx ? How can all that be “easy” ?

2 Low level bindings example : openGL Android Desktop GLES

3 High level Api Architecture Tests — Conclusion

Martin Tourneboeuf libGdx 11 Avril 2017 13 / 31 Low level bindings example : openGL

Martin Tourneboeuf libGdx 11 Avril 2017 14 / 31 Low level bindings example : openGL

1 package com.badlogic.gdx.graphics; 2 3 import java.nio.Buffer; 4 import java.nio.FloatBuffer; 5 import java.nio.IntBuffer; 6 7 p u b l i interface GL20 { 8 p u b l i c void glActiveTexture (int texture); 9 p u b l i c void glBindTexture (int target, int texture); 10 p u b l i c void glBlendFunc (int sfactor , int dfactor); 11 p u b l i c void glClear (int mask); 12 }

Martin Tourneboeuf libGdx 11 Avril 2017 15 / 31 Low level bindings example : openGL Android

1 package com.badlogic.gdx.backends.android; 2 3 import java.nio.Buffer; 4 import java.nio.FloatBuffer; 5 import java.nio.IntBuffer; 6 7 import com.badlogic.gdx.graphics.GL20; 8 9 p u b l i c class AndroidGL20 implements GL20 { 10 s t a t i c { 11 System. loadLibrary(”gdx”); 12 i n i t ( ) ; 13 p r i v a t e static native void init (); 14 p u b l i c native void glActiveTexture (int texture); 15 p u b l i c native void glAttachShader (int program, int s h a d e r ) ; 16 p u b l i c native void glBindAttribLocation (int program, int index , String name); 17 }}

Martin Tourneboeuf libGdx 11 Avril 2017 16 / 31 Low level bindings example : openGL Android

1 #i n c l u d e”AndroidGL20.h” 2 #i n c l u d e 3 #i n c l u d e 4 /∗ 5 ∗ C l a s s: com b a d l o g i c g d x b a c k e n d s a n d r o i d AndroidGL20 6 ∗ Method: glActiveTexture 7 ∗ S i g n a t u r e:(I)V 8 ∗/ 9 JNIEXPORT voidJNICALL J a v a c o m b a d l o g i c g d x b a c k e n d s a n d r o i d AndroidGL20 glActiveTexture ( JNIEnv ∗ , jobject, jint texture) 10 { 11 glActiveTexture( texture ); 12 }

Martin Tourneboeuf libGdx 11 Avril 2017 17 / 31 Low level bindings example : openGL Desktop

1 package com.badlogic.gdx.backends.lwjgl; 2 3 import org.lwjgl.opengl.GL13; 4 import com.badlogic.gdx. utils .GdxRuntimeException; 5 6 c l a s s LwjglGL20 implements com.badlogic.gdx.graphics.GL20 { 7 p u b l i c void glActiveTexture (int texture) { 8 GL13.glActiveTexture(texture); 9 } 10 }

Martin Tourneboeuf libGdx 11 Avril 2017 18 / 31 Low level bindings example : openGL Desktop

1 package org.lwjgl.opengl; 2 3 import org.lwjgl.util.generator. ∗ ; 4 import org.lwjgl.util.generator.opengl. ∗ ; 5 6 import java.nio. ∗ ; 7 8 @DeprecatedGL 9 p u b l i c interface GL13 { 10 v o i d glActiveTexture(@GLenum int texture); 11 }

Martin Tourneboeuf libGdx 11 Avril 2017 19 / 31 Low level bindings example : openGL GLES

1 void GLAPIENTRY 2 m e s a ActiveTexture(GLenum texture) 3 { 4 const GLuint texUnit = texture − GL TEXTURE0 ; 5 GLuint k; 6 GET CURRENT CONTEXT( c t x ) ; 7 8 if (MESA VERBOSE & (VERBOSE API |VERBOSE TEXTURE) ) 9 mesa debug ( ctx ,”glActiveTexture%s \n”, 10 m e s a e n u m t o string(texture)); 11 12 if (ctx−>Texture.CurrentUnit == texUnit) 13 return; 14 15 k= m e s a m a x t e x u n i t ( c t x ) ; 16 17 assert(k <= ARRAY SIZE ( ctx−>Texture.Unit)); 18 19 if (texUnit >= k ) { 20 m e s a error(ctx, GL INVALID ENUM,”glActiveTexture(texture=%s)”, 21 m e s a e n u m t o string(texture)); 22 return; 23 } 24 25FLUSH VERTICES(ctx , NEW TEXTURE) ; 26 27 ctx−>Texture.CurrentUnit = texUnit; 28 if (ctx−>Transform.MatrixMode == GL TEXTURE) { 29/ ∗ update current stack pointer ∗/ 30 ctx−>CurrentStack = &ctx−>TextureMatrixStack[texUnit ]; 31 } 32 }

Martin Tourneboeuf libGdx 11 Avril 2017 20 / 31 Low level bindings example : openGL GLES

High latency (1.1 ms vs 0.07 ms) High bandwidth (200 Gb/s vs 20 Gb/s for RAM) Buffering

Martin Tourneboeuf libGdx 11 Avril 2017 21 / 31 Low level bindings example : openGL GLES

1 ! ! ARBvp1 . 0 2 TEMP vertexClip ; 3 DP4 vertexClip.x, state.matrix.mvp.row[0], vertex.position; 4 DP4 vertexClip.y, state.matrix.mvp.row[1], vertex.position; 5 DP4 vertexClip.z, state.matrix.mvp.row[2], vertex.position; 6 DP4 vertexClip.w, state.matrix.mvp.row[3], vertex.position; 7 MOV result.position , vertexClip; 8 MOV result.color , vertex.color; 9 MOV result.texcoord[0], vertex.texcoord; 10 END

1 ! ! ARBfp1 . 0 2 TEMP c o l o r ; 3 MUL color , fragment.texcoord[0].y, 2.0; 4 ADD color , 1.0, −c o l o r ; 5 ABS color , color; 6 ADD result.color , 1.0, −c o l o r ; 7 MOV result.color.a, 1.0; 8 END

Martin Tourneboeuf libGdx 11 Avril 2017 22 / 31 Low level bindings example : openGL GLES

Martin Tourneboeuf libGdx 11 Avril 2017 23 / 31 Low level bindings example : openGL GLES A trip through the Graphics Pipeline 2011: Index

Part 1: Introduction; the Software stack. Part 2: GPU memory architecture and the Command Processor. Part 3: 3D pipeline overview, vertex processing. Part 4: Texture samplers. Part 5: Primitive Assembly, Clip/Cull, Projection, and Viewport transform. Part 6: (Triangle) rasterization and setup. Part 7: Z/Stencil processing, 3 different ways. Part 8: Pixel processing fork phase. Part 9: Pixel processing join phase. Part 10: Geometry Shaders. Part 11: Stream-Out. Part 12: Tessellation.

Part 13: Compute Shaders. https://fgiesen.wordpress.com/2011/07/09/ a-trip-through-the-graphics-pipeline-2011-index/

Martin Tourneboeuf libGdx 11 Avril 2017 24 / 31 High level Api Plan

— Introductory Videos

1 Overview of libGdx What is libGdx ? Who uses libGdx ? How can all that be “easy” ?

2 Low level bindings example : openGL Android Desktop GLES

3 High level Api Architecture Tests — Conclusion

Martin Tourneboeuf libGdx 11 Avril 2017 25 / 31 High level Api Architecture Architecture

Martin Tourneboeuf libGdx 11 Avril 2017 26 / 31 High level Api Architecture Architecture

Martin Tourneboeuf libGdx 11 Avril 2017 26 / 31 High level Api Architecture Architecture

Martin Tourneboeuf libGdx 11 Avril 2017 26 / 31 High level Api Architecture Architecture

Martin Tourneboeuf libGdx 11 Avril 2017 26 / 31 High level Api Tests Personal Tests

New project Baby Pony Lost on Ice (Auto generated) (Box2d, sprite)

Hypercube Tower destroy (3D Model) (bullet)

Martin Tourneboeuf libGdx 11 Avril 2017 27 / 31 High level Api Tests Official Tests

Triangle Animation

Material Text Area

Martin Tourneboeuf libGdx 11 Avril 2017 28 / 31 Conclusion Conclusion

“LibGdx is big framework accessible with little difficutly”

Martin Tourneboeuf libGdx 11 Avril 2017 29 / 31 Conclusion Conclusion

“LibGdx is big framework accessible with little difficutly”

Martin Tourneboeuf libGdx 11 Avril 2017 29 / 31 Conclusion Conclusion

“LibGdx is big framework accessible with little difficutly”

Martin Tourneboeuf libGdx 11 Avril 2017 29 / 31 Conclusion More

Gradle , JavaScript, Dart Extensions (box2D, bullet, freetype, visUI (skin), video, ai, pay) 3D models : Blender Java standard lib (io, files) Preferences saving Events, Application life cycle. File types : Midi, mp3, ogg OpenGameArt.com Game engines : Unreal 4

Martin Tourneboeuf libGdx 11 Avril 2017 30 / 31 Conclusion Question

Any Questions ?

Martin Tourneboeuf libGdx 11 Avril 2017 31 / 31