Eu estava testando o compilador FreeBASIC por sua capacidade de fazer software interativo (neste caso, um jogo simples chamado Asteroids.)
O código .bas para isso está logo abaixo:
' ÜÛÛÛÛÜ ÜÛÛÛÛÛÛÜ ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÜ ÜÛÛÛÛÛÜ ÛÛ ÛÛÛÛÛÛÜ ÜÛÛÛÛÛÛÜ
'ÛÛ ÛÛ ÛÛß ßßß ÛÛ ÛÛ ÛÛ ßÛÛ ÛÛß ßÛÛ ÛÛ ÛÛ ßÛÛ ÛÛß ßßß
'ÛÛ ÛÛ ßÛÛÜ ÛÛ ÛÛ ÛÛ ÜÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ßÛÛÜ
'ÛÛÛÛÛÛÛÛ ßÛÛÜ ÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛß ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ßÛÛÜ
'ÛÛ ÛÛ ßÛÛÜ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ßÛÛÜ
'ÛÛ ÛÛ ÛÛÜ ÜÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛÜ ÜÛÛ ÛÛ ÛÛ ÜÛÛ ÛÛÜ ÜÛÛ
'ÛÛ ÛÛ ßÛÛÛÛß ÛÛ ÛÛÛÛÛÛÛÛÛ ÛÛ ÛÛ ßÛÛÛÛÛß ÛÛ ÛÛÛÛÛÛß ßÛÛÛÛß
'
'This is a one person game. The object is to shoot the falling asteroids and
'keep them from hitting the surface. Use the left and right arrow keys to
'move your gun and the up key to fire. The "P" button pauses the game, and
'the "Q" button ends it. When a game is paused, hit space to make it run
'again. Scoring is based on the level you're on. The higher the level, the
'more points for hit asteroids, and the less points taken away for missed
'asteroids. While you play, you may notice the screen flickering badly, or
'the action to fast. To correct this, make the number after Flicker.Control
'(shown below) bigger. If the game goes too slow, make the number smaller.
Flicker.Control = 500 ' Now press "F5" to play.
'
'
'
SCREEN 7 '320 X 200 resolution
RANDOMIZE TIMER
movement = 0
playagain:
CLS
LOCATE 12, 1
COLOR 15
INPUT ; "What level do you want to start at"; level
LOCATE 12, 1
PRINT " "
gun = 165
missile.x = -5000
missile.y = 5000
totalhit = 0
misses = 0
totaldropped = 0
newasteroid:
asteroid.x = 319 * RND + 1
asteroid.y = 1
totaldropped = totaldropped + 1
a:
COLOR 0
WHILE movement = 1
LINE (gun2 - 20, 170)-(gun2 + 20, 170)
LINE (gun2, 155)-(gun2 - 20, 170)
LINE (gun2, 155)-(gun2 + 20, 170)
LINE (gun2 - 3, 147)-(gun2 + 3, 170), , BF
movement = 0
WEND
COLOR 15
LINE (gun - 20, 170)-(gun + 20, 170)
LINE (gun, 155)-(gun - 20, 170)
LINE (gun, 155)-(gun + 20, 170)
LINE (gun - 3, 147)-(gun + 3, 170), , BF
LINE (asteroid.x - 10, asteroid.y - 6)-(asteroid.x + 10, asteroid.y + 6), 6, BF
CIRCLE (missile.x, missile.y), 3, 12
LINE (1, 171)-(319, 171), 9
FOR count = 1 TO Flicker.Control
NEXT count
asteroid.x2 = asteroid.x
asteroid.y2 = asteroid.y
missile.x2 = missile.x
missile.y2 = missile.y
COLOR 0
LINE (asteroid.x2 - 10, asteroid.y2 - 6)-(asteroid.x2 + 10, asteroid.y2 + 6), 0, BF
CIRCLE (missile.x2, missile.y2), 3, 0
LOCATE 23, 1
COLOR 9
PRINT "Shot:"; totalhit
LOCATE 23, 11
PRINT "Level:"; level
LOCATE 23, 21
PRINT "Score:"; score
missile.y = missile.y - 5
IF missile.y < 1 THEN
missile.y = 5000
END IF
asteroid.y = asteroid.y + level * .75
IF asteroid.y > 170 THEN
CIRCLE (asteroid.x, asteroid.y), 30, 14
CIRCLE (asteroid.x, asteroid.y), 30, 0
misses = misses + 1
IF misses = 10 THEN
GOTO gameover
END IF
score = score - INT(10 / level)
GOTO newasteroid
END IF
IF missile.x - 3 < asteroid.x + 10 AND missile.x + 3 > asteroid.x - 10 AND missile.y + 3 < asteroid.y + 6 THEN
totalhit = totalhit + 1
IF totalhit / 10 = INT(totalhit / 10) THEN
level = level + 1
misses = 0
END IF
score = score + 10 * level
FOR ctr = 1 TO 7
radius = 15 * RND + 5
offset.x = 40 * RND - 20
offset.y = 40 * RND - 20
circlecolor = 16 * RND
CIRCLE (asteroid.x + offset.x, asteroid.y + offset.y), radius, circlecolor
FOR ctr2 = 1 TO 50
NEXT ctr2
CIRCLE (asteroid.x + offset.x, asteroid.y + offset.y), radius, 0
NEXT ctr
missile.y = 5000
GOTO newasteroid
END IF
move$ = INKEY$
SELECT CASE move$
CASE CHR$(0) + "K"
gun2 = gun
gun = gun - 5
movement = 1
CASE CHR$(0) + "M"
gun2 = gun
gun = gun + 5
movement = 1
CASE CHR$(0) + "H"
missile.x = gun
missile.y = 147
CASE "q"
GOTO quit
CASE "p"
COLOR 15
LINE (gun - 20, 170)-(gun + 20, 170)
LINE (gun, 155)-(gun - 20, 170)
LINE (gun, 155)-(gun + 20, 170)
LINE (gun - 3, 147)-(gun + 3, 170), , BF
LINE (asteroid.x - 10, asteroid.y - 6)-(asteroid.x + 10, asteroid.y + 6), 6, BF
CIRCLE (missile.x, missile.y), 3, 12
LOCATE 12, 4
PRINT "Game Paused Hit Space to continue"
startpause:
a$ = INKEY$
SELECT CASE a$
CASE " "
LOCATE 12, 4
PRINT " "
GOTO endpause
END SELECT
GOTO startpause
END SELECT
endpause:
GOTO a
gameover:
LINE (1, 171)-(319, 171), 9
LOCATE 23, 1
COLOR 9
PRINT "Shot:"; totalhit
LOCATE 23, 11
PRINT "Level:"; level
LOCATE 23, 21
PRINT "Score:"; score
COLOR 15
LINE (gun - 20, 170)-(gun + 20, 170)
LINE (gun, 155)-(gun - 20, 170)
LINE (gun, 155)-(gun + 20, 170)
LINE (gun - 3, 147)-(gun + 3, 170), , BF
COLOR 4
LOCATE 12, 1
PRINT "E O"
LOCATE 12, 1
PRINT "ME OV"
LOCATE 12, 1
PRINT "AME OVE"
LOCATE 12, 1
PRINT "GAME OVER"
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
LOCATE 12, 1
PRINT " GAME OVER "
FOR ctr = 1 TO 500
NEXT ctr
LOCATE 13, 13
PRINT "Play Again? y/n"
playagain.y.n:
y.n$ = INKEY$
SELECT CASE y.n$
CASE "n"
GOTO quit
CASE "y"
GOTO playagain
END SELECT
GOTO playagain.y.n
quit:
Eu usei este comando para compilar os dados em um aplicativo utilizável.
$ /usr/local/bin/fbc -lang qb roids.bas
O que recebi foi um erro, dizendo que estou com falta de bibliotecas para compilar corretamente esse código.
ld: cannot find -lX11
ld: cannot find -lXext
ld: cannot find -lXpm
ld: cannot find -lXrandr
ld: cannot find -lXrender
A minha pergunta é como e onde posso descarregar estas bibliotecas para poder compilar este código e criar o pequeno jogo?
Agradeço antecipadamente.