FreeBasic Demo
'' comentarios aca
REM
REM TEST
REM
CLS
'' funcion retorna siempre 1
Declare function f1() as integer
Function f1() as integer
return int(RND*10)
end function
'' Subrutina
Sub SubTest (P as string ="AAA")
print P
end sub
'' on error goto ERROR
Randomize , 1
dim a as integer
dim casa as string
dim i1 as integer
dim j1 as integer
dim aa as string
dim bb as string
var zz = 0
dim array(1 to 2, 1 to 10) as Integer
dim myfile1 as integer '' definicion de puntero a fichero
myfile1 = FreeFile()
const nocambia = 2
const nocam = "aaaa"
a = 5
bb = "algo"
casa = "algo aca"
print a
print casa
for i1 = 1 to 10
for j1 = 1 to 10
color i1*j1
rem locate i1,j1
print i1, " x ", j1, " = ", i1*j1
next
next
beep
i1 = exec( "ls ", " -ail")
if i1 = -1 then
print "Error"; i1
else
print "Ok"; i1
end if
print "Numero al azar"
print Rnd
print int(Rnd*100)
print "SubTest"
SubTest "algo aca"
print "Escriba una palabra:"
read casa
print "Función F1"
Print f1();
print "Hola ", casa
input "Como te llamas?", casa
print casa
print "Presione una tecla para salir."
aa = inkey()
while ( aa = "" )
aa = inkey()
wend
Print "Apretar del 1 al 5"
Dim choice As String
Do
choice = Input(1)
Loop Until choice >= "1" And choice <= "5"
'' leer contenido en disco
open "/tmp/algo2.txt" for input as #myfile1
do until EOF( myfile1 )
line input #myfile1, bb
print bb
loop
close #myfile1
'' grabar cosas en disco
open "/tmp/algo2.txt" for output as #myfile1
for i1 = 1 to 10
print #myfile1, i1
next
close #myfile1
'' Zona de gráficos
screen 12
Line (10,10)-(10,200),12
Line (10,10)-(200,10),2
Line (10,200)-(200,200),3
Line (200,10)-(200,200),6
Circle (320, 240), 200, 15
locate 10,10
print "Hola"
sleep
CLS
Dim ip As Integer Ptr
Dim As Integer i, j, k
'simple sprite
For i=0 To 63: For j=0 To 63:PSet (i,j), (i\4) Xor (j\4):Next j,i
ip=ImageCreate(64,64)
Get (0,0)-(63,63),ip
Cls
'viewport
Line (215,135)-(425,345),1,bf
View (220,140)-(420,340)
k=0
'move sprite
Do
i=100*Sin(k*.02)+50: j=100* Sin(k*.027)+50
ScreenSync
ScreenLock
Cls 1: Put (i,j),ip ,PSet
ScreenUnlock
k=k+1
Loop Until Len(Inkey)
ImageDestroy(ip)
Sleep
'' SUB ERROR:
'' print "error"
'' end
'' #include "vbcompat.bi"
'' Dim da As Double = DateSerial (2005, 11, 28) + TimeSerial(7, 30, 50)
'' Print Format(da, "yyyy/mm/dd hh:mm:ss "); Year(da)
screen 20
cls
print "20"
'Move to (50,50) without drawing
Draw "BM 50,50"
'Set drawing color to 2 (green)
Draw "C2"
draw "r100 d100 L50 U30"
sleep
REM
REM TEST
REM
CLS
'' funcion retorna siempre 1
Declare function f1() as integer
Function f1() as integer
return int(RND*10)
end function
'' Subrutina
Sub SubTest (P as string ="AAA")
print P
end sub
'' on error goto ERROR
Randomize , 1
dim a as integer
dim casa as string
dim i1 as integer
dim j1 as integer
dim aa as string
dim bb as string
var zz = 0
dim array(1 to 2, 1 to 10) as Integer
dim myfile1 as integer '' definicion de puntero a fichero
myfile1 = FreeFile()
const nocambia = 2
const nocam = "aaaa"
a = 5
bb = "algo"
casa = "algo aca"
print a
print casa
for i1 = 1 to 10
for j1 = 1 to 10
color i1*j1
rem locate i1,j1
print i1, " x ", j1, " = ", i1*j1
next
next
beep
i1 = exec( "ls ", " -ail")
if i1 = -1 then
print "Error"; i1
else
print "Ok"; i1
end if
print "Numero al azar"
print Rnd
print int(Rnd*100)
print "SubTest"
SubTest "algo aca"
print "Escriba una palabra:"
read casa
print "Función F1"
Print f1();
print "Hola ", casa
input "Como te llamas?", casa
print casa
print "Presione una tecla para salir."
aa = inkey()
while ( aa = "" )
aa = inkey()
wend
Print "Apretar del 1 al 5"
Dim choice As String
Do
choice = Input(1)
Loop Until choice >= "1" And choice <= "5"
'' leer contenido en disco
open "/tmp/algo2.txt" for input as #myfile1
do until EOF( myfile1 )
line input #myfile1, bb
print bb
loop
close #myfile1
'' grabar cosas en disco
open "/tmp/algo2.txt" for output as #myfile1
for i1 = 1 to 10
print #myfile1, i1
next
close #myfile1
'' Zona de gráficos
screen 12
Line (10,10)-(10,200),12
Line (10,10)-(200,10),2
Line (10,200)-(200,200),3
Line (200,10)-(200,200),6
Circle (320, 240), 200, 15
locate 10,10
print "Hola"
sleep
CLS
Dim ip As Integer Ptr
Dim As Integer i, j, k
'simple sprite
For i=0 To 63: For j=0 To 63:PSet (i,j), (i\4) Xor (j\4):Next j,i
ip=ImageCreate(64,64)
Get (0,0)-(63,63),ip
Cls
'viewport
Line (215,135)-(425,345),1,bf
View (220,140)-(420,340)
k=0
'move sprite
Do
i=100*Sin(k*.02)+50: j=100* Sin(k*.027)+50
ScreenSync
ScreenLock
Cls 1: Put (i,j),ip ,PSet
ScreenUnlock
k=k+1
Loop Until Len(Inkey)
ImageDestroy(ip)
Sleep
'' SUB ERROR:
'' print "error"
'' end
'' #include "vbcompat.bi"
'' Dim da As Double = DateSerial (2005, 11, 28) + TimeSerial(7, 30, 50)
'' Print Format(da, "yyyy/mm/dd hh:mm:ss "); Year(da)
screen 20
cls
print "20"
'Move to (50,50) without drawing
Draw "BM 50,50"
'Set drawing color to 2 (green)
Draw "C2"
draw "r100 d100 L50 U30"
sleep
Comentarios
Publicar un comentario