SlideShare a Scribd company logo
Ring Documentation, Release 1.5.4
text {
point = 400
size = 30
nStep = 9
file = "fonts/pirulen.ttf"
text = "Game Over !!!"
x = 500 y=10
state = func ogame,oself {
if oself.y >= 400
ogame.shutdown = true
ok
}
}
}
showfire(oGame,oGame.aObjects[oGameState.PlayerIndex].x+40,
oGame.aObjects[oGameState.PlayerIndex].y+40)
oGame.aObjects[oGameState.PlayerIndex].enabled = false
oGame.remove(oGameState.PlayerIndex)
ok
func showfire oGame,nX,nY
oGame {
animate {
file = "images/fire.png"
x = nX
y = nY
framewidth = 40
height = 42
nStep = 3
transparent = true
state = func oGame,oSelf {
oSelf {
nStep--
if nStep = 0
nStep = 3
if frame < 13
frame++
else
frame=1
oGame.remove(oself.nIndex)
ok
ok
}
}
}
}
func addenemy oGame,xPos
oGame {
lbraceend = false
sprite {
type = ge_type_enemy
file = "images/smenemy.png"
transparent = true
x = xPos y =10 width=100 height=100
animate=true Scaled=true
direction = GE_DIRECTION_NOMOVE
52.29. Super Man 2016 Game 495
Ring Documentation, Release 1.5.4
temp = xPos
state = func oGame,oSelf {
oself {
x = oSelf.temp + oGame.aObjects[2].x
if y < 0 y = 0 ok
if y > 100 y=100 ok
if x > SCREEN_W or x < 0 return ok
}
if random(10) = 1
if oGameState.gameresult return ok
ogame {
sprite {
type = ge_type_fire
file = "images/smrocket.png"
scaled = true
transparent = true
x = oself.x + 30
y = oself.y + oself.height+ 30
width = 30
height = 30
point = ogame.screen_h+30
nstep = 30
direction = ge_direction_incvertical
xvalue = oGame.aObjects[2].x
temp = oself.x + 30 - xvalue
state = func oGame,oSelf {
oself { x = oSelf.temp + oGame.aObjects[2].x }
x = oGame.aObjects[oGameState.playerindex]
if oself.x >= x.x and oself.y >= x.y and
oself.x <= x.x + x.width and
oself.y <= x.y + x.height
if oGameState.value > 0
oGameState.value-=1000
ok
ogame.remove(oself.nindex)
checkgameover(oGame)
ok
}
}
}
ok
}
}
}
ogame.lbraceend = true
func checkstarskey oGame,oSelf,nValue,nRow,nCol
switch nValue
on 4
oGame.aObjects[2].aMap[nRow][nCol] = 6
oGameState.Score += 100
checkopenwall(oGame)
oGame { Sound {
once = true
file = "sound/sfx_point.wav"
} }
52.29. Super Man 2016 Game 496
Ring Documentation, Release 1.5.4
on 5
oGame.aObjects[2].aMap[nRow][nCol] = 0
oGameState.DoorKey = true
oGameState.Score += 500
checkopenwall(oGame)
oGame { Sound {
once = true
file = "sound/sfx_point.wav"
} }
off
func checkstarskeycol oGame,oSelf
nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y)
nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y)
nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y+oSelf.height)
nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y+oSelf.height)
nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y+oSelf.height)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y)
nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y)
nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y+oSelf.height)
nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y+oSelf.height)
nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y+oSelf.height)
checkstarskey(oGame,oSelf,nValue,nRow,nCol)
func callenemystate oGame
for t in oGame.aObjects
t {
if type = GE_TYPE_ENEMY
call state(oGame,t)
ok
}
next
Class GameState
down = 3
gameresult = false
Score = 0
startplay=false
lastcol = 0
playerwin = false
DoorKey = false
playerindex = 4
value = 1000
moveplayer = false
Screen Shot:
52.29. Super Man 2016 Game 497
Ring Documentation, Release 1.5.4
52.29. Super Man 2016 Game 498
CHAPTER
FIFTYTHREE
BUILDING GAMES FOR ANDROID
In this chapter we will learn about Building RingLibSDL Games for Mobile.
So we can create packages (*.apk) for the applications that are developed using Ring Game Engine for 2D Games.
53.1 Download Requirements and Update the Android SDK
• The Android SDK Tools
https://developer.android.com/studio/index.html
• The Android NDK
https://developer.android.com/ndk/index.html
• Apache Ant v1.8 or later
http://ant.apache.org/bindownload.cgi
• Java SE Development Kit (JDK) v6 or later
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
• Update the Android SDK to get the API and tools packages required for development
53.2 Project Folder
Open the project folder : ring/android/ringlibsdl/project
499
Ring Documentation, Release 1.5.4
You can add the source code (*.ring) and Images/Sound Files to the assets folder.
You will find the Flappy Bird 3000 Game ready for building.
The execution starts from the start.ring file
load "game2.ring"
53.3 Building the project
Move to the ring/android/ringlibsdl/project folder
We can build using the next command (We need to do this for one time only).
ndk-build
Then we can create the package (*.apk) using the next command.
53.3. Building the project 500
Ring Documentation, Release 1.5.4
ant debug
53.3. Building the project 501
CHAPTER
FIFTYFOUR
USING RINGOPENGL AND RINGFREEGLUT FOR 3D GRAPHICS
In this chapter we will learn about using RingOpenGL
54.1 Samples Source (Authors)
The samples in this chapter are based on C Tutorials
from
1. http://www.lighthouse3d.com/tutorials/glut-tutorial/
2. http://www.wikihow.com/Make-a-Cube-in-OpenGL
54.2 What is RingOpenGL?
RingOpenGL contains the Ring binding to the OpenGL library
You can learn about OpenGL from : https://www.opengl.org/
RingOpenGL comes with support for the next versions
• OpenGL 1.1
• OpenGL 1.2
• OpenGL 1.3
• OpenGL 1.4
• OpenGL 1.5
• OpenGL 2.0
• OpenGL 2.1
• OpenGL 3.0
• OpenGL 3.2
• OpenGL 3.3
• OpenGL 4.0
• OpenGL 4.1
• OpenGL 4.2
• OpenGL 4.3
502
Ring Documentation, Release 1.5.4
• OpenGL 4.4
• OpenGL 4.5
• OpenGL 4.6
For example, if you want to use OpenGL 2.1 then load RingOpenGL 2.1 library
load "opengl21lib.ring"
54.3 What is RingFreeGLUT?
RingFreeGLUT contains the Ring binding to the FreeGLUT library
You can learn about FreeGLUT from : http://freeglut.sourceforge.net/
To use the RingFreeGLUT library, Just load the library
load "freeglut.ring"
54.4 The First Window using RingFreeGLUT
Example:
load "freeglut.ring"
func main
glutInit()
glutInitDisplayMode(GLUT_SINGLE)
glutInitWindowSize(800, 600)
glutInitWindowPosition(100, 10)
glutCreateWindow("RingFreeGLUT - Test 1")
glutDisplayFunc(:displayCode)
glutMainLoop()
func displaycode
Screen Shot
54.3. What is RingFreeGLUT? 503
Ring Documentation, Release 1.5.4
54.5 Drawing using RingOpenGL
Example:
load "freeglut.ring"
load "opengl21lib.ring"
func main
glutInit()
glutInitDisplayMode(GLUT_SINGLE)
glutInitWindowSize(800, 600)
glutInitWindowPosition(100, 10)
glutCreateWindow("RingFreeGLUT - Test 2")
glutDisplayFunc(:displayCode)
glutMainLoop()
func displaycode
glClear(GL_COLOR_BUFFER_BIT)
glColor3f(0,255,0)
glBegin(GL_POLYGON)
glVertex3f(0.0, 0.0, 0.0)
54.5. Drawing using RingOpenGL 504

More Related Content

PDF
The Ring programming language version 1.5.3 book - Part 63 of 184
PDF
The Ring programming language version 1.9 book - Part 63 of 210
PDF
The Ring programming language version 1.5.3 book - Part 50 of 184
PDF
The Ring programming language version 1.3 book - Part 40 of 88
PDF
The Ring programming language version 1.6 book - Part 55 of 189
PPTX
OGDC2013_Lets remake the wheel_ Mr Nguyen Trung Hung
PPTX
Ogdc 2013 lets remake the wheel
PDF
The Ring programming language version 1.9 book - Part 60 of 210
The Ring programming language version 1.5.3 book - Part 63 of 184
The Ring programming language version 1.9 book - Part 63 of 210
The Ring programming language version 1.5.3 book - Part 50 of 184
The Ring programming language version 1.3 book - Part 40 of 88
The Ring programming language version 1.6 book - Part 55 of 189
OGDC2013_Lets remake the wheel_ Mr Nguyen Trung Hung
Ogdc 2013 lets remake the wheel
The Ring programming language version 1.9 book - Part 60 of 210

What's hot (19)

PDF
The Ring programming language version 1.5.1 book - Part 44 of 180
PDF
The Ring programming language version 1.5 book - Part 9 of 31
PDF
The Ring programming language version 1.5.3 book - Part 71 of 184
PDF
The Ring programming language version 1.10 book - Part 64 of 212
PDF
The Ring programming language version 1.2 book - Part 39 of 84
PDF
Zone.js 2017
PDF
The Ring programming language version 1.8 book - Part 59 of 202
PDF
The Ring programming language version 1.10 book - Part 81 of 212
PDF
The Ring programming language version 1.5.3 book - Part 62 of 184
PDF
The Ring programming language version 1.3 book - Part 52 of 88
PDF
Kotlin Coroutines - the new async
DOCX
3 1-1
PDF
The Ring programming language version 1.8 book - Part 53 of 202
PDF
The Ring programming language version 1.5.4 book - Part 40 of 185
PPTX
R part II
PDF
The Ring programming language version 1.5.1 book - Part 49 of 180
PDF
The Ring programming language version 1.10 book - Part 50 of 212
PDF
The Ring programming language version 1.5.3 book - Part 79 of 184
PDF
The Ring programming language version 1.5.3 book - Part 61 of 184
The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5 book - Part 9 of 31
The Ring programming language version 1.5.3 book - Part 71 of 184
The Ring programming language version 1.10 book - Part 64 of 212
The Ring programming language version 1.2 book - Part 39 of 84
Zone.js 2017
The Ring programming language version 1.8 book - Part 59 of 202
The Ring programming language version 1.10 book - Part 81 of 212
The Ring programming language version 1.5.3 book - Part 62 of 184
The Ring programming language version 1.3 book - Part 52 of 88
Kotlin Coroutines - the new async
3 1-1
The Ring programming language version 1.8 book - Part 53 of 202
The Ring programming language version 1.5.4 book - Part 40 of 185
R part II
The Ring programming language version 1.5.1 book - Part 49 of 180
The Ring programming language version 1.10 book - Part 50 of 212
The Ring programming language version 1.5.3 book - Part 79 of 184
The Ring programming language version 1.5.3 book - Part 61 of 184
Ad

Similar to The Ring programming language version 1.5.4 book - Part 53 of 185 (20)

PDF
The Ring programming language version 1.5.2 book - Part 52 of 181
PDF
The Ring programming language version 1.3 book - Part 43 of 88
PDF
The Ring programming language version 1.5.3 book - Part 60 of 184
PDF
The Ring programming language version 1.5.4 book - Part 50 of 185
PDF
The Ring programming language version 1.5.1 book - Part 51 of 180
PDF
The Ring programming language version 1.4.1 book - Part 15 of 31
PDF
The Ring programming language version 1.5.2 book - Part 10 of 181
PDF
The Ring programming language version 1.7 book - Part 55 of 196
PDF
The Ring programming language version 1.9 book - Part 70 of 210
PDF
The Ring programming language version 1.5.4 book - Part 52 of 185
PDF
The Ring programming language version 1.5.4 book - Part 48 of 185
PDF
The Ring programming language version 1.2 book - Part 40 of 84
PDF
The Ring programming language version 1.5.1 book - Part 50 of 180
PDF
The Ring programming language version 1.3 book - Part 42 of 88
PDF
The Ring programming language version 1.5.3 book - Part 15 of 184
PPTX
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
PDF
The Ring programming language version 1.8 book - Part 57 of 202
PDF
The Ring programming language version 1.5.1 book - Part 48 of 180
PDF
The Ring programming language version 1.2 book - Part 37 of 84
PDF
The Ring programming language version 1.8 book - Part 58 of 202
The Ring programming language version 1.5.2 book - Part 52 of 181
The Ring programming language version 1.3 book - Part 43 of 88
The Ring programming language version 1.5.3 book - Part 60 of 184
The Ring programming language version 1.5.4 book - Part 50 of 185
The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.4.1 book - Part 15 of 31
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.7 book - Part 55 of 196
The Ring programming language version 1.9 book - Part 70 of 210
The Ring programming language version 1.5.4 book - Part 52 of 185
The Ring programming language version 1.5.4 book - Part 48 of 185
The Ring programming language version 1.2 book - Part 40 of 84
The Ring programming language version 1.5.1 book - Part 50 of 180
The Ring programming language version 1.3 book - Part 42 of 88
The Ring programming language version 1.5.3 book - Part 15 of 184
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
The Ring programming language version 1.8 book - Part 57 of 202
The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.8 book - Part 58 of 202
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
PDF
The Ring programming language version 1.10 book - Part 211 of 212
PDF
The Ring programming language version 1.10 book - Part 210 of 212
PDF
The Ring programming language version 1.10 book - Part 208 of 212
PDF
The Ring programming language version 1.10 book - Part 207 of 212
PDF
The Ring programming language version 1.10 book - Part 205 of 212
PDF
The Ring programming language version 1.10 book - Part 206 of 212
PDF
The Ring programming language version 1.10 book - Part 204 of 212
PDF
The Ring programming language version 1.10 book - Part 203 of 212
PDF
The Ring programming language version 1.10 book - Part 202 of 212
PDF
The Ring programming language version 1.10 book - Part 201 of 212
PDF
The Ring programming language version 1.10 book - Part 200 of 212
PDF
The Ring programming language version 1.10 book - Part 199 of 212
PDF
The Ring programming language version 1.10 book - Part 198 of 212
PDF
The Ring programming language version 1.10 book - Part 197 of 212
PDF
The Ring programming language version 1.10 book - Part 196 of 212
PDF
The Ring programming language version 1.10 book - Part 195 of 212
PDF
The Ring programming language version 1.10 book - Part 194 of 212
PDF
The Ring programming language version 1.10 book - Part 193 of 212
PDF
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 192 of 212

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Cloud computing and distributed systems.
PDF
KodekX | Application Modernization Development
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Spectroscopy.pptx food analysis technology
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
sap open course for s4hana steps from ECC to s4
“AI and Expert System Decision Support & Business Intelligence Systems”
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Approach and Philosophy of On baking technology
Cloud computing and distributed systems.
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25 Week I
Per capita expenditure prediction using model stacking based on satellite ima...
The AUB Centre for AI in Media Proposal.docx
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectroscopy.pptx food analysis technology

The Ring programming language version 1.5.4 book - Part 53 of 185

  • 1. Ring Documentation, Release 1.5.4 text { point = 400 size = 30 nStep = 9 file = "fonts/pirulen.ttf" text = "Game Over !!!" x = 500 y=10 state = func ogame,oself { if oself.y >= 400 ogame.shutdown = true ok } } } showfire(oGame,oGame.aObjects[oGameState.PlayerIndex].x+40, oGame.aObjects[oGameState.PlayerIndex].y+40) oGame.aObjects[oGameState.PlayerIndex].enabled = false oGame.remove(oGameState.PlayerIndex) ok func showfire oGame,nX,nY oGame { animate { file = "images/fire.png" x = nX y = nY framewidth = 40 height = 42 nStep = 3 transparent = true state = func oGame,oSelf { oSelf { nStep-- if nStep = 0 nStep = 3 if frame < 13 frame++ else frame=1 oGame.remove(oself.nIndex) ok ok } } } } func addenemy oGame,xPos oGame { lbraceend = false sprite { type = ge_type_enemy file = "images/smenemy.png" transparent = true x = xPos y =10 width=100 height=100 animate=true Scaled=true direction = GE_DIRECTION_NOMOVE 52.29. Super Man 2016 Game 495
  • 2. Ring Documentation, Release 1.5.4 temp = xPos state = func oGame,oSelf { oself { x = oSelf.temp + oGame.aObjects[2].x if y < 0 y = 0 ok if y > 100 y=100 ok if x > SCREEN_W or x < 0 return ok } if random(10) = 1 if oGameState.gameresult return ok ogame { sprite { type = ge_type_fire file = "images/smrocket.png" scaled = true transparent = true x = oself.x + 30 y = oself.y + oself.height+ 30 width = 30 height = 30 point = ogame.screen_h+30 nstep = 30 direction = ge_direction_incvertical xvalue = oGame.aObjects[2].x temp = oself.x + 30 - xvalue state = func oGame,oSelf { oself { x = oSelf.temp + oGame.aObjects[2].x } x = oGame.aObjects[oGameState.playerindex] if oself.x >= x.x and oself.y >= x.y and oself.x <= x.x + x.width and oself.y <= x.y + x.height if oGameState.value > 0 oGameState.value-=1000 ok ogame.remove(oself.nindex) checkgameover(oGame) ok } } } ok } } } ogame.lbraceend = true func checkstarskey oGame,oSelf,nValue,nRow,nCol switch nValue on 4 oGame.aObjects[2].aMap[nRow][nCol] = 6 oGameState.Score += 100 checkopenwall(oGame) oGame { Sound { once = true file = "sound/sfx_point.wav" } } 52.29. Super Man 2016 Game 496
  • 3. Ring Documentation, Release 1.5.4 on 5 oGame.aObjects[2].aMap[nRow][nCol] = 0 oGameState.DoorKey = true oGameState.Score += 500 checkopenwall(oGame) oGame { Sound { once = true file = "sound/sfx_point.wav" } } off func checkstarskeycol oGame,oSelf nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y) nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y) nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y) checkstarskey(oGame,oSelf,nValue,nRow,nCol) nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y+oSelf.height) nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y+oSelf.height) nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y+oSelf.height) checkstarskey(oGame,oSelf,nValue,nRow,nCol) nValue = oGame.aObjects[2].getvalue(oSelf.x+oSelf.width,oSelf.y) nRow = oGame.aObjects[2].getrow(oSelf.x+oSelf.width,oSelf.y) nCol = oGame.aObjects[2].getcol(oSelf.x+oSelf.width,oSelf.y) checkstarskey(oGame,oSelf,nValue,nRow,nCol) nValue = oGame.aObjects[2].getvalue(oSelf.x,oSelf.y+oSelf.height) nRow = oGame.aObjects[2].getrow(oSelf.x,oSelf.y+oSelf.height) nCol = oGame.aObjects[2].getcol(oSelf.x,oSelf.y+oSelf.height) checkstarskey(oGame,oSelf,nValue,nRow,nCol) func callenemystate oGame for t in oGame.aObjects t { if type = GE_TYPE_ENEMY call state(oGame,t) ok } next Class GameState down = 3 gameresult = false Score = 0 startplay=false lastcol = 0 playerwin = false DoorKey = false playerindex = 4 value = 1000 moveplayer = false Screen Shot: 52.29. Super Man 2016 Game 497
  • 4. Ring Documentation, Release 1.5.4 52.29. Super Man 2016 Game 498
  • 5. CHAPTER FIFTYTHREE BUILDING GAMES FOR ANDROID In this chapter we will learn about Building RingLibSDL Games for Mobile. So we can create packages (*.apk) for the applications that are developed using Ring Game Engine for 2D Games. 53.1 Download Requirements and Update the Android SDK • The Android SDK Tools https://developer.android.com/studio/index.html • The Android NDK https://developer.android.com/ndk/index.html • Apache Ant v1.8 or later http://ant.apache.org/bindownload.cgi • Java SE Development Kit (JDK) v6 or later http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html • Update the Android SDK to get the API and tools packages required for development 53.2 Project Folder Open the project folder : ring/android/ringlibsdl/project 499
  • 6. Ring Documentation, Release 1.5.4 You can add the source code (*.ring) and Images/Sound Files to the assets folder. You will find the Flappy Bird 3000 Game ready for building. The execution starts from the start.ring file load "game2.ring" 53.3 Building the project Move to the ring/android/ringlibsdl/project folder We can build using the next command (We need to do this for one time only). ndk-build Then we can create the package (*.apk) using the next command. 53.3. Building the project 500
  • 7. Ring Documentation, Release 1.5.4 ant debug 53.3. Building the project 501
  • 8. CHAPTER FIFTYFOUR USING RINGOPENGL AND RINGFREEGLUT FOR 3D GRAPHICS In this chapter we will learn about using RingOpenGL 54.1 Samples Source (Authors) The samples in this chapter are based on C Tutorials from 1. http://www.lighthouse3d.com/tutorials/glut-tutorial/ 2. http://www.wikihow.com/Make-a-Cube-in-OpenGL 54.2 What is RingOpenGL? RingOpenGL contains the Ring binding to the OpenGL library You can learn about OpenGL from : https://www.opengl.org/ RingOpenGL comes with support for the next versions • OpenGL 1.1 • OpenGL 1.2 • OpenGL 1.3 • OpenGL 1.4 • OpenGL 1.5 • OpenGL 2.0 • OpenGL 2.1 • OpenGL 3.0 • OpenGL 3.2 • OpenGL 3.3 • OpenGL 4.0 • OpenGL 4.1 • OpenGL 4.2 • OpenGL 4.3 502
  • 9. Ring Documentation, Release 1.5.4 • OpenGL 4.4 • OpenGL 4.5 • OpenGL 4.6 For example, if you want to use OpenGL 2.1 then load RingOpenGL 2.1 library load "opengl21lib.ring" 54.3 What is RingFreeGLUT? RingFreeGLUT contains the Ring binding to the FreeGLUT library You can learn about FreeGLUT from : http://freeglut.sourceforge.net/ To use the RingFreeGLUT library, Just load the library load "freeglut.ring" 54.4 The First Window using RingFreeGLUT Example: load "freeglut.ring" func main glutInit() glutInitDisplayMode(GLUT_SINGLE) glutInitWindowSize(800, 600) glutInitWindowPosition(100, 10) glutCreateWindow("RingFreeGLUT - Test 1") glutDisplayFunc(:displayCode) glutMainLoop() func displaycode Screen Shot 54.3. What is RingFreeGLUT? 503
  • 10. Ring Documentation, Release 1.5.4 54.5 Drawing using RingOpenGL Example: load "freeglut.ring" load "opengl21lib.ring" func main glutInit() glutInitDisplayMode(GLUT_SINGLE) glutInitWindowSize(800, 600) glutInitWindowPosition(100, 10) glutCreateWindow("RingFreeGLUT - Test 2") glutDisplayFunc(:displayCode) glutMainLoop() func displaycode glClear(GL_COLOR_BUFFER_BIT) glColor3f(0,255,0) glBegin(GL_POLYGON) glVertex3f(0.0, 0.0, 0.0) 54.5. Drawing using RingOpenGL 504