Applied docspak188.

This commit is contained in:
blitz-research
2014-12-08 12:43:20 +13:00
parent ff8bad7a2d
commit bb0f822db3
649 changed files with 33093 additions and 23947 deletions
+58 -35
View File
@@ -1,38 +1,61 @@
<html><head><title>Command: ACos </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ACos (number)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the smallest angle (in degrees) satisfying the arc cosine (inverse cosine) of the supplied argument.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>number=float or integer representing a ratio of the "X" coordinate to the tangential displacement.<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command is used for translating X/Y coordinate values to angles. Remember that the computer screen uses an inverted y-axis (values get larger the further down the screen).</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Graphics 640,480<br>
Repeat<br>
Cls<br>
; Determine the positions and the length of the hypotenuse<br>
x# = MouseX() ; displacement across the screen.<br>
y# = MouseY() ; displacement down the screen.<br>
r# = Sqr((x#*x#)+(y#*y#)) ; length of the hypotenuse.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ACos# ( c# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
c = a number in the range -1 to +1.
<br />
<br />
It is considered to be the cosine of an angle.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
ACos( c ) is an angle which has cosine = c.
<br />
It is in the range 0 to +180 degrees.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ACos.bb>Example</a></h1>
<table>
<tr>
<td>
; ACos example
<br />
<br />
; NaN means "Not a Number", the numerical result is invalid.
<br />
<br />
Const width = 640, height = 480
<br />
<br />
Graphics width, height
<br />
<br />
<br />
Local C#, AC# ; Cos and ACos
<br />
<br />
Print " C ACos( C )"
<br />
Print "=================="
; Draw the axes<br>
Color 104,104,104<br>
Line x#,0,x#,y# ; draw a line from the top to the cursor.<br>
Line 0,y#,x#,y# ; draw a line from the left to the cursor.<br>
Locate x#+10,y#-10 : Write "X=" : Print x#<br>
Locate x#-10,y#+10 : Write "Y=" :Print y#<br>
<br />
; reset any drawing to the top right<br>
Origin 0,0<br>
<br>
; Draw the angled line<br>
Color 255,255,255<br>
Line 0,0,x#,y# ; draw a line from the top right corner of the screen to the cursor.<br>
theta# = ACos(x#/r#) ; the angle between the x axis and the y axis.<br>
Locate 60,10 : Write "Angle:" : Print theta<br>
<br>
; Draws an arc showing the angle.<br>
For degrees#=0 To theta#; Step though all the degrees in the angle<br>
; The next line calculates the X and Y coordinates of the point of the circle using the Sin and Cos<br>
; commands, and multiplies it by 50 (to get a larger radius, try and change it).<br>
cy=Sin(degrees#)*50<br>
cx=Cos(degrees#)*50<br>
Plot cx,cy ; Draw the current point on the circle.<br>
Next ; Give us another angle<br>
<br>
Flip<br>
; Use the ESCAPE key to quit<br>
Until KeyDown(1)<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
For n = -11 To 11
+58 -35
View File
@@ -1,38 +1,61 @@
<html><head><title>Command: ASin </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ASin (number)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the smallest angle (in degrees) satisfying the arc sine (inverse sine) of the supplied argument.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>number=float or integer representing a ratio of the "Y" coordinate to the tangential displacement.<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command is used for translating X/Y coordinate values to angles. Remember that the computer screen uses an inverted y-axis (values get larger the further down the screen).</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Graphics 640,480<br>
Repeat<br>
Cls<br>
; Determine the positions and the length of the hypotenuse<br>
x# = MouseX() ; displacement across the screen.<br>
y# = MouseY() ; displacement down the screen.<br>
r# = Sqr((x#*x#)+(y#*y#)) ; length of the hypotenuse.<br>
; Draw the axes<br>
Color 104,104,104<br>
Line x#,0,x#,y# ; draw a line from the top to the cursor.<br>
Line 0,y#,x#,y# ; draw a line from the left to the cursor.<br>
Locate x#+10,y#-10 : Write "X=" : Print x#<br>
Locate x#-10,y#+10 : Write "Y=" :Print y#<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ASin# ( s# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
s = a number in the range -1 to +1
<br />
<br />
It is considered to be the sine of an angle.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
ASin( s ) is an angle which has sine = s.
<br />
It is in the range -90 to +90 degrees.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ASin.bb>Example</a></h1>
<table>
<tr>
<td>
; ASin example
<br />
<br />
; NaN means "Not a Number", the numerical result is invalid.
<br />
<br />
Const width = 640, height = 480
<br />
<br />
Graphics width, height
<br />
<br />
<br />
Local S#, AS# ; Sin and ASin
<br />
<br />
Print " S ASin( S )"
<br />
; reset any drawing to the top right<br>
Origin 0,0<br>
Print "=================="
<br />
; Draw the angled line<br>
Color 255,255,255<br>
Line 0,0,x#,y# ; draw a line from the top right corner of the screen to the cursor.<br>
theta# = ASin(y#/r#) ; the angle between the x axis and the y axis.<br>
Locate 60,10 : Write "Angle:" : Print theta<br>
<br>
; Draws an arc showing the angle.<br>
For degrees#=0 To theta#; Step though all the degrees in the angle<br>
; The next line calculates the X and Y coordinates of the point of the circle using the Sin and Cos<br>
; commands, and multiplies it by 50 (to get a larger radius, try and change it).<br>
cy=Sin(degrees#)*50<br>
cx=Cos(degrees#)*50<br>
Plot cx,cy ; Draw the current point on the circle.<br>
Next ; Give us another angle<br>
<br>
Flip<br>
; Use the ESCAPE key to quit<br>
Until KeyDown(1)<br>
End<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+74 -24
View File
@@ -1,27 +1,77 @@
<html><head><title>Command: ATan </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ATan (float)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the angle from the X axis to a point (y,x).</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>float = floating point value (degrees)</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Aside from its basic trig usage, this nifty command will allow you to derive an angle based on the x and y speed of a travelling object. Also see <a href='ATan2.htm'>ATan2</a>.<br>
</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Set graphics w/double buffering<br>
Graphics 640,480,16,0<br>
SetBuffer BackBuffer()<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ATan# ( t# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
t = any number.
<br />
<br />
It is considered to be the tangent of an angle.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
ATan( t ) is an angle which has tangent = t.
<br />
It is in the range -90 to +90 degrees.
<br />
<br />
See also ATan2 for an extended version with 360 degree range.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ATan.bb>Example</a></h1>
<table>
<tr>
<td>
; ATan example
<br />
<br />
Const width = 640, height = 480
<br />
<br />
Graphics width, height
<br />
<br />
<br />
Local T#, AT# ; Tan and ATan
<br />
<br />
zero# = 0
<br />
<br />
Print " T ATan( T )"
<br />
Print "======================="
<br />
<br />
; First, an extreme case...
<br />
<br />
T# = 1 / zero ; +Infinity
<br />
AT = ATan( T )
; Starting point for our travelling box<br>
x=0<br>
y=0<br>
<br />
Print RSet(T, 10) + RSet( AT, 11)
; random speed values for travelling<br>
xSpeed#=Rand(5)<br>
ySpeed#=Rand(5)<br>
<br>
; repeat until the ESC or box travels off the screen<br>
While Not KeyHit(1) Or y > 480 Or x > 640<br>
Cls<br>
; Draw our box<br>
Rect x,y,10,10,1<br>
; increment the box location based on random speed<br>
x=x+xSpeed<br>
y=y+yspeed<br>
; print the angle of our box travel<br>
Text 0,0,ATan(yspeed/xspeed)<br>
Flip<br>
Wend<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+81 -26
View File
@@ -1,29 +1,84 @@
<html><head><title>Command: ATan2 </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ATan2 (xvalue,yvalue)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the angle from the X axis to a point (y,x).</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>(yvalue,xvalue)</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Aside from its basic trig usage, this nifty command will allow you to derive an angle based on the x and y speed of a travelling object.<br>
</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Atan2 example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ATan2# ( y#, x# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
y, x are any numbers.
<br />
<br />
They are interpreted as corresponding to a point ( x, y ).
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
ATan2 gives the angle between the positive x-axis and a vector from the point (0,0) to the point (x,y).
<br />
<br />
One common use is in 2d graphics. Suppose you have two objects and you want to aim the first at the second.
<br />
<br />
ATan2( y2 - y1, x2 - x1 ) gives the proper orientation for object1.
<br />
You can use this angle to select an appropriately rotated image.
<br />
<br />
Notice the reverse order, ATan2( y, x ) rather than ATan2( x, y).
<br />
ATan2( y, x ) is analogous to ATan( y / x), but covers 360 degrees.
<br />
<br />
The angle satisfies: -180 < ATan2 <= +180
</td>
</tr>
</table>
<h1><a href=../2d_examples/ATan2.bb>Example</a></h1>
<table>
<tr>
<td>
; ATan2 example.
<br />
<br />
; Move mouse. Escape quits.
<br />
<br />
Const width = 640, height = 480
<br />
Const radius# = .2 * height
<br />
Const KEY_ESC = 1
<br />
<br />
Graphics width, height
<br />
SetBuffer BackBuffer( )
<br />
Origin width / 2, height / 2
<br />
HidePointer
<br />
; Set graphics w/double buffering<br>
Graphics 640,480,16,0<br>
SetBuffer BackBuffer()<br>
MoveMouse .75 * width, height / 2
<br />
; Starting point for our travelling box<br>
x=0<br>
y=0<br>
<br>
; random speed values for travelling<br>
xSpeed=Rand(5)<br>
ySpeed=Rand(5)<br>
<br>
; repeat until the ESC or box travels off the screen<br>
While Not KeyHit(1) Or y > 480 Or x > 640<br>
Cls<br>
; Draw our box<br>
Rect x,y,10,10,1<br>
; increment the box location based on random speed<br>
x=x+xSpeed<br>
y=y+yspeed<br>
; print the angle of our box travel<br>
Text 0,0,ATan2(yspeed,xspeed)<br>
Flip<br>
Wend<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+38 -4
View File
@@ -1,7 +1,41 @@
<html><head><title>Command: Abs </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Abs (number)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the absolute (positive) value of a number.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>number = any valid number or numeric variable</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to return the absolute value of a number; meaning its positive value. A negative 3 would become a positive 3. If what you want is a number without a fraction (say, convert 3.1415 into 3) use the Int() command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>number=-3<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Abs (number)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
number = any valid number or numeric variable
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to return the absolute value of a number; meaning its positive value. A negative 3 would become a positive 3. If what you want is a number without a fraction (say, convert 3.1415 into 3) use the Int() command.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Abs.bb>Example</a></h1>
<table>
<tr>
<td>
number=-3
<br />
<br />
Print "The absolute value of " + number + " is: " + Abs(number)
<br />
<br />
WaitKey()
<br />
Print "The absolute value of " + number + " is: " + Abs(number)<br>
</td>
WaitKey()<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</tr>
</table>
@@ -1,57 +1,91 @@
<html><head><title>Command: AcceptTCPStream </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;AcceptTCPStream (serverhandle)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Accepts an incoming TCP/IP stream.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>serverhandle = the server handle assigned when the server was created</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Accepts an incoming TCP/IP stream, and returns a TCP/IP stream if one is available, or 0 if not.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>AcceptTCPStream (serverhandle)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
serverhandle = the server handle assigned when the server was created
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Accepts an incoming TCP/IP stream, and returns a TCP/IP stream if one is available, or 0 if not.
<br />
<br />
See CreateTCPServer and CloseTCPServer.
</td>
</tr>
</table>
<h1><a href=../2d_examples/AcceptTCPStream.bb>Example</a></h1>
<table>
<tr>
<td>
; CreateTCPServer, CloseTCPServer, AcceptTCPStream Example
<br />
; This code is in two parts, and needs to be run seperately on the same machine
<br />
<br />
; --- Start first code set ---
<br />
; Create a server and listen for push
<br />
<br />
svrGame=CreateTCPServer(8080)
<br />
<br />
If svrGame<>0 Then
<br />
Print "Server started successfully."
<br />
Else
<br />
Print "Server failed to start."
<br />
End
<br />
End If
<br />
<br />
While Not KeyHit(1)
<br />
strStream=AcceptTCPStream(svrGame)
<br />
If strStream Then
<br />
Print ReadString$(strStream)
<br />
Delay 2000
<br />
End
<br />
Else
<br />
Print "No word from Apollo X yet ..."
<br />
Delay 1000
<br />
End If
<br />
Wend
<br />
<br />
End
See <a href='CreateTCPServer.htm'>CreateTCPServer</a> and <a href='CloseTCPServer.htm'>CloseTCPServer</a>.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CreateTCPServer, CloseTCPServer, AcceptTCPStream Example<br>
; This code is in two parts, and needs to be run seperately on the same machine<br>
<br />
; --- Start first code set ---<br>
; Create a server and listen for push<br>
<br>
svrGame=CreateTCPServer(8080)<br>
<br>
If svrGame<>0 Then <br>
Print "Server started successfully."<br>
Else<br>
Print "Server failed to start."<br>
End<br>
End If<br>
<br>
While Not KeyHit(1)<br>
strStream=AcceptTCPStream(svrGame)<br>
If strStream Then <br>
Print ReadString$(strStream)<br>
Delay 2000<br>
End<br>
Else <br>
Print "No word from Apollo X yet ..."<br>
Delay 1000<br>
End If <br>
Wend<br>
<br>
End<br>
<br>
; --- End first code set ---<br>
<br>
<br>
; --- Start second code set ---<br>
; Copy this code to another instance of Blitz Basic<br>
; Run the above code first, then run this ... they will 'talk'<br>
<br>
; Create a Client and push data<br>
<br>
strmGame=OpenTCPStream("127.0.0.1",8080)<br>
<br>
If strmGame<>0 Then <br>
Print "Client Connected successfully."<br>
Else<br>
Print "Server failed to connect."<br>
WaitKey <br>
End<br>
End If<br>
<br>
; write stream to server<br>
WriteString strmGame,"Mission Control, this is Apollo X ..."<br>
Print "Completed sending message to Mission control..."<br>
<br>
; --- End second code set ---<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
; --- End first code set ---
+88 -42
View File
@@ -1,43 +1,89 @@
<html><head><title>Command: After </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;After custom_type_variable&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Move the object pointer to the next object in the Type collection.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>custom_type_variable = not the Type name, but the custom Type name</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you haven't read up on the <a href='TYPE.htm'>TYPE</a>
command, you might want to do so before continuing.</p>
<p>Use this to assign a custom Type object to the next object in the collection.
See the example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Define a crafts Type</p>
<p>Type crafts<br>
Field x<br>
Field y<br>
Field dead<br>
Field graphic<br>
End Type</p>
<p>; Create 100 crafts, with the unique name of alien<br>
For t = 1 To 100 <br>
alien.crafts = New crafts<br>
alien\x = Rnd(0,640)<br>
alien\y = Rnd(0,480)<br>
alien\dead = 0<br>
alien\graphic = 1<br>
Next</p>
<p>; Move to the first object<br>
alien.crafts = First crafts</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the next alien object<br>
alien = After alien</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the last alien object<br>
alien.crafts = Last crafts</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the second to the last alien object<br>
alien = Before alien</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>After custom_type_variable</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
custom_type_variable = not the Type name, but the custom Type name
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you haven't read up on the TYPE command, you might want to do so before continuing.
<br />
<br />
Use this to assign a custom Type object to the next object in the collection. See the example.
<br>
<br>
See also: <a class=small href=Type.htm>Type</a>, <a class=small href=New.htm>New</a>, <a class=small href=Before.htm>Before</a>, <a class=small href=First.htm>First</a>, <a class=small href=Last.htm>Last</a>, <a class=small href=Each.htm>Each</a>, <a class=small href=Insert.htm>Insert</a>, <a class=small href=Delete.htm>Delete</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/After.bb>Example</a></h1>
<table>
<tr>
<td>
; Define a crafts Type
<br />
<br />
Type crafts
<br />
Field x
<br />
Field y
<br />
Field dead
<br />
Field graphic
<br />
End Type
<br />
<br />
; Create 100 crafts, with the unique name of alien
<br />
For t = 1 To 100
<br />
alien.crafts = New crafts
<br />
alien\x = Rnd(0,640)
<br />
alien\y = Rnd(0,480)
<br />
alien\dead = 0
<br />
alien\graphic = 1
<br />
Next
<br />
<br />
; Move to the first object
<br />
alien.crafts = First crafts
<br />
<br />
Print alien\x
<br />
Print alien\y
<br />
Print alien\dead
<br />
Print alien\graphic
<br />
<br />
; move to the next alien object
<br />
+45 -9
View File
@@ -1,12 +1,48 @@
<html><head><title>Command: And </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;And &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Logical operator comparative command for testing expressions.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>AND is a logical operator for doing conditional checks of multiple values and/or expressions. Use this to ensure that two or more conditions are true, usually in an <a href='IF.htm'>IF</a> ... <a href='THEN.htm'>THEN</a> conditional. See example and see <a href='OR.htm'>OR</a>, <a href='NOT.htm'>NOT</a>, and <a href='XOR.htm'>XOR</a>.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; AND example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>And</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
AND is a logical operator for doing conditional checks of multiple values and/or expressions. Use this to ensure that two or more conditions are true, usually in an IF ... THEN conditional. See example and see OR, NOT, and XOR.
<br>
name$=Input$("Enter your name:")<br>
pw$=Input$("Password:")<br>
<br>
if name$="Shane" and pw$="bluedog" then<br>
print "Access granted! Welcome!"<br>
else<br>
print "Your name or password was not recogized"<br>
end if<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
See also: <a class=small href=Or.htm>Or</a>, <a class=small href=Not.htm>Not</a>, <a class=small href=Xor.htm>Xor</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/And.bb>Example</a></h1>
<table>
<tr>
<td>
; AND example
<br />
<br />
name$=Input$("Enter your name:")
<br />
pw$=Input$("Password:")
<br />
<br />
if name$="Shane" and pw$="bluedog" then
<br />
print "Access granted! Welcome!"
<br />
else
<br />
print "Your name or password was not recognized"
<br />
@@ -1,5 +1,39 @@
<html><head><title>Command: AppTitle </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;AppTitle string&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Sets the title bar of the program.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>string = any legal string variable</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Allows you to set the text of the program's Title Bar.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Set the title bar<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>AppTitle title$[,close_prompt$]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
title$ - the text that will be displayed in the title bar of the program window
<br />
close_prompt$ (optional) - the text that will be displayed in a message box with 'OK/Cancel' options when a user clicks on the close button. If nothing is specified, the message box will not be displayed and the program will close immediately.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Allows you to set the text of the program's title bar, and 'close program?' message box.
</td>
</tr>
</table>
<h1><a href=../2d_examples/AppTitle.bb>Example</a></h1>
<table>
<tr>
<td>
; Set the title bar
<br />
<br />
AppTitle "Super Invaders V1.0", "Are you sure?"
</td>
AppTitle "Super Invaders V1.0"<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
+37 -3
View File
@@ -1,4 +1,38 @@
<html><head><title>Command: Asc </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Asc (string$)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the ASCII value of the first letter of a string.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>string$ = any valid string variable (only the first character's ASCII value will be returned).</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This will return the ASCII value of the first letter of a string.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>a$=Input$("Enter a letter:")<br>
Print "The ASCII value of the letter is:" + Asc(a$)<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Asc (string$)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
string$ = any valid string variable (only the first character's ASCII value will be returned).
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This will return the ASCII value of the first letter of a string.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Asc.bb>Example</a></h1>
<table>
<tr>
<td>
a$=Input$("Enter a letter:")
<br />
Print "The ASCII value of the letter is:" + Asc(a$)
<br />
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
@@ -1,2 +1,37 @@
<html><head><title>Command: AvailVidMem() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;AvailVidMem() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the available free video memory.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command will return the total bytes of available free video memory. Use this to keep track of your resources!</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Print "Your available video memory is: " + AvailVidMem()<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>AvailVidMem()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command will return the total bytes of available free video memory. Use this to keep track of your resources!
</td>
</tr>
</table>
<h1><a href=../2d_examples/AvailVidMem.bb>Example</a></h1>
<table>
<tr>
<td>
Print "Your available video memory is: " + AvailVidMem()
<br />
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=AvailVidMem&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
@@ -1,21 +1,55 @@
<html><head><title>Command: BackBuffer() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;BackBuffer() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Indicates the BackBuffer drawing buffer.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This is a value usually used with <a href='SETBUFFER.htm'>SETBUFFER</a> to denote the secondary non-visible drawing buffer called the Back Buffer. In MOST gaming situations, you will want to be using the BackBuffer() for drawing operations then using <a href='Flip.htm'>Flip</a> to bring that buffer to the <a href='FrontBuffer().htm'>FrontBuffer()</a> where it can be seen. There are other uses for the command, but this is the biggie. See <a href='SETBUFFER.htm'>SETBUFFER</a> for more info, and check out the example. Once again - if you set drawing operations to the BackBuffer() you will NOT see any of them until you call FLIP.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Flip/Backbuffer()/Rect Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>BackBuffer()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This is a value usually used with SETBUFFER to denote the secondary non-visible drawing buffer called the Back Buffer. In MOST gaming situations, you will want to be using the BackBuffer() for drawing operations then using Flip to bring that buffer to the FrontBuffer() where it can be seen. There are other uses for the command, but this is the biggie. See SETBUFFER for more info, and check out the example. Once again - if you set drawing operations to the BackBuffer() you will NOT see any of them until you call FLIP.
</td>
</tr>
</table>
<h1><a href=../2d_examples/BackBuffer.bb>Example</a></h1>
<table>
<tr>
<td>
; Flip/Backbuffer()/Rect Example
<br />
<br />
; Set Graphics Mode
<br />
Graphics 640,480
<br />
<br />
; Go double buffering
<br />
SetBuffer BackBuffer()
<br />
<br />
; Setup initial locations for the box
<br />
box_x = -20 ; negative so it will start OFF screen
<br />
box_y = 100
<br />
<br />
; Set Graphics Mode<br>
Graphics 640,480<br>
While Not KeyHit(1)
<br />
; Go double buffering<br>
SetBuffer BackBuffer()<br>
<br>
; Setup initial locations for the box<br>
box_x = -20 ; negative so it will start OFF screen<br>
box_y = 100<br>
<br>
While Not KeyHit(1)<br>
Cls ; Always clear screen first<br>
Rect box_x,box_y,20,20,1 ; Draw the box in the current x,y location<br>
Flip ; Flip it into view<br>
box_x = box_x + 1 ; Move the box over one pixel<br>
If box_x = 640 Then box_x=-20 ; If it leaves the Right edge, reset its x location<br>
Wend<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Cls ; Always clear screen first
<br />
+51 -15
View File
@@ -1,20 +1,56 @@
<html><head><title>Command: BankSize </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;BankSize (bankhandle)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the size of a bank.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>bankhandle=handle assigned to the bank when created.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to determing the size of an existing bank. See <a href='CreateBank.htm'>CreateBank</a>, <a href='ResizeBank.htm'>ResizeBank</a>, and <a href='CopyBank.htm'>CopyBank</a>.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; BankSize, ResizeBank, CopyBank Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>BankSize (bankhandle)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
bankhandle - handle assigned to the bank when created.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to determine the size of an existing bank.
<br>
; create a bank<br>
bnkTest=CreateBank(5000)<br>
<br>
; Fill it with rand Integers<br>
For t = 0 To 4999<br>
PokeByte bnkTest,t,Rand(9)<br>
Next<br>
See also: <a class=small href=CreateBank.htm>CreateBank</a>, <a class=small href=ResizeBank.htm>ResizeBank</a>, <a class=small href=CopyBank.htm>CopyBank</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/BankSize.bb>Example</a></h1>
<table>
<tr>
<td>
; BankSize, ResizeBank, CopyBank Example
<br />
<br />
; create a bank
<br />
bnkTest=CreateBank(5000)
<br />
<br />
; Fill it with rand Integers
<br />
For t = 0 To 4999
<br />
PokeByte bnkTest,t,Rand(9)
<br />
Next
<br />
<br />
; Resize the bank
<br />
; Resize the bank<br>
ResizeBank bnkTest,10000<br>
ResizeBank bnkTest,10000
<br />
; Copy the first half of the bank to the second half<br>
CopyBank bnkTest,0,bnkTest,5000,5000 <br>
<br>
; Print final banksize<br>
Print BankSize(bnkTest)<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+88 -42
View File
@@ -1,43 +1,89 @@
<html><head><title>Command: Before </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Before custom_type_variable&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Move the object pointer to the previous object in the Type collection.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>custom_type_variable = not the Type name, but the custom Type name</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you haven't read up on the <a href='TYPE.htm'>TYPE</a>
command, you might want to do so before continuing.</p>
<p>Use this to assign a custom Type object to the previous object in the collection.
See the example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Define a crafts Type</p>
<p>Type crafts<br>
Field x<br>
Field y<br>
Field dead<br>
Field graphic<br>
End Type</p>
<p>; Create 100 crafts, with the unique name of alien<br>
For t = 1 To 100 <br>
alien.crafts = New crafts<br>
alien\x = Rnd(0,640)<br>
alien\y = Rnd(0,480)<br>
alien\dead = 0<br>
alien\graphic = 1<br>
Next</p>
<p>; Move to the first object<br>
alien.crafts = First crafts</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the next alien object<br>
alien = After alien</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the last alien object<br>
alien.crafts = Last crafts</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the second to the last alien object<br>
alien = Before alien</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Before custom_type_variable</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
custom_type_variable = not the Type name, but the custom Type name
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you haven't read up on the TYPE command, you might want to do so before continuing.
<br />
<br />
Use this to assign a custom Type object to the previous object in the collection. See the example.
<br>
<br>
See also: <a class=small href=Type.htm>Type</a>, <a class=small href=New.htm>New</a>, <a class=small href=After.htm>After</a>, <a class=small href=First.htm>First</a>, <a class=small href=Last.htm>Last</a>, <a class=small href=Each.htm>Each</a>, <a class=small href=Insert.htm>Insert</a>, <a class=small href=Delete.htm>Delete</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Before.bb>Example</a></h1>
<table>
<tr>
<td>
; Define a crafts Type
<br />
<br />
Type crafts
<br />
Field x
<br />
Field y
<br />
Field dead
<br />
Field graphic
<br />
End Type
<br />
<br />
; Create 100 crafts, with the unique name of alien
<br />
For t = 1 To 100
<br />
alien.crafts = New crafts
<br />
alien\x = Rnd(0,640)
<br />
alien\y = Rnd(0,480)
<br />
alien\dead = 0
<br />
alien\graphic = 1
<br />
Next
<br />
<br />
; Move to the first object
<br />
alien.crafts = First crafts
<br />
<br />
Print alien\x
<br />
Print alien\y
<br />
Print alien\dead
<br />
Print alien\graphic
<br />
<br />
; move to the next alien object
<br />
+37 -2
View File
@@ -1,3 +1,38 @@
<html><head><title>Command: Bin$ </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Bin$ (integer)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Converts an integer value to a binary value.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>integer = any valid integer or integer variable</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Converts integer values into binary values. If you don't know what binary is, you don't need to know this command :)</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>intValue="64738"<br>
Print "The binary value of "+intValue+" is: " + bin$(intValue)<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Bin$ (integer)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
integer = any valid integer or integer variable
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Converts integer values into binary values. If you don't know what binary is, you don't need to know this command :)
</td>
</tr>
</table>
<h1><a href=../2d_examples/Bin.bb>Example</a></h1>
<table>
<tr>
<td>
intValue="64738"
<br />
Print "The binary value of "+intValue+" is: " + bin$(intValue)
<br />
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
+62 -22
View File
@@ -1,27 +1,67 @@
<html><head><title>Command: Case </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Case value&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Begins the set of commands in a SELECT structure if the value of SELECT is met.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>value = any valid value of the SELECT variable</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>When using a <a href='SELECT.htm'>SELECT</a> structure, the CASE command defines the starting point of command execution if the SELECT value matches the CASE value. If the SELECT value doesn't match the CASE value, the commands following it are ignored until the next CASE, <a href='DEFAULT.htm'>DEFAULT</a>, or <a href='END SELECT.htm'>END SELECT</a> command is encountered. See <a href='SELECT.htm'>SELECT</a> and the example for a better understanding.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; SELECT/CASE/DEFAULT/END SELECT Example<br>
; Assign a random number 1-10<br>
mission=Rnd(1,10)<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Case value [,value [,value ... ] ]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
value = any valid value of the SELECT variable
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
When using a SELECT structure, the CASE command defines the starting point of command execution if the SELECT value matches the CASE value. If the SELECT value doesn't match the CASE value, the commands following it are ignored until the next CASE, DEFAULT, or END SELECT command is encountered. See SELECT and the example for a better understanding.
<br />
<br />
If multiple values should result in the same outcome, a single CASE statement can be used with each value separated by commas.
; Start the selection process based on the value of 'mission' variable<br>
Select mission<br>
; Is mission = 1?<br>
Case 1<br>
Print "Your mission is to get the plutonium and get out alive!"<br>
<br />
<br />
If you wish to use ranges for a case statement, or if you wish to test more than one variable, you will need to use a programming trick illustrated in the example below. This involves using SELECT TRUE initially, and then in each Case statement specify a logical expression such as A > 1 AND A < 4.
<br>
<br>
See also: <a class=small href=Select.htm>Select</a>, <a class=small href=Default.htm>Default</a>, <a class=small href=End Select.htm>End Select</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Case.bb>Example</a></h1>
<table>
<tr>
<td>
; Advanced SELECT/CASE/DEFAULT/END SELECT Example
<br />
; Assign a random number 1-10
<br />
mission=Rnd(1,10)
<br />
<br />
; Start the selection process based on the value of 'mission' variable
<br />
Select True
<br />
<br />
; Is mission = 1?
<br />
Case mission=1
<br />
Print "Your mission is to get the plutonium and get out alive!"
<br />
<br />
; Is mission = 2?
; Is mission = 2?<br>
Case 2<br>
Print "Your mission is to destroy all enemies!"<br>
<br />
Case mission=2
; Is mission = 3?<br>
Case 3 <br>
Print "Your mission is to steal the enemy building plans!"<br>
<br>
; What do do if none of the cases match the value of mission<br>
Default <br>
Print "Missions 4-10 are not available yet!"<br>
<br>
; End the selection process<br>
End Select<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Print "Your mission is to destroy all enemies!"
+84 -9
View File
@@ -1,12 +1,87 @@
<html><head><title>Command: Ceil# </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Ceil# (float)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Rounds a decimal floating variable up to the nearest whole number.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>float=floating point number</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Many times, you will need to round up or down a floating point decimal variable. This command rounds it up to the nearest whole number. Use <a href='Floor#.htm'>Floor#</a> to round the number down.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Floor#/Ceil# Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Ceil# ( y# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
y = any number
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
As with Floor there is often some confusion with negative numbers:
<br />
<br />
Ceil( 1.75 ) ...... 2.0
<br />
Ceil( -1.75 ) ... -1.0
<br />
<br />
See also Floor and Int for other types of rounding.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Ceil.bb>Example</a></h1>
<table>
<tr>
<td>
; Ceil / Floor / Int example, three kinds of rounding.
<br />
<br />
; Move mouse. Escape quits.
<br />
<br />
Graphics 640, 480
<br />
<br />
Const KEY_ESC = 1
<br />
<br />
SetBuffer BackBuffer()
<br />
Origin 320, 240
<br />
<br />
MoveMouse 320, 240 : HidePointer
<br />
<br />
While Not KeyDown( KEY_ESC )
<br />
<br />
Cls
<br />
<br />
my = MouseY() - 240
<br />
Color 100, 100, 0
<br />
Line -320, my, 319, my
<br />
<br />
DrawNumberLine
; Set a floating point variable<br>
myVal#=0.5<br>
<br />
; Round it up<br>
Print Floor#(myval)<br>
<br>
;Round it down<br>
Print Ceil#(myval)<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
y# = Float( -my ) / 32
@@ -1,6 +1,40 @@
<html><head><title>Command: ChangeDir </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ChangeDir directory/path&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Changes the currently selected directory for file operations.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>directory/path = full path to directory/folder</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command will change the currently selected directory for disk operations, useful for advanced file operations. Use <a href='CURRENTDIR$().htm'>CURRENTDIR$()</a> to see what the current directory is.<br>
Use a directory/path of ".." to change to the parent of the current directory, unless you are at the root directory of the drive, then no change happens.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; ChangeDir example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ChangeDir directory/path</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
directory/path = full path to directory/folder
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command will change the currently selected directory for disk operations, useful for advanced file operations. Use CURRENTDIR$() to see what the current directory is.
<br />
Use a directory/path of ".." to change to the parent of the current directory, unless you are at the root directory of the drive, then no change happens.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ChangeDir.bb>Example</a></h1>
<table>
<tr>
<td>
; ChangeDir example
<br />
<br />
ChangeDir "c:winntsystem32"
<br />
ChangeDir "c:\winnt\system32"<br>
Print "The folder has been changed to: " + currentdir$()<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Print "The folder has been changed to: " + currentdir$()
</td>
</tr>
</table>
@@ -1,43 +1,78 @@
<html><head><title>Command: ChannelPan </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ChannelPan channel_handle, pan#&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Pans sound channel between the left and right channels.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>channel_handle = variable assigned to the channel when played<br>
pan# = panning floating value to denote channel playback<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>When you want to do real sound panning effects, this is the command you'll use. This will allow you to pan the sound channels on a 'per channel' basis between the left and right speakers. This command makes it very easy to produce some really killer stereophonic effects!<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ChannelPan channel_handle, pan#</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
channel_handle = variable assigned to the channel when played
<br />
pan# = panning floating value to denote channel playback
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
When you want to do real sound panning effects, this is the command you'll use. This will allow you to pan the sound channels on a 'per channel' basis between the left and right speakers. This command makes it very easy to produce some really killer stereophonic effects!
<br />
<br />
The pan value is between -1 and 1 with 0 being perfect center. -1 is full left, and 1 is full right. To make it somewhere in between, try -.5 for 50% left or .75 for 75% right.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ChannelPan.bb>Example</a></h1>
<table>
<tr>
<td>
; Channel examples
<br />
<br />
Print "Loading sound ..."
<br />
; Load the sample - you'll need to point this to a sound on your computer
<br />
; For best results, make it about 5-10 seconds...
<br />
sndWave=LoadSound("level1.wav")
<br />
; Prepare the sound for looping
<br />
LoopSound sndWave
<br />
<br />
chnWave=PlaySound(sndWave)
<br />
<br />
Print "Playing sound for 2 seconds ..."
<br />
Delay 2000
<br />
<br />
Print "Pausing sound for 2 seconds ..."
<br />
PauseChannel chnWave
<br />
Delay 2000
<br />
<br />
Print "Restarting sound ..."
<br />
ResumeChannel chnWave
<br />
The pan value is between -1 and 1 with 0 being perfect center. -1 is full left, and 1 is full right. To make it somewhere in between, try -.5 for 50% left or .75 for 75% right.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Channel examples<br>
Delay 2000
<br />
Print "Loading sound ..."<br>
; Load the sample - you'll need to point this to a sound on your computer<br>
; For best results, make it about 5-10 seconds...<br>
sndWave=LoadSound("level1.wav")<br>
; Prepare the sound for looping<br>
LoopSound sndWave<br>
<br>
chnWave=PlaySound(sndWave)<br>
<br>
Print "Playing sound for 2 seconds ..."<br>
Delay 2000<br>
<br>
Print "Pausing sound for 2 seconds ..."<br>
PauseChannel chnWave<br>
Delay 2000<br>
<br>
Print "Restarting sound ..."<br>
ResumeChannel chnWave<br>
Delay 2000<br>
<br>
Print "Changing Pitch of sound ..."<br>
ChannelPitch chnWave, 22000<br>
Delay 2000<br>
<br>
Print "Playing new pitched sound ..."<br>
Delay 2000<br>
<br>
Print "Left speaker only"<br>
ChannelPan chnWave,-1<br>
Delay 2000<br>
<br>
Print "Right speaker only"<br>
ChannelPan chnWave,1<br>
Delay 2000<br>
<br>
Print "All done!"<br>
StopChannel chnWave<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,43 +1,76 @@
<html><head><title>Command: ChannelPitch </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ChannelPitch channel_handle, hertz&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Alters the hertz pitch of a playing sound channel.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>channel_handle = variable assigned to the channel when played<br>
hertz = pitch to apply to the channel (try 8000-44000)<br>
</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>You can alter the hertz pitch of a sound channel that is playing (or in use and just paused). I'm sure you can think of numerous uses for this command! Use the frequency of your sound as the 'baseline' for pitch change. So if your sample is at 11025 hertz, increase the pitch to 22050 to make the pitch higher, 8000 to make it lower, etc. While similar to <a href='SoundPitch.htm'>SoundPitch</a>, this command let's you change the pitch individually of each and every channel in use.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Channel examples<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ChannelPitch channel_handle, hertz</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
channel_handle = variable assigned to the channel when played
<br />
hertz = pitch to apply to the channel (try 8000-44000)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
You can alter the pitch of a sound channel that is playing (or in use and just paused). I'm sure you can think of numerous uses for this command! Use the frequency of your sound as the 'baseline' for pitch change. So if your sample is at 11025 hertz, increase the pitch to 22050 to make the pitch twice as high, 8000 to make it lower, etc. While similar to SoundPitch, this command let's you change the pitch individually of each and every channel in use.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ChannelPitch.bb>Example</a></h1>
<table>
<tr>
<td>
; Channel examples
<br />
<br />
Print "Loading sound ..."
<br />
; Load the sample - you'll need to point this to a sound on your computer
<br />
; For best results, make it about 5-10 seconds...
<br />
sndWave=LoadSound("level1.wav")
<br />
; Prepare the sound for looping
<br />
LoopSound sndWave
<br />
<br />
chnWave=PlaySound(sndWave)
<br />
<br />
Print "Playing sound for 2 seconds ..."
<br />
Delay 2000
<br />
<br />
Print "Pausing sound for 2 seconds ..."
<br />
PauseChannel chnWave
<br />
Delay 2000
<br />
<br />
Print "Restarting sound ..."
<br />
ResumeChannel chnWave
<br />
Delay 2000
<br />
Print "Loading sound ..."<br>
; Load the sample - you'll need to point this to a sound on your computer<br>
; For best results, make it about 5-10 seconds...<br>
sndWave=LoadSound("level1.wav")<br>
; Prepare the sound for looping<br>
LoopSound sndWave<br>
<br />
Print "Changing Pitch of sound ..."
chnWave=PlaySound(sndWave)<br>
<br>
Print "Playing sound for 2 seconds ..."<br>
Delay 2000<br>
<br>
Print "Pausing sound for 2 seconds ..."<br>
PauseChannel chnWave<br>
Delay 2000<br>
<br>
Print "Restarting sound ..."<br>
ResumeChannel chnWave<br>
Delay 2000<br>
<br>
Print "Changing Pitch of sound ..."<br>
;StopChannel chnWave<br>
ChannelPitch chnWave, 22000<br>
Delay 2000<br>
<br>
Print "Playing new pitched sound ..."<br>
Delay 2000<br>
<br>
Print "Left speaker only"<br>
ChannelPan chnWave,-1<br>
Delay 2000<br>
<br>
Print "Right speaker only"<br>
ChannelPan chnWave,1<br>
Delay 2000<br>
<br>
Print "All done!"<br>
StopChannel chnWave<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
;StopChannel chnWave
@@ -1,16 +1,50 @@
<html><head><title>Command: ChannelPlaying </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ChannelPlaying (channel_handle)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Checks to see if a sound channel is still playing.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>channel_handle = variable assigned to the channel when played<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Often you will need to know if a sound channel has completed playing or not. This command will return 1 if the sound is still playing or 0 if it has stopped. Use this to restart your background music or some other sound that might have stopped unintentionally.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ChannelPlaying (channel_handle)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
channel_handle = variable assigned to the channel when played
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Often you will need to know if a sound channel has completed playing or not. This command will return 1 if the sound is still playing or 0 if it has stopped. Use this to restart your background music or some other sound that might have stopped unintentionally.
<br />
<br />
Note: This command currently doesn't seem to work with a channel assigned to CD track playback.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ChannelPlaying.bb>Example</a></h1>
<table>
<tr>
<td>
; Channel examples
<br />
<br />
Print "Loading sound ..."
<br />
; Load the sample - you'll need to point this to a sound on your computer
<br />
; For best results, make it about 5-10 seconds...
<br />
sndWave=LoadSound("level1.wav")
<br />
<br />
Note: This command currently doesn't seem to work with a channel assigned to CD track playback.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Channel examples<br>
Print "Playing full sample until sound is done ..."
<br />
Print "Loading sound ..."<br>
; Load the sample - you'll need to point this to a sound on your computer<br>
; For best results, make it about 5-10 seconds...<br>
sndWave=LoadSound("level1.wav")<br>
<br>
Print "Playing full sample until sound is done ..."<br>
chnWave=PlaySound(sndWave) <br>
While ChannelPlaying(chnWave)<br>
Wend
<br>
Print "All done!"<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
chnWave=PlaySound(sndWave)
<br />
@@ -1,43 +1,78 @@
<html><head><title>Command: ChannelVolume </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ChannelVolume channel_handle, volume#&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Adjusts the volume level of a sound channel.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>channel_handle = variable assigned to the channel when played<br>
volume# = volume level floating value between 0 and 1<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>While <a href='SoundVolume.htm'>SoundVolume</a> happily changes the volume of the entire program, this command will let you adjust volume rates on a 'per channel' basis. Extremely useful.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ChannelVolume channel_handle, volume#</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
channel_handle = variable assigned to the channel when played
<br />
volume# = volume level floating value between 0 and 1
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
While SoundVolume happily changes the volume of the entire program, this command will let you adjust volume rates on a 'per channel' basis. Extremely useful.
<br />
<br />
The volume value is a floating point value between 0 and 1 (0 = silence, .5 = half volume, 1= full volume). You can do other cool stuff like ChannelPitch and ChannelPan too!
</td>
</tr>
</table>
<h1><a href=../2d_examples/ChannelVolume.bb>Example</a></h1>
<table>
<tr>
<td>
; Channel examples
<br />
<br />
Print "Loading sound ..."
<br />
; Load the sample - you'll need to point this to a sound on your computer
<br />
; For best results, make it about 5-10 seconds...
<br />
sndWave=LoadSound("level1.wav")
<br />
; Prepare the sound for looping
<br />
LoopSound sndWave
<br />
<br />
chnWave=PlaySound(sndWave)
<br />
<br />
Print "Playing sound for 2 seconds ..."
<br />
Delay 2000
<br />
<br />
Print "Pausing sound for 2 seconds ..."
<br />
PauseChannel chnWave
<br />
Delay 2000
<br />
<br />
Print "Restarting sound ..."
<br />
ResumeChannel chnWave
<br />
The volume value is a floating point value between 0 and 1 (0 = silence, .5 = half volume, 1= full volume). You can do other cool stuff like <a href='ChannelPitch.htm'>ChannelPitch</a> and <a href='ChannelPan.htm'>ChannelPan</a> too!</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Channel examples<br>
Delay 2000
<br />
Print "Loading sound ..."<br>
; Load the sample - you'll need to point this to a sound on your computer<br>
; For best results, make it about 5-10 seconds...<br>
sndWave=LoadSound("level1.wav")<br>
; Prepare the sound for looping<br>
LoopSound sndWave<br>
<br>
chnWave=PlaySound(sndWave)<br>
<br>
Print "Playing sound for 2 seconds ..."<br>
Delay 2000<br>
<br>
Print "Pausing sound for 2 seconds ..."<br>
PauseChannel chnWave<br>
Delay 2000<br>
<br>
Print "Restarting sound ..."<br>
ResumeChannel chnWave<br>
Delay 2000<br>
<br>
Print "Changing volume of sound ..."<br>
ChannelVolume chnWave, .5<br>
Delay 2000<br>
<br>
Print "Playing new half-volume sound ..."<br>
Delay 2000<br>
<br>
Print "Left speaker only"<br>
ChannelPan chnWave,-1<br>
Delay 2000<br>
<br>
Print "Right speaker only"<br>
ChannelPan chnWave,1<br>
Delay 2000<br>
<br>
Print "All done!"<br>
StopChannel chnWave<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+36 -1
View File
@@ -1,2 +1,37 @@
<html><head><title>Command: Chr$ </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Chr$ (integer)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Converts an ASCII code to its corresponding character string.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>integer = valid ASCII code integer value</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to convert a known ASCII code (for example 65) to its character string equivelant (i.e. the letter "A").</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Print " The character for ASCII value 65 is: " + Chr$(65)<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Chr$ (integer)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
integer = valid ASCII code integer value
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to convert a known ASCII code (for example 65) to its character string equivelant (i.e. the letter "A").
</td>
</tr>
</table>
<h1><a href=../2d_examples/Chr.bb>Example</a></h1>
<table>
<tr>
<td>
Print " The character for ASCII value 65 is: " + Chr$(65)
<br />
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Chr&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
+63 -29
View File
@@ -1,32 +1,66 @@
<html><head><title>Command: CloseDir </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CloseDir filehandle&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Closes a directory previously opened with the ReadDir command.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>filehandle = valid filehandle assigned from the ReadDir command</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Once you are finished with <a href='NextFile$.htm'>NextFile$</a> on the directory previously opened for read with the <a href='ReadDir.htm'>ReadDir</a> command, use this command to close the directory. This is good programming practice!
</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; ReadDir/NextFile$/CloseDir example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CloseDir filehandle</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
filehandle = valid filehandle assigned from the ReadDir command
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Once you are finished with NextFile$ on the directory previously opened for read with the ReadDir command, use this command to close the directory. This is good programming practice!
<br />
<br />
See also: ReadDir, NextFile$
</td>
</tr>
</table>
<h1><a href=../2d_examples/CloseDir.bb>Example</a></h1>
<table>
<tr>
<td>
; ReadDir/NextFile$/CloseDir example
<br />
<br />
; Define what folder to start with ...
<br />
folder$="C:"
<br />
<br />
; Open up the directory, and assign the handle to myDir
<br />
myDir=ReadDir(folder$)
<br />
<br />
; Let's loop forever until we run out of files/folders to list!
<br />
Repeat
<br />
; Assign the next entry in the folder to file$
<br />
file$=NextFile$(myDir)
<br />
<br />
; If there isn't another one, let's exit this loop
<br />
If file$="" Then Exit
<br />
; Define what folder to start with ...<br>
folder$="C:\"<br>
<br />
; Open up the directory, and assign the handle to myDir<br>
myDir=ReadDir(folder$)<br>
<br>
; Let's loop forever until we run out of files/folders to list!<br>
Repeat<br>
; Assign the next entry in the folder to file$<br>
file$=NextFile$(myDir)<br>
<br>
; If there isn't another one, let's exit this loop<br>
If file$="" Then Exit<br>
<br>
; Use FileType to determine if it is a folder (value 2) or a file and print results<br>
If FileType(folder$+"\"+file$) = 2 Then<br>
Print "Folder:" + file$<br>
Else<br>
Print "File:" + file$<br>
End If<br>
Forever<br>
<br>
; Properly close the open folder<br>
CloseDir myDir<br>
<br>
; We're done!<br>
Print "Done listing files!"<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Use FileType to determine if it is a folder (value 2) or a file and print results
<br />
@@ -1,51 +1,82 @@
<html><head><title>Command: CloseFile </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CloseFile filehandle&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Closes a file previously opened with a file operations command.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>filehandle = variable defined with the WriteFile or OpenFile command</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to close a file previously opened. You should always close a file as soon as you have finished reading or writing to it.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CloseFile filehandle</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
filehandle = variable defined with the WriteFile or OpenFile command
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to close a file previously opened. You should always close a file as soon as you have finished reading or writing to it.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CloseFile.bb>Example</a></h1>
<table>
<tr>
<td>
; Reading and writing custom types to files using ReadFile, WriteFile and CloseFile
<br />
<br />
; Initialise some variables for the example
<br />
Type HighScore
<br />
Field Name$
<br />
Field Score%
<br />
Field Level%
<br />
End Type
<br />
<br />
Best.HighScore = New HighScore
<br />
BestName = "Mark"
<br />
BestScore = 11657
<br />
BestLevel = 34
<br />
<br />
; Open a file to write to
<br />
fileout = WriteFile("mydata.dat")
<br />
<br />
; Write the information to the file
<br />
WriteString( fileout, BestName )
<br />
WriteInt( fileout, BestScore )
<br />
WriteByte( fileout, BestLevel )
<br />
<br />
; Close the file
<br />
CloseFile( fileout )
<br />
<br />
; Open the file to Read
See also:<br>
<a href='ReadByte.htm'>ReadByte</a>, <a href='ReadShort.htm'>ReadShort</a>, <a href='ReadInt.htm'>ReadInt</a>, <a href='ReadFloat.htm'>ReadFloat</a>, <a href='ReadString$.htm'>ReadString$</a>, <a href='ReadLine$.htm'>ReadLine$</a>, <a href='WriteByte.htm'>WriteByte</a>, <a href='WriteShort.htm'>WriteShort</a>, <a href='WriteInt.htm'>WriteInt</a>, <a href='WriteFloat.htm'>WriteFloat</a>, <a href='WriteShort.htm'>WriteShort</a>, <a href='WriteString.htm'>WriteString</a>, <a href='WriteLine.htm'>WriteLine</a>, <a href='ReadFile.htm'>ReadFile</a>, <a href='WriteFile.htm'>WriteFile</a>, <a href='OpenFile.htm'>OpenFile</a>, <a href='CloseFile.htm'>CloseFile</a>, <a href='Eof.htm'>Eof</a>, <a href='FileType.htm'>FileType</a>, <a href='FilePos.htm'>FilePos</a>, <a href='SeekFile.htm'>SeekFile</a></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Reading and writing custom types to files using ReadFile, WriteFile and CloseFile<br>
<br />
filein = ReadFile("mydata.dat")
; Initialise some variables for the example<br>
Type HighScore<br>
Field Name$<br>
Field Score%<br>
Field Level%<br>
End Type<br>
<br>
Best.HighScore = New HighScore<br>
Best\Name = "Mark"<br>
Best\Score = 11657<br>
Best\Level = 34<br>
<br>
; Open a file to write to<br>
fileout = WriteFile("mydata.dat")<br>
<br>
; Write the information to the file<br>
WriteString( fileout, Best\Name )<br>
WriteInt( fileout, Best\Score )<br>
WriteByte( fileout, Best\Level )<br>
<br>
; Close the file<br>
CloseFile( fileout )<br>
<br>
; Open the file to Read<br>
filein = ReadFile("mydata.dat")<br>
<br>
; Lets read the Greatest score from the file<br>
Greatest.HighScore = New HighScore<br>
Greatest\Name$ = ReadString$( filein )<br>
Greatest\Score = ReadInt( filein )<br>
Greatest\Level = ReadByte( filein )<br>
<br>
; Close the file once reading is finished<br>
CloseFile( fileout )<br>
<br>
Print "High score record read from - mydata.dat "<br>
Print<br>
Write "Name = "<br>
Print Greatest\Name<br>
Write "Score = "<br>
Print Greatest\Score<br>
Write "Level = "<br>
Print Greatest\Level<br>
<br>
WaitKey()<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,55 +1,89 @@
<html><head><title>Command: CloseTCPServer </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CloseTCPServer serverhandle&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Closes a TCP server.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>serverhandle = handle assigned when the server was created.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Closes a TCP/IP server previously created with the <a href='CreateTCPServer.htm'>CreateTCPServer</a> command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CreateTCPServer, CloseTCPServer, AcceptTCPStream Example<br>
; This code is in two parts, and needs to be run seperately on the same machine<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CloseTCPServer serverhandle</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
serverhandle = handle assigned when the server was created.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Closes a TCP/IP server previously created with the CreateTCPServer command.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CloseTCPServer.bb>Example</a></h1>
<table>
<tr>
<td>
; CreateTCPServer, CloseTCPServer, AcceptTCPStream Example
<br />
; This code is in two parts, and needs to be run seperately on the same machine
<br />
<br />
; --- Start first code set ---
<br />
; Create a server and listen for push
<br />
<br />
svrGame=CreateTCPServer(8080)
<br />
<br />
If svrGame<>0 Then
<br />
Print "Server started successfully."
<br />
Else
<br />
Print "Server failed to start."
<br />
End
<br />
End If
<br />
<br />
While Not KeyHit(1)
<br />
strStream=AcceptTCPStream(svrGame)
<br />
If strStream Then
<br />
Print ReadString$(strStream)
<br />
Delay 2000
<br />
End
<br />
Else
<br />
Print "No word from Apollo X yet ..."
<br />
Delay 1000
<br />
End If
<br />
Wend
<br />
<br />
End
<br />
<br />
; --- Start first code set ---<br>
; Create a server and listen for push<br>
; --- End first code set ---
<br />
svrGame=CreateTCPServer(8080)<br>
<br>
If svrGame<>0 Then <br>
Print "Server started successfully."<br>
Else<br>
Print "Server failed to start."<br>
End<br>
End If<br>
<br>
While Not KeyHit(1)<br>
strStream=AcceptTCPStream(svrGame)<br>
If strStream Then <br>
Print ReadString$(strStream)<br>
Delay 2000<br>
End<br>
Else <br>
Print "No word from Apollo X yet ..."<br>
Delay 1000<br>
End If <br>
Wend<br>
<br>
End<br>
<br>
; --- End first code set ---<br>
<br>
<br>
; --- Start second code set ---<br>
; Copy this code to another instance of Blitz Basic<br>
; Run the above code first, then run this ... they will 'talk'<br>
<br>
; Create a Client and push data<br>
<br>
strmGame=OpenTCPStream("127.0.0.1",8080)<br>
<br>
If strmGame<>0 Then <br>
Print "Client Connected successfully."<br>
Else<br>
Print "Server failed to connect."<br>
WaitKey <br>
End<br>
End If<br>
<br>
; write stream to server<br>
WriteString strmGame,"Mission Control, this is Apollo X ..."<br>
Print "Completed sending message to Mission control..."<br>
<br>
; --- End second code set ---<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,27 +1,62 @@
<html><head><title>Command: CloseTCPStream </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CloseTCPStream streamhandle&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Closes the specified TCP stream.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>streamhandle = handle assigned when the stream was opened.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Once you've completed the use of your TCP/IP stream, close the connection you opened with <a href='OpenTCPStream.htm'>OpenTCPStream</a> with this command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; OpenTCPStream/CloseTCPStream Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CloseTCPStream streamhandle</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
streamhandle = handle assigned when the stream was opened.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Once you've completed the use of your TCP/IP stream, close the connection you opened with OpenTCPStream with this command.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CloseTCPStream.bb>Example</a></h1>
<table>
<tr>
<td>
; OpenTCPStream/CloseTCPStream Example
<br />
<br />
Print "Connecting..."
<br />
tcp=OpenTCPStream( "www.blitzbasement.com",80 )
<br />
<br />
If Not tcp Print "Failed.":WaitKey:End
<br />
<br />
Print "Connected! Sending request..."
<br />
<br />
WriteLine tcp,"GET http://www.blitzbasement.com HTTP/1.0"
<br />
WriteLine tcp,Chr$(10)
<br />
<br />
If Eof(tcp) Print "Failed.":WaitKey:End
<br />
<br />
Print "Request sent! Waiting for reply..."
<br />
Print "Connecting..."<br>
tcp=OpenTCPStream( "www.blitzbasement.com",80 )<br>
<br />
While Not Eof(tcp)
If Not tcp Print "Failed.":WaitKey:End<br>
<br>
Print "Connected! Sending request..."<br>
<br>
WriteLine tcp,"GET http://www.blitzbasement.com HTTP/1.0"<br>
WriteLine tcp,Chr$(10)<br>
<br>
If Eof(tcp) Print "Failed.":WaitKey:End<br>
<br>
Print "Request sent! Waiting for reply..."<br>
<br>
While Not Eof(tcp)<br>
Print ReadLine$( tcp )<br>
Wend<br>
<br>
If Eof(tcp)=1 Then Print "Success!" Else Print "Error!"<br>
<br>
CloseTCPStream tcp<br>
<br>
WaitKey<br>
End<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Print ReadLine$( tcp )
+39 -1
View File
@@ -1,2 +1,40 @@
<html><head><title>Command: Cls </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Cls &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Clears the current current drawing buffer.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command will wipe the current drawing buffer clean of any graphics or text present and reset the drawing buffer back to the color defined in the <a href='ClsColor.htm'>ClsColor</a> command</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>;set ClsColor to red<br>ClsColor 255,0,0<br><br>;set current drawing buffer to the color set by the ClsColor command<br>Cls</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Cls</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command will wipe the current drawing buffer clean of any graphics or text present and reset the drawing buffer back to the color defined in the ClsColor command
</td>
</tr>
</table>
<h1><a href=../2d_examples/Cls.bb>Example</a></h1>
<table>
<tr>
<td>
;set ClsColor to red
<br />
ClsColor 255,0,0
<br />
<br />
;set current drawing buffer to the color set by the ClsColor command
<br />
Cls
</td>
</tr>
</table>
<br>
@@ -1,2 +1,40 @@
<html><head><title>Command: ClsColor </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ClsColor red,green,blue&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Selects the color for the Cls command.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>red, green and blue = number between 0 and 255</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This changes the color for subsequent <a href='CLS.htm'>CLS</a> calls. Use this command when you need CLS to 'clear' the screen with some other color than black.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>;set ClsColor to red<br>ClsColor 255,0,0 <br><br> ;set current drawing buffer to the color set by the ClsColor command<br>Cls</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ClsColor red,green,blue</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
red, green and blue = number between 0 and 255
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This changes the color for subsequent CLS calls. Use this command when you need CLS to 'clear' the screen with some other color than black.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ClsColor.bb>Example</a></h1>
<table>
<tr>
<td>
;set ClsColor to red
<br />
ClsColor 255,0,0
<br />
<br />
;set current drawing buffer to the color set by the ClsColor command
<br />
Cls
</td>
</tr>
</table>
<br>
+50 -16
View File
@@ -1,19 +1,53 @@
<html><head><title>Command: Color </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Color red,green,blue&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Sets the drawing color for all drawing operations with a red, green, blue color value.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>red = value of red component (0-255)<br>
green = value of green component (0-255)<br>
blue = value of blue component (0-255)<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command sets the drawing color (using RGB values) for all subsequent drawing commands (<a href='Line.htm'>Line</a>, <a href='Rect.htm'>Rect</a>, <a href='Text.htm'>Text</a>, etc.) You must be in <a href='Graphics.htm'>Graphics</a> mode to execute this command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Color, ColorRed(), ColorBlue(), ColorGreen() Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Color red,green,blue</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
red = value of red component (0-255)
<br />
green = value of green component (0-255)
<br />
blue = value of blue component (0-255)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command sets the drawing color (using RGB values) for all subsequent drawing commands (Line, Rect, Text, etc.) You must be in Graphics mode to execute this command.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Color.bb>Example</a></h1>
<table>
<tr>
<td>
; Color, ColorRed(), ColorBlue(), ColorGreen() Example
<br />
<br />
; Gotta be in graphics mode
<br />
Graphics 640,480
<br />
<br />
; Change the random seed
<br />
SeedRnd MilliSecs()
<br />
<br />
; Let's set the color to something random
<br />
; Gotta be in graphics mode<br>
Graphics 640,480<br>
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
<br />
; Change the random seed<br>
SeedRnd MilliSecs()<br>
<br>
; Let's set the color to something random<br>
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)<br>
<br>
; Now let's see what they are!<br>
While Not KeyHit(1)<br>
Text 0,0,"This Text is printed in Red=" + ColorRed() + " Green=" + ColorGreen() + " Blue=" + ColorBlue() + "!"<br>
Wend<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,17 +1,51 @@
<html><head><title>Command: ColorBlue() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ColorBlue() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the blue component of the current drawing color.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to return the blue component of the RGB color of the current drawing color. Use <a href='ColorRed().htm'>ColorRed()</a> and <a href='ColorGreen().htm'>ColorGreen()</a> for the other two color components.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Color, ColorRed(), ColorBlue(), ColorGreen() Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ColorBlue()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to return the blue component of the RGB color of the current drawing color. Use ColorRed() and ColorGreen() for the other two color components.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ColorBlue.bb>Example</a></h1>
<table>
<tr>
<td>
; Color, ColorRed(), ColorBlue(), ColorGreen() Example
<br />
<br />
; Gotta be in graphics mode
<br />
Graphics 640,480
<br />
<br />
; Change the random seed
<br />
SeedRnd MilliSecs()
<br />
<br />
; Let's set the color to something random
<br />
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
<br />
; Gotta be in graphics mode<br>
Graphics 640,480<br>
<br />
; Change the random seed<br>
SeedRnd MilliSecs()<br>
<br>
; Let's set the color to something random<br>
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)<br>
<br>
; Now let's see what they are!<br>
While Not KeyHit(1)<br>
Text 0,0,"This Text is printed in Red=" + ColorRed() + " Green=" + ColorGreen() + " Blue=" + ColorBlue() + "!"<br>
Wend<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Now let's see what they are!
<br />
@@ -1,17 +1,51 @@
<html><head><title>Command: ColorGreen() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ColorGreen() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the green component of the current drawing color.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to return the green component of the RGB color of the current drawing color. Use <a href='ColorRed().htm'>ColorRed()</a> and <a href='ColorBlue().htm'>ColorBlue()</a> for the other two color components.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Color, ColorRed(), ColorBlue(), ColorGreen() Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ColorGreen()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to return the green component of the RGB color of the current drawing color. Use ColorRed() and ColorBlue() for the other two color components.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ColorGreen.bb>Example</a></h1>
<table>
<tr>
<td>
; Color, ColorRed(), ColorBlue(), ColorGreen() Example
<br />
<br />
; Gotta be in graphics mode
<br />
Graphics 640,480
<br />
<br />
; Change the random seed
<br />
SeedRnd MilliSecs()
<br />
<br />
; Let's set the color to something random
<br />
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
<br />
; Gotta be in graphics mode<br>
Graphics 640,480<br>
<br />
; Change the random seed<br>
SeedRnd MilliSecs()<br>
<br>
; Let's set the color to something random<br>
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)<br>
<br>
; Now let's see what they are!<br>
While Not KeyHit(1)<br>
Text 0,0,"This Text is printed in Red=" + ColorRed() + " Green=" + ColorGreen() + " Blue=" + ColorBlue() + "!"<br>
Wend<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Now let's see what they are!
<br />
+48 -14
View File
@@ -1,17 +1,51 @@
<html><head><title>Command: ColorRed() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ColorRed() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the red component of the current drawing color.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to return the red component of the RGB color of the current drawing color. Use <a href='ColorBlue().htm'>ColorBlue()</a> and <a href='ColorGreen().htm'>ColorGreen()</a> for the other two color components.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Color, ColorRed(), ColorBlue(), ColorGreen() Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ColorRed()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to return the red component of the RGB color of the current drawing color. Use ColorBlue() and ColorGreen() for the other two color components.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ColorRed.bb>Example</a></h1>
<table>
<tr>
<td>
; Color, ColorRed(), ColorBlue(), ColorGreen() Example
<br />
<br />
; Gotta be in graphics mode
<br />
Graphics 640,480
<br />
<br />
; Change the random seed
<br />
SeedRnd MilliSecs()
<br />
<br />
; Let's set the color to something random
<br />
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
<br />
; Gotta be in graphics mode<br>
Graphics 640,480<br>
<br />
; Change the random seed<br>
SeedRnd MilliSecs()<br>
<br>
; Let's set the color to something random<br>
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)<br>
<br>
; Now let's see what they are!<br>
While Not KeyHit(1)<br>
Text 0,0,"This Text is printed in Red=" + ColorRed() + " Green=" + ColorGreen() + " Blue=" + ColorBlue() + "!"<br>
Wend<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Now let's see what they are!
<br />
@@ -1,20 +1,54 @@
<html><head><title>Command: CommandLine$() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CommandLine$() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Reads command line parameters passed at runtime.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you are writing an application or game that allows starting with special parameters on the command line, you can use this command to retrieve the parameters.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CommandLine$()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you are writing an application or game that allows starting with special parameters on the command line, you can use this command to retrieve the parameters.
<br />
<br />
For example, you might want to start the program with a debug variable set so you can track stuff during execution. So, you could offer the ability to run the executatble with a /debug parameter. If they execute the program with the parameter, then you can set a flag inside your game.
<br />
<br />
To simulate the command line passing in the editor, select PROGRAM->PROGRAM COMMAND LINE from the pulldowns and enter a value to be passed at runtime.
<br />
<br />
See the example.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CommandLine.bb>Example</a></h1>
<table>
<tr>
<td>
; CommandLine$() Example
<br />
; Be sure to use PROGRAM->PROGRAM COMMAND LINE from the
<br />
; pull down and put /debug in there to test with.
<br />
<br />
For example, you might want to start the program with a debug variable set so you can track stuff during execution. So, you could offer the ability to run the executatble with a /debug parameter. If they execute the program with the parameter, then you can set a flag inside your game.<br>
a$=CommandLine$()
<br />
To simulate the command line passing in the editor, select PROGRAM->PROGRAM COMMAND LINE from the pulldowns and enter a value to be passed at runtime. <br>
<br>
See the example.<br></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CommandLine$() Example<br>
; Be sure to use PROGRAM->PROGRAM COMMAND LINE from the<br>
; pull down and put /debug in there to test with.<br>
<br>
a$=CommandLine$()<br>
<br>
If a$="/debug" Then <br>
Print "Debug mode is on!"<br>
debug=1<br>
Else<br>
Print "No debugging activated."<br>
debug=0<br>
End If<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+44 -8
View File
@@ -1,13 +1,49 @@
<html><head><title>Command: Const </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Const variablename&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Declare a variable as a constant and assign it a value.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>variablename = any valid variable name and its assignment</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This delares a variable as a constant (a variable whose value will never change and cannot be changed) and assigns the value to it.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Const variablename</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
variablename - any valid variable name and its assignment
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This declares a variable as a constant (a variable whose value will never change and cannot be changed) and assigns the value to it.
<br />
Assign constants to values you know will not change in your game (screen width, height - scoring values - etc). This reduces the load of the variable memory, since Blitz knows it will never change size unlike other variables which can grow and shrink in size based on what value it holds.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CONST Example<br>
<br />
Const scrWidth=640<br>
Const scrHeight=480<br>
Const alienscore=100<br>
Assign constants to values you know will not change in your game (screen width, height - scoring values - etc). This reduces the load of the variable memory, since Blitz knows it will never change size unlike other variables which can grow and shrink in size based on what value it holds.
<br>
<br>
See also: <a class=small href=Global.htm>Global</a>, <a class=small href=Local.htm>Local</a>, <a class=small href=Dim.htm>Dim</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Const.bb>Example</a></h1>
<table>
<tr>
<td>
; CONST Example
<br />
<br />
Const scrWidth=640
<br />
Const scrHeight=480
<br />
Const alienscore=100
<br />
Graphics scrWidth,scrHeight<br>
<br />
Print "The point value for shooting any alien is always " + alienscore<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Graphics scrWidth,scrHeight
<br />
+54 -21
View File
@@ -1,24 +1,57 @@
<html><head><title>Command: CopyBank </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CopyBank src_bank,src_offset,dest_bank,dest_offset,count&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Copies data from one bank to another.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>src_bank = handle of source memory bank<br>
src_offset = offset location to start copying from<br>
dest_bank = handle of destination memory bank<br>
dest_offset = offset location to start writing to<br>
count = how many bytes to copy<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Copies data from one meomry bank to another. If copying between the same banks, handles overlapping memory ranges.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; BankSize, ResizeBank, CopyBank Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CopyBank src_bank,src_offset,dest_bank,dest_offset,count</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
src_bank = handle of source memory bank
<br />
src_offset = offset location to start copying from
<br />
dest_bank = handle of destination memory bank
<br />
dest_offset = offset location to start writing to
<br />
count = how many bytes to copy
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Copies data from one memory bank to another.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CopyBank.bb>Example</a></h1>
<table>
<tr>
<td>
; BankSize, ResizeBank, CopyBank Example
<br />
<br />
; create a bank
<br />
bnkTest=CreateBank(5000)
<br />
<br />
; Fill it with rand Integers
<br />
For t = 0 To 4999
<br />
PokeByte bnkTest,t,Rand(9)
<br />
Next
<br />
; create a bank<br>
bnkTest=CreateBank(5000)<br>
<br />
; Fill it with rand Integers<br>
For t = 0 To 4999<br>
PokeByte bnkTest,t,Rand(9)<br>
Next<br>
<br>
; Resize the bank<br>
ResizeBank bnkTest,10000<br>
<br>
; Copy the first half of the bank to the second half<br>
CopyBank bnkTest,0,bnkTest,5000,5000 <br>
<br>
; Print final banksize<br>
Print BankSize(bnkTest)<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Resize the bank
<br />
@@ -1,11 +1,44 @@
<html><head><title>Command: CopyFile </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CopyFile from$, to$&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Copies a file on the disk to a new location.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>from$ = valid path/filename to the file to be copied<br>
to$ = valid path/filename to copy the file to<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to copy a file from one location to another. Perhaps you'll write your own installer and need to copy files from the installation folder to the installed location folder. Make sure you do your own validation to ensure that the files/paths are valid and accurate before executing this command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>file$="c:\autoexec.bat"<br>
destination$="a:\autoexec.bat"<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CopyFile from$, to$</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
from$ = valid path/filename to the file to be copied
<br />
to$ = valid path/filename to copy the file to
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to copy a file from one location to another. Perhaps you'll write your own installer and need to copy files from the installation folder to the installed location folder. Make sure you do your own validation to ensure that the files/paths are valid and accurate before executing this command.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CopyFile.bb>Example</a></h1>
<table>
<tr>
<td>
file$="c:autoexec.bat"
<br />
destination$="a:autoexec.bat"
<br />
<br />
Print "Press any key to copy your Autoexec.bat file to floppy"
<br />
<br />
WaitKey()
Print "Press any key to copy your Autoexec.bat file to floppy"<br>
<br />
WaitKey()<br>
<br>
CopyFile file$,destination$<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
CopyFile file$,destination$
@@ -1,11 +1,45 @@
<html><head><title>Command: CopyImage </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CopyImage (handle)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Duplicates a previously loaded image to a new handle.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>handle=the variable you gave the handle to when you loaded the image</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Instead of loading a graphic twice in two different handles, you can load the image ONCE then use the CopyImage command to make as many copies in memory as you want.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CopyImage (handle)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
handle=the variable you gave the handle to when you loaded the image
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Instead of loading a graphic twice in two different handles, you can load the image ONCE then use the CopyImage command to make as many copies in memory as you want.
<br />
<br />
Why would you want to do this? So you still have a copy of the original image in case you want to alter a copy later for another purpose.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CopyImage.bb>Example</a></h1>
<table>
<tr>
<td>
; CopyImage Example
<br />
<br />
; Load an image and give its handle to gfxOld variable
<br />
gfxOld=LoadImage("mypicture.bmp")
<br />
Why would you want to do this? So you still have a copy of the original image in case you want to alter a copy later for another purpose.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CopyImage Example<br>
<br />
; Duplicate the gfxOld image to a new handle variable
; Load an image and give its handle to gfxOld variable<br>
gfxOld=LoadImage("mypicture.bmp")<br>
<br>
; Duplicate the gfxOld image to a new handle variable<br>
gfxNew=CopyImage(gfxOld)<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
gfxNew=CopyImage(gfxOld)
@@ -1,40 +1,80 @@
<html><head><title>Command: CopyPixel </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CopyPixel src_x,src_y,src_buffer,dest_x,dest_y,[dest_buffer]&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Copys pixels from one image buffer to another.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>src_x = x location of the source pixel to copy<br>
src_y = y location of the source pixel to copy<br>
src_buffer = buffer to copy from<br>
dest_x = x location to write pixel to<br>
dest_y = y location to write pixel to<br>
dest_buffer = optional</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this to directly copy pixels from one buffer to another. You do not need to <a href='LockBuffer.htm'>LockBuffer</a> to use this command, but it will make the operations faster.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CopyPixel src_x,src_y,src_buffer,dest_x,dest_y,[dest_buffer]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
src_x - x-coordinate of source pixel to copy from
<br />
src_y - y-coordinate of source pixel to copy from
<br />
src_buffer - name of buffer to copy from, e.g. ImageBuffer()
<br />
dest_x - x-coordinate of destination pixel to copy to
<br />
dest_y - y-coordinate of destination pixel to copy to
<br />
dest_buffer (optional) - name of buffer to copy to, e.g. BackBuffer()
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
You can use this command on a locked buffer for a slight speed-up. See LockBuffer.
<br />
<br />
See also: CopyPixelFast.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CopyPixel.bb>Example</a></h1>
<table>
<tr>
<td>
; CopyPixel/CopyPixelFast Example
<br />
; -------------------------------
<br />
<br />
Graphics 640,480,16
<br />
<br />
Print "Press a key to use CopyPixel to copy the top half of an image to the frontbuffer"
<br />
WaitKey()
<br />
<br />
; Load an image - can be anything
<br />
pic=LoadImage("media/blitz_pic.bmp")
<br />
<br />
; Use CopyPixel to copy the top half of the image to the frontbuffer
<br />
For y=0 To ImageHeight(pic)/2
<br />
For x=0 To ImageWidth(pic)
<br />
CopyPixel x,y,ImageBuffer(pic),x,y
<br />
Next
<br />
Next
<br />
Although fast, this command will not be fast enough to perform real-time screen effects.<br></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CopyPixel/CopyPixelFast commands<br>
<br />
Graphics 640,480,16<br>
<br>
; Draw a bunch of crap on the screen<br>
For t= 1 To 1000<br>
Color Rnd(255),Rnd(255),Rnd(255)<br>
Rect Rnd(640),Rnd(480),Rnd(150),Rnd(150),Rnd(1)<br>
Next<br>
<br>
Delay 3000<br>
<br>
; Copy the top half of the screen over the bottom half<br>
; using fast pixels and locked buffers<br>
For x = 1 To 640<br>
For y = 1 To 240<br>
LockBuffer FrontBuffer()<br>
CopyPixelFast x,y,FrontBuffer(),x,y+241<br>
UnlockBuffer FrontBuffer()<br>
Next<br>
Next<br>
<br>
Delay 3000<br>
<br>
; Draw the left half of the screen over the right half<br>
; using the slower direct pixel access<br>
For x = 1 To 320<br>
For y = 1 To 480<br>
CopyPixel x,y,FrontBuffer(),x+320,y<br>
Next<br>
Next<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Locate 0,GraphicsHeight()/2
<br />
@@ -1,40 +1,88 @@
<html><head><title>Command: CopyPixelFast </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CopyPixelFast src_x,src_y,src_buffer,dest_x,dest_y,[dest_buffer]&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Quickly copies pixels from one image buffer to another.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>src_x = x location of the source pixel to copy<br>
src_y = y location of the source pixel to copy<br>
src_buffer = buffer to copy from<br>
dest_x = x location to write pixel to<br>
dest_y = y location to write pixel to<br>
dest_buffer = optional</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this to directly copy pixels from one buffer to another. You MUST use <a href='LockBuffer.htm'>LockBuffer</a> on BOTH image buffers to use this command.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CopyPixelFast src_x,src_y,src_buffer,dest_x,dest_y,[dest_buffer]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
src_x - x-coordinate of source pixel to copy from
<br />
src_y - y-coordinate of source pixel to copy from
<br />
src_buffer - name of buffer to copy from, e.g. ImageBuffer()
<br />
dest_x - x-coordinate of destination pixel to copy to
<br />
dest_y - y-coordinate of destination pixel to copy to
<br />
dest_buffer (optional) - name of buffer to copy to, e.g. BackBuffer()
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
IMPORTANT:
<br />
<br />
You *must* use this command on a locked buffer, otherwise the command will fail. See LockBuffer.
<br />
<br />
Also, you must make sure that the coordinates that you are copying from and to are valid, otherwise you will end up overwriting other areas of memory.
<br />
<br />
WARNING:
<br />
<br />
By not following the above advice, you may cause your computer to crash.
<br />
<br />
See also: CopyPixel.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CopyPixelFast.bb>Example</a></h1>
<table>
<tr>
<td>
; CopyPixel/CopyPixelFast Example
<br />
; -------------------------------
<br />
<br />
Graphics 640,480,16
<br />
<br />
Print "Press a key to use CopyPixel to copy the top half of an image to the frontbuffer"
<br />
WaitKey()
<br />
<br />
; Load an image - can be anything
<br />
pic=LoadImage("media/blitz_pic.bmp")
<br />
<br />
Although very fast, this command will not be fast enough to perform real-time screen effects.<br></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CopyPixel/CopyPixelFast commands<br>
; Use CopyPixel to copy the top half of the image to the frontbuffer
<br />
Graphics 640,480,16<br>
<br>
; Draw a bunch of crap on the screen<br>
For t= 1 To 1000<br>
Color Rnd(255),Rnd(255),Rnd(255)<br>
Rect Rnd(640),Rnd(480),Rnd(150),Rnd(150),Rnd(1)<br>
Next<br>
<br>
Delay 3000<br>
<br>
; Copy the top half of the screen over the bottom half<br>
; using fast pixels and locked buffers<br>
For x = 1 To 640<br>
For y = 1 To 240<br>
LockBuffer FrontBuffer()<br>
CopyPixelFast x,y,FrontBuffer(),x,y+241<br>
UnlockBuffer FrontBuffer()<br>
Next<br>
Next<br>
<br>
Delay 3000<br>
<br>
; Draw the left half of the screen over the right half<br>
; using the slower direct pixel access<br>
For x = 1 To 320<br>
For y = 1 To 480<br>
CopyPixel x,y,FrontBuffer(),x+320,y<br>
Next<br>
Next<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
For y=0 To ImageHeight(pic)/2
<br />
+64 -30
View File
@@ -1,33 +1,67 @@
<html><head><title>Command: CopyRect </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CopyRect src_x,src_y,src_width,src_height,dest_x,dest_y,[src_buffer],[dest_buffer]&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Copies a rectangle of graphics from one buffer to another.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>src_x = source top left x location to begin copying from<br>
src_y = source top left y location to begin copying from<br>
src_width = width of source area to copy<br>
src_height = height of source area to copy<br>
dest_x = destination top left x location to copy to<br>
dest_y = destination top left y location to copy to<br>
src_buffer = handle to the source image buffer (optional)<br>
dest_buffer = handle to the destination image buffer (optional)<br>
</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Copies a rectangle of graphics from one buffer to another. If a buffer is omitted, the current buffer is used.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CopyRect Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CopyRect src_x,src_y,src_width,src_height,dest_x,dest_y,[src_buffer],[dest_buffer]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
src_x = source top left x location to begin copying from
<br />
src_y = source top left y location to begin copying from
<br />
src_width = width of source area to copy
<br />
src_height = height of source area to copy
<br />
dest_x = destination top left x location to copy to
<br />
dest_y = destination top left y location to copy to
<br />
src_buffer = handle to the source image buffer (optional)
<br />
dest_buffer = handle to the destination image buffer (optional)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Copies a rectangle of graphics from one buffer to another. If a buffer is omitted, the current buffer is used.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CopyRect.bb>Example</a></h1>
<table>
<tr>
<td>
; CopyRect Example
<br />
<br />
; Turn on graphics mode
<br />
Graphics 800,600,16
<br />
<br />
; create a blank image
<br />
gfxBlank=CreateImage (300,300)
<br />
<br />
; Fill the screen with random boxes in random colors
<br />
For t = 1 To 1000
<br />
Rect Rand(800),Rand(600),Rand(100),Rand(100),Rand(0,1)
<br />
; Turn on graphics mode<br>
Graphics 800,600,16<br>
Color Rand(255),Rand(255),Rand(255)
<br />
; create a blank image<br>
gfxBlank=CreateImage (300,300)<br>
<br>
; Fill the screen with random boxes in random colors<br>
For t = 1 To 1000<br>
Rect Rand(800),Rand(600),Rand(100),Rand(100),Rand(0,1) <br>
Color Rand(255),Rand(255),Rand(255)<br>
Next<br>
<br>
; Wait a couple of seconds so the user can see it<br>
Delay 2000<br>
<br>
; Copy graphics randomly from the front buffer to the blank image<br>
CopyRect Rand(800),Rand(600),300,300,0,0,FrontBuffer(),ImageBuffer(gfxBlank)<br>
<br>
; Clear the screen, draw the copied to image, wait for user to hit a key<br>
Cls<br>
DrawImage gfxBlank,0,0<br>
WaitKey <br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Next
<br />
@@ -1,42 +1,30 @@
<html>
<head>
<title>Command: CopyStream</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../css/commands.css">
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<p><span class="Command">&nbsp;&nbsp;CopyStream&nbsp;&nbsp;</span></p>
<p>
<span class="header">Parameters:</span><br>
</p>
<table width="100%" border="0" cellspacing="2" cellpadding="2" align="center">
<h1>CopyStream src_stream,dest_stream[,buffer_size]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
src_stream -- <BR>
dest_stream -- <BR>
[buffer_size] -- <BR>
src_stream - source stream
<br />
dest_stream - destination stream
<br />
buffer_size (optional) - buffer size of stream
</td>
<p class="header">Description:<br>
<br>
<table width="100%" border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td>CopyStream () ...</td>
</tr>
</table>
<p class="header"><a href="../3d_examples/CopyStream.bb">Example:</a><br>
<br>
<table width="100%" border="0" cellspacing="2" cellpadding="2" align="center">
</tr>
</table>
<h1>Description</h1>
<table>
; Example
<tr>
<td>
Copies a stream.
</td>
</body>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
+102 -23
View File
@@ -1,26 +1,105 @@
<html><head><title>Command: Cos </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Cos (Number)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>The Cos command is a trigonometry function, that returns a number between -1 and 1. This value represents the "X" coordinate of point x,y.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>number=float or integer representing a value in degree</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command is used for translating angle values to coordinates, but there are a few things you have to take into account when doing it. First of all the Cos() command assumes the point you want is at radius 1 (pixel), next it uses a circle where 0 degrees is due EAST and increases in a counterclockwise direction, then you've got to take into account the the Y axis on a computer screen is up-side-down compared to a normal mathematical coordinate system.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Cos# ( degrees# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
degrees# = angle in degrees.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
For angles between 0 and 90 degrees this is defined by the sides of a right triangle. The cosine is the side adjacent to the angle divided by the hypotenuse.
<br />
<br />
Outside of 0 to 90 the definition uses a circle with radius=1. The angle is placed at the center of the circle, with one side on the positive x-axis. The other side hits the circle at some point. The x coordinate of this point is the cosine of the angle.
<br />
<br />
The positive y-axis corresonds to +90 degrees. This is a common source of confusion in Blitz. With screen coordinates ( pixels ) the y-axis points downward. But in the 3d world the y-axis typically points upward.
<br />
<br />
Another possible snag is the size of the angle. In principle, the cosine function repeats every 360 degrees. So Cos(-360), Cos(0), Cos(360), Cos(720) etc. should all be exactly the same. But in practice the accuracy decreases as the angle gets farther away from zero.
<br />
<br />
<br />
See also ASin, Cos, ACos, Tan, Atan, ATan2
</td>
</tr>
</table>
<h1><a href=../2d_examples/Cos.bb>Example</a></h1>
<table>
<tr>
<td>
; Sin / Cos / Tan example.
<br />
<br />
; Left/Right arrow keys change angle. Escape quits.
<br />
<br />
Const width = 640, height = 480
<br />
Const radius# = .2 * height
<br />
Const KEY_ESC = 1, KEY_LEFT = 203, KEY_RIGHT = 205
<br />
<br />
Graphics width, height
<br />
SetBuffer BackBuffer( )
<br />
Origin width / 3, height / 2
<br />
<br />
angle# = 0.0
<br />
<br />
While Not KeyDown( KEY_ESC )
<br />
<br />
; NOTE: It is usually best to avoid very large angles.
<br />
; The 'If angle...' lines show one way to do this.
<br />
; Mod is another possibility.
<br />
<br />
If KeyDown( KEY_LEFT ) Then angle = angle - .5
<br />
; If angle < 0.0 Then angle = angle + 360
<br />
<br />
If KeyDown( KEY_RIGHT ) Then angle = angle + .5
<br />
; If angle >= 360.0 Then angle = angle - 360
<br />
<br />
See also <a href='ASin.htm'>ASin</a>, <a href='Cos.htm'>Cos</a>, <a href='ACos.htm'>ACos</a>, <a href='Tan.htm'>Tan</a>, <a href='Atan.htm'>Atan</a>, <a href='ATan2.htm'>ATan2</a><br></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Graphics 640,480; Change to graphics mode, nothing tricky yet.<br>
Origin 320,240 ; Move the point of orign for all drawing commands to the middle of the screen.<br>
Cls
<br />
For degrees=0 To 359; Step though all the degrees in a circle (360 in all)<br>
Delay(5); Wait 5 milli secsonds.<br>
<br>
; The next line calculates the Y coordinate of the point of the circle using the Sin<br>
; command, and multiplies it by 100 (to get a larger radius, try and change it).<br>
y=Sin(degrees)*100<br>
<br>
y=-y ; Invert Y coordinate to represent it properly on screen.<br>
<br>
; The next line calculates the X coordinate of the point of the circle using the Cos,<br>
; command, and multiplies it by 100 (to get a larger radius, try and change it).<br>
x=Cos(degrees)*100<br>
<br>
Rect x,y,1,1 ; Draw the current point on the circle.<br>
<br>
Next ; Give us another angle<br>
<br>
MouseWait ; Wait for the mouse.<br>
End ; Terminate the program.<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,14 +1,49 @@
<html><head><title>Command: CountGFXModes() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CountGFXModes() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the number of video graphic modes available.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to return the number of video modes the user's video card can display in. Use the <a href='GFXModeWidth.htm'>GFXModeWidth</a>, <a href='GFXModeHeight.htm'>GFXModeHeight</a>, and <a href='GFXModeDepth.htm'>GFXModeDepth</a> with each number of video mode to determine the width, height, and color depth capabilities of each mode. See example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CountGFXModes()/GfxModeWidth/GfxModeHeight/GfxModeDepth example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CountGFXModes()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to return the number of video modes the user's video card can display in. Use the GFXModeWidth, GFXModeHeight, and GFXModeDepth with each number of video mode to determine the width, height, and color depth capabilities of each mode. See example.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CountGFXModes.bb>Example</a></h1>
<table>
<tr>
<td>
; CountGFXModes()/GfxModeWidth/GfxModeHeight/GfxModeDepth example
<br />
<br />
intModes=CountGfxModes()
<br />
<br />
Print "There are " + intModes + "graphic modes available:"
<br />
<br />
; Display all modes including width, height, and color depth
<br />
For t = 1 To intModes
<br />
Print "Mode " + t + ":
<br />
intModes=CountGfxModes()<br>
Print "Width=" + GfxModeWidth(t)
<br />
Print "There are " + intModes + "graphic modes available:"<br>
<br>
; Display all modes including width, height, and color depth<br>
For t = 1 To intModes<br>
Print "Mode " + t + ":<br>
Print "Width=" + GfxModeWidth(t)<br>
Print "Height=" + GfxModeHeight(t)<br>
Print "Height=" + GfxModeDepth(t)<br>
Next<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Print "Height=" + GfxModeHeight(t)
<br />
@@ -1,22 +1,53 @@
<html><head><title>Command: CountGfxDrivers() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CountGfxDrivers() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the number of graphic drivers on the system.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Some computers may have more than one video card and/or video driver installed (a good example is a computer system with a primary video card and a Voodoo2 or other pass-through card).
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CountGfxDrivers()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Some computers may have more than one video card and/or video driver installed (a good example is a computer system with a primary video card and a Voodoo2 or other pass-through card). Once you know how many drivers there are, you can iterate through them with GfxDriverName$ and display them for the user to choose from. Once the user has chosen (or you decide), you can set the graphics driver with SetGfxDriver. Normally, this won't be necessary with 2D programming.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CountGfxDrivers.bb>Example</a></h1>
<table>
<tr>
<td>
; GfxDriver Examples
<br />
<br />
; Count how many drivers there are
<br />
totalDrivers=CountGfxDrivers()
<br />
Print "Choose a driver to use:"
<br />
<br />
; Go through them all and print their names (most people will have only 1)
<br />
For t = 1 To totalDrivers
<br />
Print t+") " + GfxDriverName$(t)
<br />
Once you know how many drivers there are, you can iterate through them with <a href='GfxDriverName$.htm'>GfxDriverName$</a> and display them for the user to choose from. Once the user has chosen (or you decide), you can set the graphics driver with <a href='SetGfxDriver.htm'>SetGfxDriver</a>.
Normally, this won't be necessary with 2D programming.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; GfxDriver Examples<br>
Next
<br />
<br />
; Count how many drivers there are<br>
totalDrivers=CountGfxDrivers()<br>
Print "Choose a driver to use:"<br>
; Let the user choose one
<br />
; Go through them all and print their names (most people will have only 1)<br>
For t = 1 To totalDrivers<br>
Print t+") " + GfxDriverName$(t)<br>
Next<br>
<br>
; Let the user choose one<br>
driver=Input("Enter Selection:")<br>
<br>
; Set the driver!<br>
SetGfxDriver driver<br>
Print "Your driver has been selected!"<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
driver=Input("Enter Selection:")
<br />
@@ -1,22 +1,61 @@
<html><head><title>Command: CreateBank </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CreateBank (size)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Create a data bank.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>size = size of memory bank in bytes<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>The bank commands allow you to make your own memory bank to perform your own read and write operations to. This is useful for compression/decompression, level data, and tons of other uses.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CreateBank ([size])</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
size - size of memory bank in bytes (default is 0 bytes)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
The bank commands allow you to perform high-speed data operations on a block of memory. This is useful for writing your own compression/decompression routines, passing and receiving data to and from a DLL and more. Banks start at 0 and finish at size-1.
<br />
<br />
The data types available for use with a bank are:
<br />
<br />
Byte - takes up one byte. Values can be in the range 0 to 255.
This command allocates the memory and creates a handle to the bank.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Bank Commands Example<br>
<br />
bnkTest=CreateBank(500)<br>
Short - takes up two bytes. Values can be in the range 0 to 65535.
<br />
Int - takes up four bytes. Values can be in the range -2147483647 to 2147483647.
<br />
Float - takes up four bytes.
<br>
<br>
See also: <a class=small href=FreeBank.htm>FreeBank</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CreateBank.bb>Example</a></h1>
<table>
<tr>
<td>
; Bank Commands Example
<br />
; ---------------------
<br />
<br />
bnkTest=CreateBank(12)
<br />
<br />
PokeByte bnkTest,0,Rand(255)
<br />
PokeShort bnkTest,1,Rand(65535)
For t = 1 To 50<br>
PokeByte bnkTest,t,Rnd(255)<br>
PokeInt bnkTest,t+1,Rnd(10000)<br>
PokeShort bnkTest,t+2,Rnd(10000)<br>
PokeFloat bnkTest,t+3,Rnd(-.999,.999)<br>
Next<br>
<br />
PokeInt bnkTest,3,Rand(-2147483648,2147483647)
For t = 1 To 50<br>
Print PeekByte (bnkTest,t)<br>
Print PeekInt (bnkTest,t+1)<br>
Print PeekShort (bnkTest,t+2)<br>
Print PeekFloat (bnkTest,t+3)<br>
Next<br>
<br>
Freebank bnkTest<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
PokeFloat bnkTest,7,0.5
@@ -1,7 +1,40 @@
<html><head><title>Command: CreateDir </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CreateDir path/name&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a directory/folder on a storage device.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>path/name = full path and name for new directory</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a directory (file folder) at the destination specified. Do not use a trailing slash at the end of the path/name parameter. You cannot be sure the directory was created with this command, so you will need to verify its existance yourself (use the <a href='FILETYPE.htm'>FILETYPE</a> command).</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CREATEDIR example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CreateDir path/name</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
path/name = full path and name for new directory
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Creates a directory (file folder) at the destination specified. Do not use a trailing slash at the end of the path/name parameter. You cannot be sure the directory was created with this command, so you will need to verify its existance yourself (use the FILETYPE command).
</td>
</tr>
</table>
<h1><a href=../2d_examples/CreateDir.bb>Example</a></h1>
<table>
<tr>
<td>
; CREATEDIR example
<br />
<br />
fldr$="c:winntsystem32myfolder"
<br />
createDir fldr$
<br />
Print "Folder created!"
fldr$="c:\winnt\system32\myfolder"<br>
createDir fldr$<br>
Print "Folder created!"<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</td>
</tr>
</table>
<br>
@@ -1,43 +1,77 @@
<html><head><title>Command: CreateImage </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CreateImage (width,height[,frames])&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Create a new image in memory and give its handle to a variable.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>width=width of the new image (or its frames)<br>
height=height of the new image<br>
frames= optional number of frames (assumed to be a single frame)<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Sometimes you want to create a completely new graphic on the fly (using other images, drawing commands, etc.) instead of loading one. This command will let you create a new image with a single frame or multiple frames for animation. You specify the width, height, and optional number of frames. The example should be pretty self-explainatory.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CreateImage/TileImage/ImageBuffer example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CreateImage (width,height[,frames])</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
width=width of the new image (or its frames)
<br />
height=height of the new image
<br />
frames= optional number of frames (assumed to be a single frame)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Sometimes you want to create a completely new graphic on the fly (using other images, drawing commands, etc.) instead of loading one. This command will let you create a new image with a single frame or multiple frames for animation. You specify the width, height, and optional number of frames. The example should be pretty self-explainatory.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CreateImage.bb>Example</a></h1>
<table>
<tr>
<td>
; CreateImage/TileImage/ImageBuffer example
<br />
<br />
; Again, we'll use globals even tho we don't need them here
<br />
; One variable for the graphic we'll create, one for a timer
<br />
Global gfxStarfield, tmrScreen
<br />
<br />
; Declare graphic mode
<br />
Graphics 640,480,16
<br />
<br />
; Create a blank image that is 32 pixels wide and 32 high with 10 frames of 32x32
<br />
gfxStarfield=CreateImage(32,32,10)
<br />
<br />
; loop through each frame of the graphic we just made
<br />
For t = 0 To 9
<br />
; Set the drawing buffer to the graphic frame so we can write on it
<br />
SetBuffer ImageBuffer(gfxStarfield,t)
<br />
; put 50 stars in the frame at random locations
<br />
For y = 1 To 50
<br />
Plot Rnd(32),Rnd(32)
<br />
Next
<br />
Next
<br />
; Again, we'll use globals even tho we don't need them here<br>
; One variable for the graphic we'll create, one for a timer<br>
Global gfxStarfield, tmrScreen<br>
<br />
; Declare graphic mode<br>
Graphics 640,480,16<br>
<br>
; Create a blank image that is 320 pixels wide and 32 high with 10 frames of 32x32<br>
gfxStarfield=CreateImage(32,32,10)<br>
<br>
; loop through each frame of the graphic we just made<br>
For t = 0 To 9<br>
; Set the drawing buffer to the graphic frame so we can write on it<br>
SetBuffer ImageBuffer(gfxStarfield,t)<br>
; put 50 stars in the frame at random locations<br>
For y = 1 To 50<br>
Plot Rnd(32),Rnd(32)<br>
Next<br>
Next<br>
<br>
; Double buffer mode for smooth screen drawing<br>
SetBuffer BackBuffer()<br>
<br>
; Loop until ESC is pressed<br>
While Not KeyHit(1)<br>
<br>
; Only update the screen every 300 milliseconds. Change 300 for faster or<br>
; slower screen updates<br>
If MilliSecs() > tmrScreen+300 Then <br>
Cls ; clear the screen<br>
<br>
; Tile the screen with a random frame from our new graphic starting at<br>
; x=0 and y=0 location.<br>
TileImage gfxStarfield,0,0,Rnd(9)<br>
Flip ; Flip the screen into view<br>
tmrScreen=MilliSecs() ; reset the time<br>
End If<br>
Wend <br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Double buffer mode for smooth screen drawing
<br />
@@ -1,30 +1,63 @@
<html><head><title>Command: CreateNetPlayer </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CreateNetPlayer (name$)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a new local player on the network game.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>name$ = any valid string holding the player's name.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a new local player. This also causes a special message to be sent to all remote machines (see <a href='NetMsgType.htm'>NetMsgType</a>). This returns an integer player number to be used in sending/receiving messages. Note that you must create at least one player before you can send and receive messages. </td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CreateNetPlayer example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CreateNetPlayer (name$)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
name$ = any valid string holding the player's name.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Creates a new local player. This also causes a special message to be sent to all remote machines (see NetMsgType). This returns an integer player number to be used in sending/receiving messages. Note that you must create at least one player before you can send and receive messages.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CreateNetPlayer.bb>Example</a></h1>
<table>
<tr>
<td>
; CreateNetPlayer example
<br />
<br />
newGame = StartNetGame()
<br />
; Check the status of the new game.
<br />
If newGame = 0 Then
<br />
Print "Could not start or join net game."
<br />
End
<br />
<br />
ElseIf newGame = 1
<br />
Print "Successfully joined the network game"
<br />
ElseIf newGame = 2
<br />
Print "A new network game was started!"
<br />
EndIf
<br />
<br />
; Create a random player name
<br />
name$="Player" + Rand(100)
<br />
newGame = StartNetGame()<br>
; Check the status of the new game.<br>
If newGame = 0 Then<br>
Print "Could not start or join net game."<br>
End<br>
<br />
ElseIf newGame = 1<br>
Print "Successfully joined the network game"<br>
ElseIf newGame = 2<br>
Print "A new network game was started!"<br>
EndIf<br>
<br>
; Create a random player name<br>
name$="Player" + Rand(100)<br>
<br>
; Get a unique player id number for the player<br>
; and create the player<br>
playerID=CreateNetPlayer(name$)<br>
<br>
If playerID = 0 Then <br>
Print "Player could not be created!"<br>
Else<br>
Print "Player " + name$ + " was created and given ID#" +
playerID<br>
End If<br>
WaitKey()<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Get a unique player id number for the player
<br />
@@ -1,57 +1,91 @@
<html><head><title>Command: CreateTCPServer </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CreateTCPServer (port)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a TCP server on the specified port.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>port = the port to use when creating the server</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a TCP/IP server with the designated port. Use this for communications between other clients and the local box. See <a href='OpenTCPStream.htm'>OpenTCPStream</a>, <a href='CloseTCPServer.htm'>CloseTCPServer</a>, and <a href='CloseTCPStream.htm'>CloseTCPStream</a> for more information.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CreateTCPServer (port)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
port = the port to use when creating the server
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Creates a TCP/IP server with the designated port. Use this for communications between other clients and the local box. See OpenTCPStream, CloseTCPServer, and CloseTCPStream for more information.
<br />
<br />
Returns a TCP/IP server handle if successful or 0 if not.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CreateTCPServer.bb>Example</a></h1>
<table>
<tr>
<td>
; CreateTCPServer, CloseTCPServer, AcceptTCPStream Example
<br />
; This code is in two parts, and needs to be run seperately on the same machine
<br />
<br />
; --- Start first code set ---
<br />
; Create a server and listen for push
<br />
<br />
svrGame=CreateTCPServer(8080)
<br />
<br />
If svrGame<>0 Then
<br />
Print "Server started successfully."
<br />
Else
<br />
Print "Server failed to start."
<br />
End
<br />
End If
<br />
<br />
While Not KeyHit(1)
<br />
strStream=AcceptTCPStream(svrGame)
<br />
If strStream Then
<br />
Print ReadString$(strStream)
<br />
Delay 2000
<br />
End
<br />
Else
<br />
Print "No word from Apollo X yet ..."
<br />
Delay 1000
<br />
End If
<br />
Wend
<br />
<br />
End
Returns a TCP/IP server handle if successful or 0 if not.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CreateTCPServer, CloseTCPServer, AcceptTCPStream Example<br>
; This code is in two parts, and needs to be run seperately on the same machine<br>
<br />
; --- Start first code set ---<br>
; Create a server and listen for push<br>
<br>
svrGame=CreateTCPServer(8080)<br>
<br>
If svrGame<>0 Then <br>
Print "Server started successfully."<br>
Else<br>
Print "Server failed to start."<br>
End<br>
End If<br>
<br>
While Not KeyHit(1)<br>
strStream=AcceptTCPStream(svrGame)<br>
If strStream Then <br>
Print ReadString$(strStream)<br>
Delay 2000<br>
End<br>
Else <br>
Print "No word from Apollo X yet ..."<br>
Delay 1000<br>
End If <br>
Wend<br>
<br>
End<br>
<br>
; --- End first code set ---<br>
<br>
<br>
; --- Start second code set ---<br>
; Copy this code to another instance of Blitz Basic<br>
; Run the above code first, then run this ... they will 'talk'<br>
<br>
; Create a Client and push data<br>
<br>
strmGame=OpenTCPStream("127.0.0.1",8080)<br>
<br>
If strmGame<>0 Then <br>
Print "Client Connected successfully."<br>
Else<br>
Print "Server failed to connect."<br>
WaitKey <br>
End<br>
End If<br>
<br>
; write stream to server<br>
WriteString strmGame,"Mission Control, this is Apollo X ..."<br>
Print "Completed sending message to Mission control..."<br>
<br>
; --- End second code set ---<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
; --- End first code set ---
@@ -1,2 +1,46 @@
<html><head><title>Command: CreateTimer </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CreateTimer (frequency)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a timer to track a frequency.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>frequency = usually a framerate like 50 or 60</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command in conjunction with the WaitTimer command to control the speed of program execution (fps). You will use this in your main screen redraw loop to control the playback speed to match the proper speed. This will prevent your games from playing back too fast on computers faster than yours. Use of this system is VERY GOOD practice, as your game will be played on a variety of computers.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Create the timer to track speed<br>frameTimer=CreateTimer(60)<br><br>; Your main screen draw loop<br>While Not KeyHit(1)<br>WaitTimer(frameTimer) ; Pause until the timer reaches 60<br>Cls<br>; Draw your screen stuff<br>Flip<br>Wend<br><br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CreateTimer (frequency)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
frequency = usually a framerate like 50 or 60
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command in conjunction with the WaitTimer command to control the speed of program execution (fps). You will use this in your main screen redraw loop to control the playback speed to match the proper speed. This will prevent your games from playing back too fast on computers faster than yours. Use of this system is VERY GOOD practice, as your game will be played on a variety of computers.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CreateTimer.bb>Example</a></h1>
<table>
<tr>
<td>
; Create the timer to track speed
<br />
frameTimer=CreateTimer(60)
<br />
<br />
; Your main screen draw loop
<br />
While Not KeyHit(1)
<br />
WaitTimer(frameTimer) ; Pause until the timer reaches 60
<br />
Cls
<br />
; Draw your screen stuff
<br />
Flip
<br />
Wend
@@ -1,5 +1,39 @@
<html><head><title>Command: CurrentDate$() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CurrentDate$() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the current system date.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the current date in the format: DD MON YYYY (i.e. 10 DEC 2000).</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Print the current date to the screen<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CurrentDate$()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Returns the current date in the format: DD MON YYYY (i.e. 10 DEC 2000).
</td>
</tr>
</table>
<h1><a href=../2d_examples/CurrentDate.bb>Example</a></h1>
<table>
<tr>
<td>
; Print the current date to the screen
<br />
<br />
Print "The date is:" + CurrentDate$()
<br />
</td>
Print "The date is:" + CurrentDate$()<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
@@ -1,7 +1,41 @@
<html><head><title>Command: CurrentDir$() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CurrentDir$() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns a string containing the currently selected directory.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command will return the currently selected directory for disk operations, useful for advanced file operations. Use <a href='CHANGEDIR.htm'>CHANGEDIR</a> to change the current directory. The value returned doesn't have a trailing slash - aside from the root directory of the drive.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; CurrentDir$() example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CurrentDir$()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command will return the currently selected directory for disk operations, useful for advanced file operations. Use CHANGEDIR to change the current directory. The value returned doesn't have a trailing slash - aside from the root directory of the drive.
</td>
</tr>
</table>
<h1><a href=../2d_examples/CurrentDir.bb>Example</a></h1>
<table>
<tr>
<td>
; CurrentDir$() example
<br />
<br />
; Print the current directory until ESC key
<br />
While Not KeyHit(1)
<br />
Print CurrentDir$()
<br />
; Print the current directory until ESC key<br>
While Not KeyHit(1)<br>
Print CurrentDir$()<br>
Wend<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Wend
</td>
</tr>
</table>
@@ -1,5 +1,39 @@
<html><head><title>Command: CurrentTime$() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;CurrentTime$() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the current system time.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the current time in the format: HH:MM:SS (i.e. 14:31:57).</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Print the current time to the screen<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CurrentTime$()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Returns the current time in the format: HH:MM:SS (i.e. 14:31:57).
</td>
</tr>
</table>
<h1><a href=../2d_examples/CurrentTime.bb>Example</a></h1>
<table>
<tr>
<td>
; Print the current time to the screen
<br />
<br />
Print "The Time is:" + CurrentTime$()
<br />
</td>
Print "The Time is:" + CurrentTime$()<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
+59 -23
View File
@@ -1,28 +1,64 @@
<html><head><title>Command: Data </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Data list_of_values&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Creates a list of constant values to be parsed through within your program</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>list_of_values = a list of comma delimited values (strings must be inside quotes)</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Data is used to create neat, comma delimited lists of values of a constant nature that you will be reading (and probably reusing) during the execution of your game. You may store level information (number of enemies, stars, etc) there or just about anything you can think of! You can easily mix datatypes (strings, integers, floats) in your Data statements, as long as they are read properly with the <a href='Read.htm'>Read</a> command later. You will need to use the <a href='Restore.htm'>Restore</a> command to point to the <a href='..htm'>.</a>Label that begins your Data statements. See the related commands for more information and more examples.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Print "Here we go!"<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Data list_of_values</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
list_of_values = a list of comma delimited values (strings must be inside quotes)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Data is used to create neat, comma delimited lists of values of a constant nature that you will be reading (and probably reusing) during the execution of your game. You may store level information (number of enemies, stars, etc) there or just about anything you can think of! You can easily mix datatypes (strings, integers, floats) in your Data statements, as long as they are read properly with the Read command later. You will need to use the Restore command to point to the .Label that begins your Data statements. See the related commands for more information and more examples.
<br>
; Restore to the start of the Data statements<br>
Restore startData<br>
<br>
; Get the first number which is the total number of users<br>
Read Users<br>
See also: <a class=small href=Read.htm>Read</a>, <a class=small href=Restore.htm>Restore</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Data.bb>Example</a></h1>
<table>
<tr>
<td>
Print "Here we go!"
<br />
<br />
; Restore to the start of the Data statements
<br />
Restore startData
<br />
<br />
; Get the first number which is the total number of users
<br />
Read Users
<br />
<br />
; Print them all!
<br />
For T = 1 To Users
<br />
Read firstname$
<br />
Read age
<br />
Read accuracy#
<br />
Read lastname$
<br />
Print firstname$ + " " + lastname$ + " is " + age + " years old with " + accuracy# + " accuracy!"
<br />
; Print them all!<br>
For T = 1 To Users<br>
Read firstname$<br>
Read age<br>
Read accuracy#<br>
Read lastname$<br>
Print firstname$ + " " + lastname$ + " is " + age + " years old with " + accuracy# + " accuracy!"<br>
Next <br>
Next
<br />
While Not KeyHit(1)<br>
Wend<br>
End<br>
<br>
.startData<br>
Data 3<br>
Data "Shane", 31, 33.3333, "Monroe"<br>
Data "Bob", 28, 12.25, "Smith"<br>
Data "Roger", 54, 66.66, "Rabbit"<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+51 -13
View File
@@ -1,18 +1,56 @@
<html><head><title>Command: DebugLog </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DebugLog message&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Writes a message to the debug log for debugging purposes.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>message = message text string value<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>You power programmers will just love this. You have your own debug log to write to!<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DebugLog message</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
message = message text string value
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
You power programmers will just love this. You have your own debug log to write to! The DebugLog can be viewed from the debugger window during program execution only.
<br />
<br />
For those not familiar to this sort of thing, think of the Debug log like your own private 'in program notepad'. Use this to write messages to yourself during program execution. For example, you could write the graphic modes that the user has on his system, or just little alerts to let you know your code execution made it to a certain point in the execution without interrupting it. I'm sure you'll find a lot of uses for this! See the example if you're still lost.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DebugLog Example<br>
<br />
; Let's start graphics mode<br>
Graphics 640,480,16<br>
For those not familiar to this sort of thing, think of the Debug log like your own private 'in program notepad'. Use this to write messages to yourself during program execution. For example, you could write the graphic modes that the user has on his system, or just little alerts to let you know your code execution made it to a certain point in the execution without interrupting it. I'm sure you'll find a lot of uses for this! See the example if you're still lost.
<br>
<br>
See also: <a class=small href=Stop.htm>Stop</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/DebugLog.bb>Example</a></h1>
<table>
<tr>
<td>
; DebugLog Example
<br />
<br />
; Let's start graphics mode
<br />
Graphics 640,480,16
<br />
<br />
; Now, let's load an image that doesn't exist!
<br />
gfxPlayer=LoadImage("noimagefound.jpg")
<br />
If gfxPlayer=0 Then
<br />
; Now, let's load an image that doesn't exist!<br>
gfxPlayer=LoadImage("noimagefound.jpg")<br>
If gfxPlayer=0 Then<br>
DebugLog "Player's Graphics failed to load!"<br>
End If<br>
DebugLog "Player's Graphics failed to load!"
<br />
; This is supposed to generate an error. Press F9 to see the log!<br>
While Not KeyHit(1)<br>
DrawImage gfxPlayer,100,100<br>
Wend<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
End If
<br />
+58 -22
View File
@@ -1,27 +1,63 @@
<html><head><title>Command: Default </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Default &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Specifies the set of commands that executes in a Select structure if none of the CASEs are met.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>In a <a href='SELECT.htm'>SELECT</a> structure, you may wish to execute code if none of the cases you specify are met. All code after DEFAULT to <a href='END SELECT.htm'>END SELECT</a> will be executed if no case is met. See <a href='SELECT.htm'>SELECT</a>, <a href='CASE.htm'>CASE</a>, and the example for more.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; SELECT/CASE/DEFAULT/END SELECT Example<br>
; Assign a random number 1-10<br>
mission=Rnd(1,10)<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Default</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
In a SELECT structure, you may wish to execute code if none of the cases you specify are met. All code after DEFAULT to END SELECT will be executed if no case is met. See SELECT, CASE, and the example for more.
<br>
; Start the selection process based on the value of 'mission' variable<br>
Select mission<br>
<br>
; Is mission = 1?<br>
Case 1<br>
Print "Your mission is to get the plutonium and get out alive!"<br>
See also: <a class=small href=Select.htm>Select</a>, <a class=small href=Case.htm>Case</a>, <a class=small href=End Select.htm>End Select</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Default.bb>Example</a></h1>
<table>
<tr>
<td>
; SELECT/CASE/DEFAULT/END SELECT Example
<br />
; Assign a random number 1-10
<br />
mission=Rnd(1,10)
<br />
<br />
; Start the selection process based on the value of 'mission' variable
<br />
Select mission
<br />
<br />
; Is mission = 1?
<br />
Case 1
<br />
Print "Your mission is to get the plutonium and get out alive!"
<br />
<br />
; Is mission = 2?
<br />
Case 2
<br />
Print "Your mission is to destroy all enemies!"
<br />
; Is mission = 2?<br>
Case 2<br>
Print "Your mission is to destroy all enemies!"<br>
<br />
; Is mission = 3?
; Is mission = 3?<br>
Case 3 <br>
Print "Your mission is to steal the enemy building plans!"<br>
<br>
; What do do if none of the cases match the value of mission<br>
Default <br>
Print "Missions 4-10 are not available yet!"<br>
<br>
; End the selection process<br>
End Select<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Case 3
+37 -3
View File
@@ -1,5 +1,39 @@
<html><head><title>Command: Delay </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Delay milliseconds&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Pause program execution for a certain time.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>milliseconds = the amount of milliseconds to delay. 1000=1 second</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command stops all program execution for the designated time period. All execution stops. If you need program execution to continue, consider trapping time elapsed with a custom timer function using <a href='Millisecs().htm'>Millisecs()</a>.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Delay for 5 seconds<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Delay milliseconds</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
milliseconds = the amount of milliseconds to delay. 1000=1 second
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command stops all program execution for the designated time period. All execution stops. If you need program execution to continue, consider trapping time elapsed with a custom timer function using Millisecs().
</td>
</tr>
</table>
<h1><a href=../2d_examples/Delay.bb>Example</a></h1>
<table>
<tr>
<td>
; Delay for 5 seconds
<br />
<br />
Delay 5000
<br />
</td>
Delay 5000<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
+50 -14
View File
@@ -1,15 +1,51 @@
<html><head><title>Command: Delete </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Delete custom_type_name&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Delete an object from a custom TYPE collection.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>custom_type_name = the custom name of an existing object</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you haven't read up on the <a href='TYPE.htm'>TYPE</a>
command, you might want to do so before continuing.</p>
<p>Use the Delete command to remove an object from the Type collection. Use the
commands FIRST, LAST, BEFORE, and NEXT to move the object pointer to the object
you want to delete, then issue the Delete command with the custom Type name.</p>
<p>This is often used in a FOR ... EACH loop when a collision happens and you
wish to remove the object (an alien ship object for example) from the collection.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Move them all over 1 (like the description example from TYPE command)<br>
; If the chair isn't on the screen anymore, delete that chair object from the<br>
; collection.</p>
<p>For room.chair = Each chair<br>
room\x = room\x + 1<br>
if room\x > 640 then<br>
Delete room<br>
Next<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Delete custom_type_name</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
custom_type_name = the custom name of an existing object
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you haven't read up on the TYPE command, you might want to do so before continuing.
<br />
<br />
Use the Delete command to remove an object from the Type collection. Use the commands FIRST, LAST, BEFORE, and NEXT to move the object pointer to the object you want to delete, then issue the Delete command with the custom Type name. If you wish to delete all objects of a certain type, you can use DELETE EACH <TYPE>.
<br />
<br />
This is often used in a FOR ... EACH loop when a collision happens and you wish to remove the object (an alien ship object for example) from the collection.
<br>
<br>
See also: <a class=small href=Type.htm>Type</a>, <a class=small href=New.htm>New</a>, <a class=small href=Before.htm>Before</a>, <a class=small href=After.htm>After</a>, <a class=small href=First.htm>First</a>, <a class=small href=Last.htm>Last</a>, <a class=small href=Each.htm>Each</a>, <a class=small href=Insert.htm>Insert</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Delete.bb>Example</a></h1>
<table>
<tr>
<td>
; Move them all over 1 (like the description example from TYPE command)
<br />
; If the chair isn't on the screen anymore, delete that chair object from the
<br />
; collection.
<br />
<br />
For room.chair = Each chair
<br />
room\x = room\x + 1
@@ -1,5 +1,38 @@
<html><head><title>Command: DeleteDir </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DeleteDir directory/path&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Deletes a specified folder/directory.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>directory/path = full path/name of directory</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Deletes a specified folder/directory from the device. Note: This only works on EMPTY directories - you cannot delete a folder with other folders or files inside with this command. Do not apply a trailing slash.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DeleteDir example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DeleteDir directory/path</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
directory/path = full path/name of directory
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Deletes a specified folder/directory from the device. Note: This only works on EMPTY directories - you cannot delete a folder with other folders or files inside with this command. Do not apply a trailing slash.
</td>
</tr>
</table>
<h1><a href=../2d_examples/DeleteDir.bb>Example</a></h1>
<table>
<tr>
<td>
; DeleteDir example
<br />
<br />
DeleteDir "C: est"
</td>
</tr>
DeleteDir "C:\test"<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
@@ -1,4 +1,38 @@
<html><head><title>Command: DeleteFile </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DeleteFile path/filename&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Deletes a specified file.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>path/filename = full path/filename to the file to delete</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Deletes a specified file from the drive. You will need to make sure the file exists before execution and be sure its been deleted AFTER execution. Use <a href='FILETYPE.htm'>FILETYPE</a> to determine this.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DELETEFILE example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DeleteFile path/filename</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
path/filename = full path/filename to the file to delete
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Deletes a specified file from the drive. You will need to make sure the file exists before execution and be sure its been deleted AFTER execution. Use FILETYPE to determine this.
</td>
</tr>
</table>
<h1><a href=../2d_examples/DeleteFile.bb>Example</a></h1>
<table>
<tr>
<td>
; DELETEFILE example
<br />
<br />
DeleteFile "C: estmyfile.bb"
</td>
</tr>
DeleteFile "C:\test\myfile.bb"<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
@@ -1,34 +1,68 @@
<html><head><title>Command: DeleteNetPlayer </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DeleteNetPlayer playerID&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Deletes a local player from the network game.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>playerID = value assigned when player was created with CreateNetPlayer</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Using the playerID generated by the <a href='CreateNetPlayer.htm'>CreateNetPlayer</a> command, this command will remove the designated player from the network game.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DeleteNetPlayer playerID</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
playerID = value assigned when player was created with CreateNetPlayer
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Using the playerID generated by the CreateNetPlayer command, this command will remove the designated player from the network game.
<br />
<br />
This also causes a special message to be sent to all remote machines (see NetMsgType).
</td>
</tr>
</table>
<h1><a href=../2d_examples/DeleteNetPlayer.bb>Example</a></h1>
<table>
<tr>
<td>
; DeleteNetPlayer example
<br />
<br />
newGame = StartNetGame()
<br />
; Check the status of the new game. If newGame = 0 Then
<br />
Print "Could not start or join net game."
<br />
End
<br />
<br />
ElseIf newGame = 1
<br />
Print "Successfully joined the network game"
<br />
ElseIf newGame = 2
<br />
Print "A new network game was started!"
<br />
EndIf
<br />
<br />
; Create a random player name
<br />
name$="Player" + Rand(100)
<br />
<br />
This also causes a special message to be sent to all remote machines (see <a href='NetMsgType.htm'>NetMsgType</a>). </td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DeleteNetPlayer example<br>
; Get a unique player id number for the player
<br />
newGame = StartNetGame()<br>
; Check the status of the new game.
If newGame = 0 Then<br>
Print "Could not start or join net game."<br>
End<br>
<br>
ElseIf newGame = 1<br>
Print "Successfully joined the network game"<br>
ElseIf newGame = 2<br>
Print "A new network game was started!"<br>
EndIf<br>
<br>
; Create a random player name<br>
name$="Player" + Rand(100)<br>
<br>
; Get a unique player id number for the player<br>
; and create the player<br>
playerID=CreateNetPlayer(name$)<br>
<br>
If playerID = 0 Then <br>
Print "Player could not be created!"<br>
Else<br>
Print "Player " + name$ + " was created and given ID#" + playerID<br>
WaitKey()<br>
; delete the player!<br>
DeleteNetPlayer playerID<br>
Print "The local player was deleted!"<br>
End If<br>
waitkey()<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; and create the player
<br />
+72 -22
View File
@@ -1,27 +1,77 @@
<html><head><title>Command: Dim </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Dim variable(elements)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Dimensions an array variable for storage.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>variable = variable of desired type (string, floating, integer)<br>
elements = number of elements to be created. Can be multi-dimensional.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Prepares an array using the specified variable type as its type and specified elements for the number of containers it should hold. You may use as many dimension elements as you like (just watch your memory). There is no way in Blitz to 'Redimension' arrays, so define them accordingly. Use the proper notation on the declaration variable to make it a string($), floating(#), or integer type array. Note: Arrays always start at ZERO reference - so variable(0) is always the first element.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Dim array_name(index1[,index2][,index3][,...])</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
array_name - array name
<br />
index1 - index number of last variable to be created within that particular index-range
<br />
index2 (optional) - index number of last variable to be created within that particular index-range
<br />
index3 (optional) - index number of last variable to be created within that particular index-range
<br />
... (optional) - and so on
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Creates an array of the specified type. For example, Dim tiles(10) creates an integer array, Dim tiles#(10) creates a float array and Dim tile$(10) creates a string array.
<br />
<br />
<br />
The contents of an array can be accessed using the index notation: 0 - indexn, giving indexn+1 number of elements for that particular index range. You should not attempt to access a non-existent element of the array. In debug mode this will cause an error stating 'index out of bounds'. With debug off however, you may get 'illegal memory access' errors, or worse no immediate errors at all.
<br />
<br />
Arrays are global, and must be defined in the main program.
<br />
<br />
Arrays can be re-dimmed by using the Dim statement again with the same array name, but the contents of the array will be lost.
<br />
<br />
-----------------------------------------------------------
<br />
<br />
*NEW* BLITZ ARRAYS *NEW*
To use this command effectively, you must understand arrays. Think of an array like a variable that has multiple slots to hold many values, all under the same variable name. Before <a href='TYPE.htm'>TYPE</a>s came around, this was the best way to track repeating elements (say, alien ships) because you can iterate through an array collection easily.<br>
<br />
Take for example, you want to track 100 aliens on the screen. You could have two variables - alienx and alieny. By making these arrays - alienx() and alieny() and each having 100 elements each, you could easily set or retrieve the first alien's location by using alienx(1), alieny(1). The next alien's coordinates would be alienx(2), alienx(2) and so on. This makes it easy to use a <a href='FOR.htm'>FOR</a> ... <a href='NEXT.htm'>NEXT</a> or <a href='EACH.htm'>EACH</a> loop to go through all the elements.<br>
<br />
Since a recent Blitz update you can now do what are called 'blitz arrays'. These are very different to a Dim'd array, in the following ways:
<br />
<br />
They use square brackets [] instead of the normal round ones ().
<br />
<br />
You declare them like you do Local or Global variables, example: Local myArray[10]
<br />
<br />
They cannot be multi-dimensional, and cannot be resized.
<br />
<br />
They can be stored in Type objects.
<br />
<br />
Arrays are also useful for 'multi-dimensional' notation too. Instead of tracking our 100 aliens in the method mentioned above, you could use a single variable: alien(100,1). The first element collection are the 100 aliens, the second element is the X and Y location of that alien - the 0 element being the alien's X location, and the 1 element being the alien's Y location. So to set the position of alien 57 to X=640,Y=480 you could do this:<br>
They can be passed to functions.
<br />
alien(57,0)=640<br>
alien(57,1)=480<br>
DrawImage imgAlien,alien(57,0),alien(57,1)<br>
<br>
Of course, TYPEs are a much better way of doing this sort of multiple value sort of routine.<br>
<br>
Arrays are great for tracking collections of items with a single, common element - but often times TYPEs will prove to be more useful.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DIM example<br>
; Create a collection of 100 random numbers<br>
<br>
; Declare our array<br>
Dim nums(100)<br>
<br>
; Fill each element with a random number<br>
For T = 1 to 100<br>
nums(t) = Rnd(1,100)<br>
Next<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,31 +1,67 @@
<html><head><title>Command: DrawBlock </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DrawBlock image,x,y,[frame]&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Draws an image at a location without regards to transparency.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>image = variable of the image handle<br>
x = x location to draw the image<br>
y = y location to draw the image<br>
frame = image's frame to draw (optional - default is 0)<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This is similar to the <a href='DrawImage.htm'>DrawImage</a> command except that any transparency or <a href='MaskImage.htm'>MaskImage</a> is ignored and the entire image (including masked colors) is drawn. The frame is optional.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DrawBlock Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DrawBlock image, x,y [,frame]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
image = variable of the image pointer
<br />
x = x location to draw the image
<br />
y = y location to draw the image
<br />
frame = image's frame to draw (optional - default is 0)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This is similar to the DrawImage command except that any transparency or MaskImage is ignored and the entire image (including masked colors) is drawn. The frame is optional.
<br />
<br />
See also: DrawImage
</td>
</tr>
</table>
<h1><a href=../2d_examples/DrawBlock.bb>Example</a></h1>
<table>
<tr>
<td>
; DrawBlock Example
<br />
<br />
; Turn on graphics mode
<br />
Graphics 640,480,16
<br />
<br />
; Create new empty graphic to store our circle in
<br />
gfxCircle=CreateImage(50,50)
<br />
<br />
; Draw the circle image
<br />
; Set drawing operations to point to our new empty graphic
<br />
SetBuffer ImageBuffer(gfxCircle)
<br />
Color 255,0,0
<br />
; Note the extra space between the circle and the edge of the graphic
; Turn on graphics mode<br>
Graphics 640,480,16<br>
<br />
Oval 10,10,30,30,1
; Create new empty graphic to store our circle in<br>
gfxCircle=CreateImage(50,50)<br>
<br>
; Draw the circle image<br>
; Set drawing operations to point to our new empty graphic<br>
SetBuffer ImageBuffer(gfxCircle)<br>
Color 255,0,0<br>
; Note the extra space between the circle and the edge of the graphic<br>
Oval 10,10,30,30,1<br>
<br>
; Let's not forget to put the drawing buffer back!<br>
SetBuffer BackBuffer()<br>
; Set the CLS color to white<br>
ClsColor 255,255,255<br>
<br>
; Let the user move the circle graphic around a white screen<br>
; putting the graphic at the MouseX,Y coordinates<br>
While Not KeyHit(1)<br>
Cls<br>
DrawBlock gfxCircle,MouseX(),MouseY()<br>
Flip<br>
Wend<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,38 +1,72 @@
<html><head><title>Command: DrawBlockRect </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DrawBlockRect image,x,y,rect_x,rect_y,rect_width,rect_height,[frame]&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Draws a rectangular area of an image at the designated location without transparency.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>image = variable holding the image handle<br>
x = x location on the screen to draw the image<br>
y = y location on the screen to draw the image<br>
rect_x = starting x location within the image to draw<br>
rect_y = starting y location within the image to draw<br>
rect_width = the height of the area to draw<br>
rect_height = the width of the area to draw<br>
frame = optional frame number of image to draw<br>
</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command will let you draw a rectangular PORTION of an image to the designated location on the screen. The transparent/masked portions of the original image will be ignored and drawn with the image.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DrawBlockRect image,x,y,rect_x,rect_y,rect_width,rect_height,[frame]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
image = variable holding the image handle
<br />
x = x location on the screen to draw the image
<br />
y = y location on the screen to draw the image
<br />
rect_x = starting x location within the image to draw
<br />
rect_y = starting y location within the image to draw
<br />
rect_width = the height of the area to draw
<br />
rect_height = the width of the area to draw
<br />
frame = optional frame number of image to draw
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command will let you draw a rectangular PORTION of an image to the designated location on the screen. The transparent/masked portions of the original image will be ignored and drawn with the image.
<br />
<br />
This is handy if you are doing something like revealing part of a screen when the player uncovers something (think QIX). You could load the 'picture' into an image, then when the player clears a rectangular region, you could paste that portion of the final image onto the playfield. If you want to draw the image portion with transparency or masking, use DrawImageRect instead.
</td>
</tr>
</table>
<h1><a href=../2d_examples/DrawBlockRect.bb>Example</a></h1>
<table>
<tr>
<td>
; DrawBlockRect Example
<br />
<br />
; Turn on graphics mode
<br />
Graphics 640,480,16
<br />
<br />
; Create new empty graphic to store our circle in
<br />
gfxCircle=CreateImage(50,50)
<br />
<br />
; Draw the circle image
<br />
; Set drawing operations to point to our new empty graphic
<br />
SetBuffer ImageBuffer(gfxCircle)
<br />
This is handy if you are doing something like revealing part of a screen when the player uncovers something (think QIX). You could load the 'picture' into an image, then when the player clears a rectangular region, you could paste that portion of the final image onto the playfield. If you want to draw the image portion with transparency or masking, use <a href='DrawImageRect.htm'>DrawImageRect</a> instead.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DrawBlockRect Example<br>
Color 255,0,0
<br />
; Turn on graphics mode<br>
Graphics 640,480,16<br>
<br>
; Create new empty graphic to store our circle in<br>
gfxCircle=CreateImage(50,50)<br>
<br>
; Draw the circle image<br>
; Set drawing operations to point to our new empty graphic<br>
SetBuffer ImageBuffer(gfxCircle)<br>
Color 255,0,0<br>
; Note the extra space between the circle and the edge of the graphic<br>
Oval 10,10,30,30,1<br>
SetBuffer FrontBuffer()<br>
<br>
; Set the screen to white so you can see the transparent areas<br>
ClsColor 255,255,255<br>
Cls <br>
<br>
; Let's draw portions of the circle randomly<br>
While Not KeyHit(1)<br>
; We take random sized portions of the circle and put them<br>
; at a random location ... wash, rinse, and repeat<br>
DrawBlockRect gfxCircle,Rnd(640),Rnd(480),0,0,Rnd(50),Rnd(50),0<br>
Delay 100<br>
Wend<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Note the extra space between the circle and the edge of the graphic
<br />
@@ -1,35 +1,71 @@
<html><head><title>Command: DrawImage </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DrawImage handle,x,y,[frame]&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Draws an image or frame of an animImage on the screen.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>handle = variable image handle previously designated<br>
x = the 'x' location of the screen to display the graphic<br>
y = the 'y' location of the screen to display the graphic<br>
frame = the frame number of the AnimImage to display (optional; 0 is assumed)<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command draws a previously loaded graphic. This command draws both single image graphics (loaded with the <a href='LoadImage.htm'>LoadImage</a> command) as well as animated images (loaded with the <a href='LoadAnimImage.htm'>LoadAnimImage</a> command).<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DrawImage image, x,y [,frame]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
image = variable image pointer previously designated
<br />
x = the 'x' location of the screen to display the graphic
<br />
y = the 'y' location of the screen to display the graphic
<br />
frame = the frame number of the AnimImage to display (optional: default is 0)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command draws a previously loaded image. This command draws both single image graphics (loaded with the LoadImage command) as well as animated images (loaded with the LoadAnimImage command).
<br />
<br />
You specify where on the screen you wish the image to appear. You can actually 'draw' off the screen as well by using negative values or positive values that are not visible 'on the screen'.
<br />
<br />
Finally, if you are using an animated image (loaded with the LoadAnimImage), you can specify which frame of the imagestrip is displayed with the DrawImage command.
<br />
<br />
One of the most common problems new Blitz programmers face when using drawing commands is that even though they draw the graphic to the screen, they never see it!
<br />
<br />
Remember, Blitz Basic is fast ... too fast for the human eye. You will have to either continuously draw the image over and over again (like the way a cartoon or TV works), clearing the screen each time a change is made (this is called double buffering); or you will need to delay Blitz's execution long enough in 'human time' to let you SEE the picture. We will do the double buffering approach.
<br />
<br />
See also: DrawBlock
</td>
</tr>
</table>
<h1><a href=../2d_examples/DrawImage.bb>Example</a></h1>
<table>
<tr>
<td>
; LoadImage and DrawImage example
<br />
<br />
; Declare a variable to hold the graphic file handle
<br />
Global gfxPlayer
<br />
You specify where on the screen you wish the image to appear. You can actually 'draw' off the screen as well by using negative values or positive values that are not visible 'on the screen'.<br>
<br />
; Set a graphics mode
Finally, if you are using an animated image (loaded with the <a href='LoadAnimImage.htm'>LoadAnimImage</a>), you can specify which frame of the imagestrip is displayed with the DrawImage command.<br>
<br>
One of the most common problems new Blitz programmers face when using drawing commands is that even though they draw the graphic to the screen, they never see it!<br>
<br>
Remember, Blitz Basic is fast ... too fast for the human eye. You will have to either continuously draw the image over and over again (like the way a cartoon or TV works), clearing the screen each time a change is made (this is called double buffering); or you will need to delay Blitz's execution long enough in 'human time' to let you SEE the picture. We will do the double buffering approach.<br></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; LoadImage and DrawImage example<br>
<br>
; Declare a variable to hold the graphic file handle<br>
Global gfxPlayer<br>
<br>
; Set a graphics mode<br>
Graphics 640,480,16<br>
<br>
; Set drawing operations for double buffering<br>
SetBuffer BackBuffer()<br>
<br>
; Load the image and assign its file handle to the variable<br>
; - This assumes you have a graphic called player.bmp in the<br>
; same folder as this source code<br>
gfxPlayer=LoadImage("player.bmp")<br>
<br>
; Let's do a loop where the graphic is drawn wherever the<br>
; mouse is pointing. ESC will exit.<br>
While Not KeyHit(1)<br>
Cls ; clear the screen<br>
DrawImage gfxPlayer,MouseX(),MouseY() ; Draw the image!<br>
Flip ; flip the image into view and clear the back buffer<br>
Wend<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Graphics 640,480,16
@@ -1,34 +1,69 @@
<html><head><title>Command: DrawImageRect </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;DrawImageRect image,x,y,rect_x,rect_y,rect_width,rect_height,[frame]&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Draws a rectangular area of an image at the designated location.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>image = variable holding the image handle<br>
x = x location on the screen to draw the image<br>
y = y location on the screen to draw the image<br>
rect_x = starting x location within the image to draw<br>
rect_y = starting y location within the image to draw<br>
rect_width = the height of the area to draw<br>
rect_height = the width of the area to draw<br>
frame = optional frame number of image to draw<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command will let you draw a rectangular PORTION of an image to the designated location on the screen. The transparent/masked portions of the original image will be drawn transparent, just as you normally would draw an image.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>DrawImageRect image,x,y,rect_x,rect_y,rect_width,rect_height,[frame]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
image = variable holding the image handle
<br />
x = x location on the screen to draw the image
<br />
y = y location on the screen to draw the image
<br />
rect_x = starting x location within the image to draw
<br />
rect_y = starting y location within the image to draw
<br />
rect_width = the height of the area to draw
<br />
rect_height = the width of the area to draw
<br />
frame = optional frame number of image to draw
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command will let you draw a rectangular PORTION of an image to the designated location on the screen. The transparent/masked portions of the original image will be drawn transparent, just as you normally would draw an image.
<br />
<br />
This is handy if you are doing something like revealing part of a screen when the player uncovers something (think QIX). You could load the 'picture' into an image, then when the player clears a rectangular region, you could paste that portion of the final image onto the playfield. If you want to draw the image portion with no transparency or mask, use DrawBlockRect instead.
</td>
</tr>
</table>
<h1><a href=../2d_examples/DrawImageRect.bb>Example</a></h1>
<table>
<tr>
<td>
; DrawImageRect Example
<br />
<br />
; Turn on graphics mode
<br />
Graphics 640,480,16
<br />
<br />
; Create new empty graphic to store our circle in
<br />
gfxCircle=CreateImage(50,50)
<br />
<br />
; Draw the circle image
<br />
; Set drawing operations to point to our new empty graphic
This is handy if you are doing something like revealing part of a screen when the player uncovers something (think QIX). You could load the 'picture' into an image, then when the player clears a rectangular region, you could paste that portion of the final image onto the playfield. If you want to draw the image portion with no transparency or mask, use <a href='DrawBlockRect.htm'>DrawBlockRect</a> instead.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; DrawImageRect Example<br>
<br />
SetBuffer ImageBuffer(gfxCircle)
; Turn on graphics mode<br>
Graphics 640,480,16<br>
<br>
; Create new empty graphic to store our circle in<br>
gfxCircle=CreateImage(50,50)<br>
<br>
; Draw the circle image<br>
; Set drawing operations to point to our new empty graphic<br>
SetBuffer ImageBuffer(gfxCircle)<br>
Color 255,0,0<br>
; Note the extra space between the circle and the edge of the graphic<br>
Oval 10,10,30,30,1<br>
SetBuffer FrontBuffer()<br>
<br>
<br>
; Let's draw portions of the circle randomly<br>
While Not KeyHit(1)<br>
; We take random sized portions of the circle and put them<br>
; at a random location ... wash, rinse, and repeat<br>
DrawImageRect gfxCircle,Rnd(640),Rnd(480),0,0,Rnd(50),Rnd(50),0<br>
Delay 100<br>
Wend<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Color 255,0,0
+51 -16
View File
@@ -1,19 +1,54 @@
<html><head><title>Command: EOF </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;EOF (filehandle|stream)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Checks to see if the End Of File (or stream) has been reached.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>filehandle|stream = a valid variable set with the OpenFile, ReadFile command, or OpenTCPStream (v1.52+)</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Checks to see if the End of File of an opened file or stream has been reached. Use this to determine if you should continue to pull more information from a file/stream or not. Use this to read a text file of unknown length (say a README.TXT) and display it. See example.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Eof (filehandle/stream)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
filehandle/stream = a valid variable set with the OpenFile, ReadFile command, or OpenTCPStream (v1.52+)
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Checks to see if the End of File of an opened file or stream has been reached. Use this to determine if you should continue to pull more information from a file/stream or not. Use this to read a text file of unknown length (say a README.TXT) and display it. See example.
<br />
<br />
Eof returns 1 if eof has been reached or, in the case of a TCP stream, the stream has been 'nicely' closed.
<br />
<br />
Eof returns -1 if something has gone wrong during stream processing.
<br />
<br />
Streams can only be used in Blitz Basic v1.52 or greater.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Eof.bb>Example</a></h1>
<table>
<tr>
<td>
; Eof sample
<br />
<br />
file$="c:autoexec.bat"
<br />
<br />
Eof returns 1 if eof has been reached or, in the case of a TCP stream, the stream has been 'nicely' closed.<br>
filein = ReadFile(file$)
<br />
Eof returns -1 if something has gone wrong during stream processing.<br><br>
Streams can only be used in Blitz Basic v1.52 or greater.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; EOF sample<br>
<br>
file$="c:\autoexec.bat"<br>
<br>
filein = ReadFile(file$)<br>
<br>
Print "Here is your Autoexec.bat file ..."<br>
<br>
; Loop this until we reach the end of file<br>
While Not Eof(filein)<br>
Print ReadLine$(filein)<br>
Wend<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+44 -8
View File
@@ -1,9 +1,45 @@
<html><head><title>Command: Each </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Each type_variable&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Used to iterate through a collection of TYPE objects.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>type_variable = A previously declared TYPE object</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you haven't read up on the <a href='TYPE.htm'>TYPE</a>
command, you might want to do so before continuing.</p>
<p>The For .. Each loop allows you to walk through each object in the Type collection.
This is perfect for updating a large group of objects (such as a group of alien
invaders). Do look over the Type command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Move them all over 1 (like the description example from TYPE command)</p>
<p>For room.chair = Each chair<br>
room\x = room\x + 1<br>
Next<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Each type_variable</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
type_variable = A previously declared TYPE object
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you haven't read up on the TYPE command, you might want to do so before continuing.
<br />
<br />
The For .. Each loop allows you to walk through each object in the Type collection. This is perfect for updating a large group of objects (such as a group of alien invaders). Do look over the Type command.
<br>
<br>
See also: <a class=small href=Type.htm>Type</a>, <a class=small href=New.htm>New</a>, <a class=small href=Before.htm>Before</a>, <a class=small href=After.htm>After</a>, <a class=small href=First.htm>First</a>, <a class=small href=Last.htm>Last</a>, <a class=small href=Insert.htm>Insert</a>, <a class=small href=Delete.htm>Delete</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Each.bb>Example</a></h1>
<table>
<tr>
<td>
; Move them all over 1 (like the description example from TYPE command)
<br />
<br />
For room.chair = Each chair
<br />
room\x = room\x + 1
<br />
Next
</td>
+50 -15
View File
@@ -1,20 +1,55 @@
<html><head><title>Command: Else If </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Else If &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Performs an additional IF condition check during an IF ... THEN conditional structure.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>During a standard <a href='IF.htm'>IF</a> ... <a href='THEN.htm'>THEN</a> conditional structure, you may wish to check another condition if the original condition fails. This 'nested IF' situation can get WAY out of hand, and once you have more than two nested conditionals, you should consider a <a href='SELECT.htm'>SELECT</a>/<a href='CASE.htm'>CASE</a> structure. See the example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; ELSE IF Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Else If</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
During a standard IF ... THEN conditional structure, you may wish to check another condition if the original condition fails. This 'nested IF' situation can get WAY out of hand, and once you have more than two nested conditionals, you should consider a SELECT/CASE structure. See the example.
<br>
; Input the user's name<br>
name$=Input$("What is your name? ")<br>
<br>
; Doesn't the person's name equal SHANE?<br>
If name$ = "Shane" Then<br>
See also: <a class=small href=ElseIf.htm>ElseIf</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Else If.bb>Example</a></h1>
<table>
<tr>
<td>
; ELSEIF Example
<br />
<br />
; Input the user's name
<br />
name$=Input$("What is your name? ")
<br />
<br />
; Doesn't the person's name equal SHANE?
<br />
If name$ = "Shane" Then
<br />
Print "You are recognized, Shane! Welcome!"
<br />
<br />
ElseIf name$="Ron" Then
<br />
Print "You are recognized too, Ron! Welcome!"
Print "You are recognized, Shane! Welcome!"<br>
<br />
Else If name$="Ron" then<br>
Print "You are recognized too, Ron! Welcome!"<br>
<br>
Else<br>
Print "Sorry, you don't belong here!"<br>
<br>
; End of the condition checking<br>
End If<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Else
+44 -8
View File
@@ -1,11 +1,47 @@
<html><head><title>Command: Else </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Else &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Begins the code to be executed in the event the IF conditional fails.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>There are times during an <a href='IF.htm'>IF</a> ... <a href='THEN.htm'>THEN</a> conditional that you will want code to execute in the event that the conditional is NOT met. The ELSE command begins that block of code, and is terminated by the <a href='END IF.htm'>END IF</a> command. See example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; ELSE example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Else</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
There are times during an IF ... THEN conditional that you will want code to execute in the event that the conditional is NOT met. The ELSE command begins that block of code, and is terminated by the END IF command. See example.
<br>
name$=Input$("What is your name?")<br>
<br>
If name$="Shane" then <br>
Print "Hello Shane!"<br>
Else<br>
Print "I have NO clue who you are!"<br>
End If<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
See also: <a class=small href=If.htm>If</a>, <a class=small href=Then.htm>Then</a>, <a class=small href=ElseIf.htm>ElseIf</a>, <a class=small href=EndIf.htm>EndIf</a>, <a class=small href=Select.htm>Select</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Else.bb>Example</a></h1>
<table>
<tr>
<td>
; ELSE example
<br />
<br />
name$=Input$("What is your name?")
<br />
<br />
If name$="Shane" then
<br />
Print "Hello Shane!"
<br />
Else
<br />
Print "I have NO clue who you are!"
<br />
End If
+54 -1
View File
@@ -1,2 +1,55 @@
<html><head><title>Command: ElseIf </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ElseIf &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Alternate command for the END IF command, it performs an additional IF condition check during an IF ... THEN conditional structure.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>During a standard <a href='IF.htm'>IF</a> ... <a href='THEN.htm'>THEN</a> conditional structure, you may wish to check another condition if the original condition fails. This 'nested IF' situation can get WAY out of hand, and once you have more than two nested conditionals, you should consider a <a href='SELECT.htm'>SELECT</a>/<a href='CASE.htm'>CASE</a> structure. See the example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; ELSEIF Example<br><br>; Input the user's name<br>name$=Input$("What is your name? ")<br><br>; Doesn't the person's name equal SHANE?<br>If name$ = "Shane" Then<br><br>Print "You are recognized, Shane! Welcome!"<br><br>ElseIf name$="Ron" then<br>Print "You are recognized too, Ron! Welcome!"<br><br>Else<br>Print "Sorry, you don't belong here!"<br><br>; End of the condition checking<br>End If<br><br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ElseIf</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
During a standard IF ... THEN conditional structure, you may wish to check another condition if the original condition fails. This 'nested IF' situation can get WAY out of hand, and once you have more than two nested conditionals, you should consider aSELECT/CASE structure. See the example.
<br>
<br>
See also: <a class=small href=If.htm>If</a>, <a class=small href=Then.htm>Then</a>, <a class=small href=Else.htm>Else</a>, <a class=small href=ElseIf.htm>ElseIf</a>, <a class=small href=EndIf.htm>EndIf</a>, <a class=small href=Select.htm>Select</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ElseIf.bb>Example</a></h1>
<table>
<tr>
<td>
; ELSEIF Example
<br />
<br />
; Input the user's name
<br />
name$=Input$("What is your name? ")
<br />
<br />
; Doesn't the person's name equal SHANE?
<br />
If name$ = "Shane" Then
<br />
Print "You are recognized, Shane! Welcome!"
<br />
<br />
ElseIf name$="Ron" Then
<br />
Print "You are recognized too, Ron! Welcome!"
<br />
<br />
Else
@@ -1,16 +1,50 @@
<html><head><title>Command: End Function </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;End Function &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Denotes the end of a Function structure.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This line terminates a <a href='FUNCTION.htm'>FUNCTION</a> structure. Upon reaching this line, Blitz will branch program execution to the next command following the original call to the function. See the <a href='FUNCTION.htm'>FUNCTION</a> command for more information.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; End Function Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>End Function</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This line terminates a FUNCTION structure. Upon reaching this line, Blitz will branch program execution to the next command following the original call to the function. See the FUNCTION command for more information.
</td>
</tr>
</table>
<h1><a href=../2d_examples/End Function.bb>Example</a></h1>
<table>
<tr>
<td>
; End Function Example
<br />
<br />
; Get the user's name
<br />
name$=Input$("Enter Your Name:")
<br />
<br />
; Call a function to print how many letters the name has
<br />
numletters(name$);
<br />
<br />
;The program basically ends here, because functions don't run unless called.
<br />
; Get the user's name<br>
name$=Input$("Enter Your Name:")<br>
<br />
; The actual function
; Call a function to print how many letters the name has<br>
numletters(name$);<br>
<br>
;The program basically ends here, because functions don't run unless called.<br>
<br>
; The actual function<br>
Function numletters(passedname$)<br>
Print "Your name has " + Len(passedname$) + " letters in it."<br>
End Function<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Function numletters(passedname$)
+49 -15
View File
@@ -1,18 +1,52 @@
<html><head><title>Command: End If </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;End If &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Closing element of an IF/THEN condition checking structure.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>END IF signals the end of an IF THEN condition check. See <a href='IF.htm'>IF</a> for more information. You can also use ENDIF as a single word command - it functions identically.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; IF THEN Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>End If</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
END IF signals the end of an IF THEN condition check. See IF for more information. You can also use ENDIF as a single word command - it functions identically.
</td>
</tr>
</table>
<h1><a href=../2d_examples/End If.bb>Example</a></h1>
<table>
<tr>
<td>
; IF THEN Example
<br />
<br />
; Input the user's name
<br />
name$=Input$("What is your name? ")
<br />
<br />
; Doesn't the person's name equal SHANE?
<br />
If name$ = "Shane" Then
<br />
<br />
Print "You are recognized, Shane! Welcome!"
<br />
<br />
Else
; Input the user's name<br>
name$=Input$("What is your name? ")<br>
<br />
; Doesn't the person's name equal SHANE?<br>
If name$ = "Shane" Then<br>
<br>
Print "You are recognized, Shane! Welcome!"<br>
<br>
Else<br>
<br>
Print "Sorry, you don't belong here!"<br>
<br>
; End of the condition checking<br>
End If<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Print "Sorry, you don't belong here!"
@@ -1,27 +1,61 @@
<html><head><title>Command: End Select </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;End Select &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>The closing command in a SELECT structure.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command ends the <a href='SELECT.htm'>SELECT</a> structure. If you are using <a href='DEFAULT.htm'>DEFAULT</a> commands, this is the ending point of that command set's execution. See <a href='SELECT.htm'>SELECT</a>, <a href='CASE.htm'>CASE</a>, and <a href='DEFAULT.htm'>DEFAULT</a> for more information.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; SELECT/CASE/DEFAULT/END SELECT Example<br>
; Assign a random number 1-10<br>
mission=Rnd(1,10)<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>End Select</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command ends the SELECT structure. If you are using DEFAULT commands, this is the ending point of that command set's execution. See SELECT, CASE, and DEFAULT for more information.
</td>
</tr>
</table>
<h1><a href=../2d_examples/End Select.bb>Example</a></h1>
<table>
<tr>
<td>
; SELECT/CASE/DEFAULT/END SELECT Example
<br />
; Assign a random number 1-10
<br />
mission=Rnd(1,10)
<br />
<br />
; Start the selection process based on the value of 'mission' variable
<br />
Select mission
<br />
<br />
; Is mission = 1?
<br />
Case 1
<br />
Print "Your mission is to get the plutonium and get out alive!"
<br />
<br />
; Is mission = 2?
<br />
Case 2
<br />
Print "Your mission is to destroy all enemies!"
<br />
<br />
; Start the selection process based on the value of 'mission' variable<br>
Select mission<br>
; Is mission = 3?
<br />
; Is mission = 1?<br>
Case 1<br>
Print "Your mission is to get the plutonium and get out alive!"<br>
<br>
; Is mission = 2?<br>
Case 2<br>
Print "Your mission is to destroy all enemies!"<br>
<br>
; Is mission = 3?<br>
Case 3 <br>
Print "Your mission is to steal the enemy building plans!"<br>
<br>
; What do do if none of the cases match the value of mission<br>
Default <br>
Print "Missions 4-10 are not available yet!"<br>
<br>
; End the selection process<br>
End Select<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Case 3
<br />
@@ -1,12 +1,45 @@
<html><head><title>Command: End Type </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;End Type &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>The last command of the TYPE ... END TYPE object creation.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you haven't read up on the <a href='TYPE.htm'>TYPE</a>
command, you might want to do so before continuing.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>End Type</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you haven't read up on the TYPE command, you might want to do so before continuing.
<br />
<br />
After assigning all the Field variables in your Type object, use this to finish the creation of the Type.
</td>
</tr>
</table>
<h1><a href=../2d_examples/End Type.bb>Example</a></h1>
<table>
<tr>
<td>
; Define the CHAIR Type
<br />
<br />
Type CHAIR
<br />
Field X
<br />
Field Y
After assigning all the <a href='Field.htm'>Field</a> variables in your Type object, use this to finish the creation of the Type.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Define the CHAIR Type<br>
<br />
Field HEIGHT
Type CHAIR<br>
Field X<br>
Field Y<br>
Field HEIGHT<br>
End Type<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
End Type
+39 -3
View File
@@ -1,5 +1,41 @@
<html><head><title>Command: End </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;End &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Stops the program execution and exits the program.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to stop your program running. You will be returned to the editor if running from there, or the program will completely exit if running a compiled EXE version.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; If the game is over, then quit<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>End</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Use this command to stop your program running. You will be returned to the editor if running from there, or the program will completely exit if running a compiled EXE version.
<br>
if gameOver=1 then End<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br>
See also: <a class=small href=Stop.htm>Stop</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/End.bb>Example</a></h1>
<table>
<tr>
<td>
; If the game is over, then quit
<br />
<br />
if gameOver=1 then End
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
@@ -1,22 +1,59 @@
<html><head><title>Command: EndGraphics </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;EndGraphics &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Ends the graphics mode.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command ends the graphics mode, and puts Blitz back into 'text' mode (for lack of a better term).</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; End Graphics Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>EndGraphics</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Returns a program to a non-Graphics mode state. This is the same state that a program starts up in, before the Graphics command is used.
<br />
; Enter graphics mode<br>
Graphics 640,480,16<br>
<br />
; Print hello 10 times on the graphic screen<br>
For t = 1 To 10<br>
Print "Hello"<br>
Next<br>
One possible use for EndGraphics is to switch between full-screen and windowed states.
<br>
<br>
See also: <a class=small href=Graphics.htm>Graphics</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/EndGraphics.bb>Example</a></h1>
<table>
<tr>
<td>
Graphics 640,480,0,1
<br />
SetBuffer BackBuffer()
<br />
<br />
Text 0,0,"EndGraphics Example Stage 1/2"
<br />
Text 0,20,"Currently in Graphics mode"
<br />
Text 0,40,"Press a key to deactive Graphics mode with EndGraphics command"
<br />
<br />
Flip
<br />
<br />
WaitKey()
<br />
; Wait for a left mouse button<br>
While Not MouseHit(1)<br>
Wend <br>
<br />
; End the graphics mode<br>
EndGraphics <br>
<br>
; Print again, this time to the text screen<br>
For t = 1 To 10<br>
Print "There"<br>
Next<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
EndGraphics
<br />
+49 -13
View File
@@ -1,18 +1,54 @@
<html><head><title>Command: EndIF </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;EndIF &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Another acceptable version of the END IF statement</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Terminates an <a href='IF.htm'>IF</a> ... <a href='THEN.htm'>THEN</a> condition structure. See <a href='END IF.htm'>END IF</a> for more information.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; IF THEN Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>EndIf</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Terminates an IF ... THEN condition structure. See END IF for more information.
<br>
; Input the user's name<br>
name$=Input$("What is your name? ")<br>
<br>
; Doesn't the person's name equal SHANE?<br>
If name$ = "Shane" Then<br>
See also: <a class=small href=If.htm>If</a>, <a class=small href=Then.htm>Then</a>, <a class=small href=Else.htm>Else</a>, <a class=small href=ElseIf.htm>ElseIf</a>, <a class=small href=Select.htm>Select</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/EndIf.bb>Example</a></h1>
<table>
<tr>
<td>
; IF THEN Example
<br />
<br />
; Input the user's name
<br />
name$=Input$("What is your name? ")
<br />
<br />
; Doesn't the person's name equal SHANE?
<br />
If name$ = "Shane" Then
<br />
<br />
Print "You are recognized, Shane! Welcome!"
<br />
<br />
Print "You are recognized, Shane! Welcome!"<br>
Else
<br />
Else<br>
<br>
Print "Sorry, you don't belong here!"<br>
<br>
; End of the condition checking<br>
EndIf<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+55 -17
View File
@@ -1,20 +1,58 @@
<html><head><title>Command: ExecFile </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;ExecFile (filename$)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Runs an external executable program from within a Blitz program.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>filename$ = any valid variable or path/filename to the executable program</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to halt execution of your program and run an external program.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>ExecFile( file$ )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
file$ - the file to be executed
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
The usefulness of this command is really mostly for calling some system level command, launching a browser, etc.
<br />
<br />
Note: This command uses ShellExecute to allow you to 'open' any file (like a .doc or .txt) file with its default associated program.
<br />
<br />
Also: if the filename path has spaces in it you may will need to chenge the call like so:
<br />
<br />
ExecFile (Chr$(34)+"example file name.exe"+Chr$(34))
<br />
<br />
This adds the " (quotation mark) character to the beginning and end of the text string.
</td>
</tr>
</table>
<h1><a href=../2d_examples/ExecFile.bb>Example</a></h1>
<table>
<tr>
<td>
; ExecFile sample - RUN THIS WINDOWED!
<br />
Graphics 320,240,0,2
<br />
<br />
filename$ = Chr$(34) + "calc.exe" + Chr$(34)
<br />
<br />
Text 5,5, "press any key to run CALC.EXE!"
The usefulness of this command is really mostly for calling some system level command, launching a browser, etc. Without the ability to playback a movie (for cutscenes, etc) I would think the most useful part of this is command would be calling a self-contained .exe movie (a la BLINK) to play as an intro, then when its completed, return to your program for continued execution.<br>
<br />
Flip
Note: This command uses ShellExecute to allow you to 'open' any file (like a .doc or .txt) file with its default associated program.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; ExecFile sample - RUN THIS WINDOWED!<br>
; Win9x users will need to change location of calc.exe<br>
<br>
filename$="c:\winnt\system32\calc.exe"<br>
<br>
Print "Press any key to run CALC.EXE!"<br>
<br>
WaitKey()<br>
<br>
ExecFile(filename$)<br>
<br>
Print "Press any key to quit."<br>
<br>
WaitKey()<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
WaitKey
+42 -5
View File
@@ -1,7 +1,44 @@
<html><head><title>Command: Exit </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Exit &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Exits a loop prematurely.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command will allow you to leave a <a href='For.htm'>For</a> .. <a href='Next.htm'>Next</a> loop as well as many other types of loops prematurely (assuming a condition was met or other planned event). It exits the IMMEDIATE loop - you'll need one for each 'nest' of loops you want to exit from.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; EXIT Command sample<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Exit</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command will allow you to leave a For .. Next loop as well as many other types of loops prematurely (assuming a condition was met or other planned event). It exits the IMMEDIATE loop - you'll need one for each 'nest' of loops you want to exit from.
<br>
For t = 1 To 100<br>
Print t<br>
If t = 50 Then Exit<br>
Next<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br>
See also: <a class=small href=For.htm>For</a>, <a class=small href=While.htm>While</a>, <a class=small href=Repeat.htm>Repeat</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Exit.bb>Example</a></h1>
<table>
<tr>
<td>
; EXIT Command sample
<br />
<br />
For t = 1 To 100
<br />
Print t
<br />
If t = 50 Then Exit
<br />
Next
</td>
</tr>
</table>
+65 -5
View File
@@ -1,6 +1,66 @@
<html><head><title>Command: Exp </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Exp (number)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the base of the natural system of logarithms e, raised to the power of the supplied argument.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>number=float or integer<br></td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Exp() is the exponential function. Logarithms to the base <i>e</i> are called the Natural or Napierian logarithms. The Exp() and <a href='Log.htm'>Log</a> functions use the transcendental number <i>e</i> as a base (approx 2.718). Exp() is the inverse of the antilogarithm <a href='Log.htm'>Log</a> function.
See also: <a href='Log.htm'>Log</a> <a href='Log10.htm'>Log10</a></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; To find the value of e<br>
print Exp(1) ; i.e. e^1, returns 2.718281<br>
; To find the value of e^5<br>
print Exp(5) ; returns 148.413162<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Exp# ( x# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
x = any number.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This is e^x where e = 2.71828...
<br />
<br />
For the curious, e is defined by the infinite sum:
<br />
<br />
2 + 1/(2) + 1/(2*3) + 1/(2*3*4) + 1/(2*3*4*5) + ...
<br />
<br />
See also Log()
</td>
</tr>
</table>
<h1><a href=../2d_examples/Exp.bb>Example</a></h1>
<table>
<tr>
<td>
; Exp example
<br />
<br />
; Exp(x) is the same as e^x.
<br />
<br />
; Actually, due to the approximate nature of floating point arithmetic
<br />
; these will not be exactly equal. But in the following example
<br />
; the difference is so small you can't see it.
<br />
<br />
e# = 2.71828182845905 ; over-specified, might help and can't hurt.
<br />
<br />
x# = .125 ; = 1/8
<br />
<br />
+52 -16
View File
@@ -1,21 +1,57 @@
<html><head><title>Command: False </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;False &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>A boolean expression used in comparisons. Actually returns a value of 0.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>FALSE is a keyword to denote a negative result in a conditional statement. Often times, FALSE is implied and doesn't need to be directly referenced - or a <a href='NOT.htm'>NOT</a> command is used in the comparison. FALSE can also be used as a <a href='RETURN.htm'>RETURN</a> value from a <a href='FUNCTION.htm'>FUNCTION</a>. Also see the <a href='TRUE.htm'>TRUE</a> command. See the example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; FALSE example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>False</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
FALSE is a keyword to denote a negative result in a conditional statement. Often times, FALSE is implied and doesn't need to be directly referenced - or a NOT command is used in the comparison. FALSE can also be used as a RETURN value from aFUNCTION. Also see the TRUE command. See the example.
<br>
; Assign test a random number of 0 or 1<br>
test= Rnd(0,1)<br>
<br>
; FALSE is implied because of the NOT<br>
If not test=1 Then<br>
Print "Test was valued at 0"<br>
End If<br>
See also: <a class=small href=True.htm>True</a>, <a class=small href=If.htm>If</a>, <a class=small href=Select.htm>Select</a>, <a class=small href=While.htm>While</a>, <a class=small href=Repeat.htm>Repeat</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/False.bb>Example</a></h1>
<table>
<tr>
<td>
; FALSE example
<br />
<br />
; Assign test a random number of 0 or 1
<br />
test= Rnd(0,1)
<br />
<br />
; FALSE is implied because of the NOT
<br />
If not test=1 Then
<br />
Print "Test was valued at 0"
<br />
End If
<br />
<br />
; Let's set test to be false
<br />
test=False
; Let's set test to be false<br>
test=False<br>
<br />
; Pointlessly test it<br>
If test=False Then<br>
Print "Test is false"<br>
else<br>
print "Test is true"<br>
End If<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
; Pointlessly test it
+62 -26
View File
@@ -1,28 +1,64 @@
<html><head><title>Command: Field </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Field variable&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Assigns a variable for use into a TYPE object structure.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>variable = any legal variable</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you haven't read up on the <a href='TYPE.htm'>TYPE</a>
command, you might want to do so before continuing.</p>
<p>When you define a custom Type, you need to assign some variables to track within
in. Using the Field command within the Type .. <a href='End
Type.htm'>End
Type</a> commands, you set a variable that can be used for EACH object created
with the <a href='NEW.htm'>NEW</a>
command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Define the CHAIR Type<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Field variable</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
variable = any legal variable
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you haven't read up on the TYPE command, you might want to do so before continuing.
<br />
Type CHAIR<br>
Field X<br>
Field Y<br>
Field HEIGHT<br>
End Type</p>
<p>; Create 100 new chairs using FOR ... NEXT using the collection name of ROOM</p>
<p>For tempx = 1 to 10<br>
For tempy = 1 to 10<br>
room.chair = New Chair<br>
room\x = tempx<br>
room\y = tempy<br>
room\height = Rnd(0,10) ; set a random height 0 to 10<br>
Next<br>
Next</p>
<p>; Move them all over 1 (like the description example from TYPE command)</p>
<p>For room.chair = Each chair<br>
room\x = room\x + 1<br>
Next<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
When you define a custom Type, you need to assign some variables to track within in. Using the Field command within the Type .. End Type commands, you set a variable that can be used for EACH object created with the NEW command.
<br>
<br>
See also: <a class=small href=Type.htm>Type</a>, <a class=small href=End Type.htm>End Type</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Field.bb>Example</a></h1>
<table>
<tr>
<td>
; Define the CHAIR Type
<br />
<br />
Type CHAIR
<br />
Field X
<br />
Field Y
<br />
Field HEIGHT
<br />
End Type
<br />
<br />
; Create 100 new chairs using FOR ... NEXT using the collection name of ROOM
<br />
<br />
For tempx = 1 to 10
<br />
For tempy = 1 to 10
<br />
room.chair = New Chair
<br />
room\x = tempx
<br />
room\y = tempy
+95 -66
View File
@@ -1,69 +1,98 @@
<html><head><title>Command: FilePos </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FilePos (filehandle)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the current position within a file that is being read, written or modified.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>filehandle = the variable returned by the Readfile WriteFile or OpenFile when the file was opened. The value returned is the offset from the start of the file. ( 0 = Start of
the file )</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command returns the current position within a file that is being processed following ReadFile, WriteFile or OpenFile. The returned integer is the offsets in bytes from the start of the file to the current read/write position. Note, this is zero when pointing to the first byte of the file.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FilePos (filehandle)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
filehandle = the variable returned by the Readfile WriteFile or OpenFile when the file was opened. The value returned is the offset from the start of the file. ( 0 = Start of the file )
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command returns the current position within a file that is being processed following ReadFile, WriteFile or OpenFile. The returned integer is the offsets in bytes from the start of the file to the current read/write position. Note, this is zero when pointing to the first byte of the file.
<br />
<br />
By using FilePos and SeekFile the position within the file that is being read or written can be determined and also changed. This allows a file to be read and updated without having to make a new copy of the file or working through the whole file sequentially. This could be useful if you have created a database file and you want to find and update just a few records within it. It is also possible to create an index file that contains pointers to where each record starts in a data file.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FilePos.bb>Example</a></h1>
<table>
<tr>
<td>
; Changing part of a file using OpenFile, SeekFile, FilePos
<br />
; note FilePos is used in the SearchFile function at the end of this example
<br />
<br />
; Open/create a file to Write
<br />
fileout = WriteFile("mydata.dat")
<br />
<br />
; Write the information to the file
<br />
WriteInt( fileout, 1 )
<br />
WriteInt( fileout, 2 )
<br />
WriteInt( fileout, 3 )
<br />
WriteInt( fileout, 4 )
<br />
WriteInt( fileout, 5 )
<br />
<br />
; Close the file
<br />
CloseFile( fileout )
<br />
<br />
DisplayFile( "The file as originally written", mydata.dat" )
<br />
Position = SearchFile( 4 , "mydata.dat" )
<br />
Write "Value 4 was found "
<br />
Write Position
<br />
Print " bytes from the start."
<br />
Print
<br />
<br />
; Open the file and change the value 3 to 9999
<br />
<br />
file = OpenFile("mydata.dat")
<br />
SeekFile( file, Position ) ; Move to the found location
<br />
WriteInt( file, 9999 ) ; Replace the original value with 9999
<br />
CloseFile( file )
<br />
<br />
<br />
By using FilePos and SeekFile the position within the file that is being read or written can be determined and also changed. This allows a file to be read and updated without having to make a new copy of the file or working through the whole file sequentially. This could be useful if you have
created a database file and you want to find and update just a few records within it. It is also possible to create an index file that contains pointers to where each record starts in a data file.<br>
DisplayFile( "The file after being modified", "mydata.dat" )
<br />
See also:<br>
<a href='ReadByte.htm'>ReadByte</a>, <a href='ReadShort.htm'>ReadShort</a>, <a href='ReadInt.htm'>ReadInt</a>, <a href='ReadFloat.htm'>ReadFloat</a>, <a href='ReadString$.htm'>ReadString$</a>, <a href='ReadLine$.htm'>ReadLine$</a>, <a href='WriteByte.htm'>WriteByte</a>, <a href='WriteShort.htm'>WriteShort</a>, <a href='WriteInt.htm'>WriteInt</a>, <a href='WriteFloat.htm'>WriteFloat</a>, <a href='WriteShort.htm'>WriteShort</a>, <a href='WriteString.htm'>WriteString</a>, <a href='WriteLine.htm'>WriteLine</a>, <a href='ReadFile.htm'>ReadFile</a>, <a href='WriteFile.htm'>WriteFile</a>, <a href='OpenFile.htm'>OpenFile</a>, <a href='CloseFile.htm'>CloseFile</a>, <a href='Eof.htm'>Eof</a>, <a href='FileType.htm'>FileType</a>, <a href='FilePos.htm'>FilePos</a>, <a href='SeekFile.htm'>SeekFile</a></td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Changing part of a file using OpenFile, SeekFile, FilePos<br>
; note FilePos is used in the SearchFile function at the end of this example<br>
<br>
; Open/create a file to Write<br>
fileout = WriteFile("mydata.dat")<br>
<br>
; Write the information to the file<br>
WriteInt( fileout, 1 )<br>
WriteInt( fileout, 2 )<br>
WriteInt( fileout, 3 )<br>
WriteInt( fileout, 4 )<br>
WriteInt( fileout, 5 )<br>
<br>
; Close the file<br>
CloseFile( fileout )<br>
<br>
DisplayFile( "The file as originally written", mydata.dat" )<br>
Position = SearchFile( 4 , "mydata.dat" )<br>
Write "Value 4 was found "<br>
Write Position<br>
Print " bytes from the start."<br>
Print<br>
<br>
; Open the file and change the value 3 to 9999<br>
<br>
file = OpenFile("mydata.dat")<br>
SeekFile( file, Position ) ; Move to the found location<br>
WriteInt( file, 9999 ) ; Replace the original value with 9999<br>
CloseFile( file )<br>
<br>
<br>
DisplayFile( "The file after being modified", "mydata.dat" )<br>
WaitKey()<br>
End ; End of program<br>
<br>
; **** Function Definitions follow ****<br>
<br>
; Read the file and print it<br>
Function DisplayFile( Tittle$, Filename$ )<br>
Print tittle$<br>
file = ReadFile( Filename$ )<br>
While Not Eof( file )<br>
Number = ReadInt( file )<br>
Print Number<br>
Wend<br>
CloseFile( file )<br>
Print<br>
End Function<br>
<br>
; Search a file of integers for the Wanted data value<br>
; Note the need to subtract 4 from the location since having read it<br>
; we are now pointing at the next Integer also Return() was placed<br>
; after closing the file so it is closed properly<br>
Function SearchFile( Wanted, Filename$ )<br>
file = ReadFile( Filename$ )<br>
While Not Eof( file )<br>
If ReadInt( file ) = Wanted Then Location = FilePos( file ) - 4<br>
Wend<br>
CloseFile( file )<br>
Return( Location )<br>
End Function<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
WaitKey()
<br />
@@ -1,10 +1,44 @@
<html><head><title>Command: FileSize </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FileSize (filename$)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the size of the requested file - in bytes.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>filename$ = any valid variable with path/filename</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Often it will be useful to return the size of a file. File size is important for copying, reading, and other file evolutions.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Windows 9x users will need to change location of calc.exe<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FileSize (filename$)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
filename$ = any valid variable with path/filename
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Often it will be useful to return the size of a file. File size is important for copying, reading, and other file evolutions.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FileSize.bb>Example</a></h1>
<table>
<tr>
<td>
; Windows 2000/XP users will need to change location of calc.exe
<br />
<br />
filename$="c:\windows\calc.exe"
<br />
<br />
Print "The size of the file is: " + FileSize(filename$)
<br />
<br />
Print "Press any key to quit."
filename$="c:\winnt\system32\calc.exe"<br>
<br />
Print "The size of the file is: " + FileSize(filename$)<br>
<br>
Print "Press any key to quit."<br>
<br>
WaitKey()<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
WaitKey()
+49 -15
View File
@@ -1,18 +1,52 @@
<html><head><title>Command: FileType </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FileType (filename$)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Checks to see if the designated filename exists or is a directory.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>filename$ = any valid variable with path/filename</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command checks the filename you pass and determines if it exists and whether or not it is a valid filename or if it is a directory. Here are the values it returns:<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FileType (filename$)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
filename$ = any valid variable with path/filename
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command checks the filename you pass and determines if it exists and whether or not it is a valid filename or if it is a directory. Here are the values it returns:
<br />
<br />
1 = The filename exists
<br />
0 = The filename doesn't exist
<br />
2 = The filename is not a file - but a directory
<br />
<br />
Use this to validate that a file exists before you do something to it.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FileType.bb>Example</a></h1>
<table>
<tr>
<td>
; Windows 9x users will need to change location of calc.exe
<br />
<br />
filename$="c:winntsystem32calc.exe"
1 = The filename exists<br>
0 = The filename doesn't exist<br>
2 = The filename is not a file - but a directory<br>
<br />
Use this to validate that a file exists before you do something to it.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Windows 9x users will need to change location of calc.exe<br>
<br>
filename$="c:\winnt\system32\calc.exe"<br>
<br>
if fileType(filename$)=1 then Print "The file exists!"<br>
if fileType(filename$)=0 then Print "File not found!"<br>
if fileType(filename$)=2 then Print "This is a directory!"<br>
<br>
Print "Press any key to quit."<br>
<br>
WaitKey()<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
if fileType(filename$)=1 then Print "The file exists!"
+88 -42
View File
@@ -1,43 +1,89 @@
<html><head><title>Command: First </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;First type_variable&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Move the Type object pointer to the first object in the collection.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>type_variable = the actual Type name, not the custom Type name</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>If you haven't read up on the <a href='TYPE.htm'>TYPE</a>
command, you might want to do so before continuing.</p>
<p>Use this to assign a custom Type object to the first object in the collection.
See the example.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Define a crafts Type</p>
<p>Type crafts<br>
Field x<br>
Field y<br>
Field dead<br>
Field graphic<br>
End Type</p>
<p>; Create 100 crafts, with the unique name of alien<br>
For t = 1 To 100 <br>
alien.crafts = New crafts<br>
alien\x = Rnd(0,640)<br>
alien\y = Rnd(0,480)<br>
alien\dead = 0<br>
alien\graphic = 1<br>
Next</p>
<p>; Move to the first object<br>
alien.crafts = First crafts</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the next alien object<br>
alien = After alien</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the last alien object<br>
alien.crafts = Last crafts</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic</p>
<p>; move to the second to the last alien object<br>
alien = Before alien</p>
<p>Print alien\x<br>
Print alien\y<br>
Print alien\dead<br>
Print alien\graphic<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>First type_variable</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
type_variable = the actual Type name, not the custom Type name
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
If you haven't read up on the TYPE command, you might want to do so before continuing.
<br />
<br />
Use this to assign a custom Type object to the first object in the collection. See the example.
<br>
<br>
See also: <a class=small href=Type.htm>Type</a>, <a class=small href=New.htm>New</a>, <a class=small href=Before.htm>Before</a>, <a class=small href=After.htm>After</a>, <a class=small href=Last.htm>Last</a>, <a class=small href=Each.htm>Each</a>, <a class=small href=Insert.htm>Insert</a>, <a class=small href=Delete.htm>Delete</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/First.bb>Example</a></h1>
<table>
<tr>
<td>
; Define a crafts Type
<br />
<br />
Type crafts
<br />
Field x
<br />
Field y
<br />
Field dead
<br />
Field graphic
<br />
End Type
<br />
<br />
; Create 100 crafts, with the unique name of alien
<br />
For t = 1 To 100
<br />
alien.crafts = New crafts
<br />
alien\x = Rnd(0,640)
<br />
alien\y = Rnd(0,480)
<br />
alien\dead = 0
<br />
alien\graphic = 1
<br />
Next
<br />
<br />
; Move to the first object
<br />
alien.crafts = First crafts
<br />
<br />
Print alien\x
<br />
Print alien\y
<br />
Print alien\dead
<br />
Print alien\graphic
<br />
<br />
; move to the next alien object
<br />
+61 -16
View File
@@ -1,21 +1,66 @@
<html><head><title>Command: Flip </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Flip [vwait] &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>In a double buffering environment, flips the BackBuffer into view.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>vwait = set to TRUE to wait for vertical blank to finish</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>When you are double buffering (or doing all drawing operations to the <a href='BackBuffer().htm'>BackBuffer()</a>, at some point, after you've drawn all your elements - you will need to 'flip' that Backbuffer into the visible <a href='FrontBuffer().htm'>FrontBuffer()</a> so it can be seen. This command will perform this function. This allows you to draw massive amounts of information quickly, then flip it into view. See BackBuffer() for more info.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Flip/Backbuffer()/Rect Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Flip [vwait]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
vwait = set to FALSE to disable frame syncing, defaults to TRUE which waits for vertical blank to finish
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Flip will switch the FrontBuffer() and BackBuffer().
<br />
<br />
<br />
This command should be used when you are using Double Buffering. Double Buffering is a technique used to ensure that screen updates are not visible to the user. If you draw directly to the FrontBuffer, the display may appear flickery as the updates are drawn directly to the screen. If you draw to the BackBuffer, the updates are drawn in memory. Flip is then used to make the BackBuffer the FrontBuffer, and hence show the updates on screen in one go. At the same time, the FrontBuffer becomes the BackBuffer, allowing you to draw the next screen update on the BackBuffer before Flipping again.
<br />
<br />
; Set Graphics Mode<br>
Graphics 640,480<br>
<br />
; Go double buffering<br>
SetBuffer BackBuffer()<br>
The vwait parameter defines whether or not the graphics card will wait for the vertical blank before flipping the screen. The vertical blank is an event that occurs at the frequency of the monitors refresh rate, and corresponds to the point in time when the last line on the screen has been drawn, and the top line is about to be drawn by the monitor. By waiting until the vertical blank, you ensure smooth updates to the screen as the image being drawn by the monitor will change only once the entire screen has been drawn by the monitor, and the screen is just about to start being refreshed.
<br />
<br />
<br />
However, it is worth noting that this setting applies to the graphics card only, and some graphics cards allow the user to disable the vertical blank event. Therefore, if you rely on Flip alone, the display may be corrupted on certain setups. The VWait command may be useful to you in this respect, as it forces the CPU to wait for the vertical blank (as opposed to the graphics card), and this cannot be disabled. Hence true silky smooth updates are best achieved using "VWait : Flip False".
<br>
<br>
See also: <a class=small href=FrontBuffer.htm>FrontBuffer</a>, <a class=small href=BackBuffer.htm>BackBuffer</a>, <a class=small href=VWait.htm>VWait</a>, <a class=small href=ScanLine.htm>ScanLine</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Flip.bb>Example</a></h1>
<table>
<tr>
<td>
; Flip/Backbuffer()/Rect Example
<br />
<br />
; Set Graphics Mode
<br />
Graphics 640,480
<br />
<br />
; Go double buffering
<br />
SetBuffer BackBuffer()
<br />
; Setup initial locations for the box<br>
box_x = -20 ; negative so it will start OFF screen<br>
box_y = 100<br>
<br />
While Not KeyHit(1)<br>
Cls ; Always clear screen first<br>
Rect box_x,box_y,20,20,1 ; Draw the box in the current x,y location<br>
Flip ; Flip it into view<br>
box_x = box_x + 1 ; Move the box over one pixel<br>
If box_x = 640 Then box_x=-20 ; If it leaves the Right edge, reset its x location<br>
Wend<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
; Setup initial locations for the box
<br />
+65 -7
View File
@@ -1,10 +1,68 @@
<html><head><title>Command: Float </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Float variable/value&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Convert integer value to a floating point number.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>variable/value = integer value or variable</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Use this command to transform an integer value to a floating point value (presumably to perform a floating point related math function on it). Blitz does a good job of adding dissimilar number types, but if you want to play by the rules and/or port code to/from Blitz, remember to convert your integers to floating point before doing math upon them with dissimilar types.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Float example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Float#( value )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
value = a number, or a string which represents a number
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This is the same as Blitz's automatic type conversion.
<br />
So the two commands...
<br />
<br />
y# = value
<br />
y# = Float( value )
<br />
<br />
... do exactly the same thing.
<br />
<br />
If Float is applied to a string it converts as much as possible:
<br />
<br />
Float( "10" ) ...... result is 10.0
<br />
Float( "3junk" ) .. result is 3.0
<br />
Float( "junk3" ) .. result is 0.0
<br />
<br />
In the latter two examples Float() stops converting when it sees "j".
<br />
<br />
The typical use is to force floating point arithmetic:
<br />
a=100<br>
b#=2.5<br>
c#=Float a<br>
<br />
Print b# + c#<br>
<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
y# = 12 / 5 .............. result is 2.0 because 12 / 5 = 2 ( integer division )
+87 -9
View File
@@ -1,12 +1,90 @@
<html><head><title>Command: Floor# </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Floor# (float)&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Rounds a decimal floating variable down to the nearest whole number.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>float=floating point number</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Many times, you will need to round up or down a floating point decimal variable. This command rounds it down to the nearest whole number. Use <a href='Ceil#.htm'>Ceil#</a> to round the number up.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Floor#/Ceil# Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Floor# ( y# )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
y = any number
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Rounds downward, i.e. in the direction of -Infinity.
<br />
<br />
It is a common mistake to think this simply sets everything after the decimal point to zero.
<br />
But this is true only for positive numbers:
<br />
<br />
Floor( 1.75 ) ....... 1.0
<br />
Floor( -1.75 ) .... -2.0
<br />
<br />
See also Ceil and Int for other types of rounding.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Floor.bb>Example</a></h1>
<table>
<tr>
<td>
; Ceil / Floor / Int example, three kinds of rounding.
<br />
<br />
; Move mouse. Escape quits.
<br />
<br />
Graphics 640, 480
<br />
<br />
Const KEY_ESC = 1
<br />
<br />
SetBuffer BackBuffer()
<br />
Origin 320, 240
<br />
<br />
MoveMouse 320, 240 : HidePointer
<br />
<br />
While Not KeyDown( KEY_ESC )
<br />
<br />
Cls
<br />
<br />
my = MouseY() - 240
<br />
Color 100, 100, 0
<br />
; Set a floating point variable<br>
myVal#=0.5<br>
Line -320, my, 319, my
<br />
; Round it up<br>
Print Floor#(myval)<br>
<br>
;Round it down<br>
Print Ceil#(myval)<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,10 +1,45 @@
<html><head><title>Command: FlushJoy </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FlushJoy &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Flushes out all the queued up joystick button presses.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>There are many times when you aren't interested in the dozens of possible joystick button pressed the player might have made before you are checking for one in particular. Or perhaps you want to pause the game and wait for any joystick button to be hit, but you don't want a 'queued' button press bypassing this. Use this command before you specifically want to poll a joystick button hit from the user.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; FlushJoy sample<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FlushJoy</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
There are many times when you aren't interested in the dozens of possible joystick button pressed the player might have made before you are checking for one in particular. Or perhaps you want to pause the game and wait for any joystick button to be hit, but you don't want a 'queued' button press bypassing this. Use this command before you specifically want to poll a joystick button hit from the user.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FlushJoy.bb>Example</a></h1>
<table>
<tr>
<td>
; FlushJoy sample
<br />
<br />
FlushJoy
<br />
<br />
Print "Press a joystick button to exit!"
<br />
<br />
WaitJoy()
<br />
FlushJoy<br>
<br />
Print "Press a joystick button to exit!"<br>
<br>
WaitJoy()<br>
<br>
End<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
End
<br />
@@ -1,4 +1,38 @@
<html><head><title>Command: FlushKeys </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FlushKeys &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Flushes all the currently queued keystrokes.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This command 'resets' or 'empties out' the queue holding the keyboard inputs. Can't make it much easier than that.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; clear all keystrokes from the queue<br>
FlushKeys<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FlushKeys</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This command 'resets' or 'empties out' the queue holding the keyboard inputs. Can't make it much easier than that.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FlushKeys.bb>Example</a></h1>
<table>
<tr>
<td>
; clear all keystrokes from the queue
<br />
FlushKeys
<br />
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
@@ -1,10 +1,45 @@
<html><head><title>Command: FlushMouse </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FlushMouse &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Flushes out all the queued up mouse button presses.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>There are many times when you aren't interested in the dozens of possible mouse button pressed the player might have made before you are checking for one in particular. Or perhaps you want to pause the game and wait for any mouse button to be hit, but you don't want a 'queued' button press bypassing this. Use this command before you specifically want to poll a mouse button hit from the user.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Flushmouse sample<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FlushMouse</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
There are many times when you aren't interested in the dozens of possible mouse button pressed the player might have made before you are checking for one in particular. Or perhaps you want to pause the game and wait for any mouse button to be hit, but you don't want a 'queued' button press bypassing this. Use this command before you specifically want to poll a mouse button hit from the user.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FlushMouse.bb>Example</a></h1>
<table>
<tr>
<td>
; Flushmouse sample
<br />
<br />
FlushMouse
<br />
<br />
Print "Press a mouse button to exit!"
<br />
<br />
WaitMouse()
<br />
FlushMouse<br>
<br />
Print "Press a mouse button to exit!"<br>
<br>
WaitMouse()<br>
<br>
End<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
End
<br />
@@ -1,23 +1,58 @@
<html><head><title>Command: FontHeight() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FontHeight() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the height of the currently selected font.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This returns the height, in pixels, of the currently selected font (using <a href='SetFont.htm'>SetFont</a> - previously loaded with <a href='LoadFont.htm'>LoadFont</a>).</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; FontWidth()/FontHeight example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FontHeight()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This returns the height, in pixels, of the currently selected font (using SetFont - previously loaded with LoadFont).
</td>
</tr>
</table>
<h1><a href=../2d_examples/FontHeight.bb>Example</a></h1>
<table>
<tr>
<td>
; FontWidth()/FontHeight example
<br />
<br />
; enable graphics mode
<br />
Graphics 800,600,16
<br />
<br />
; Set global on font variable
<br />
Global fntArial
<br />
<br />
;Load fonts to a file handle variables
<br />
fntArial=LoadFont("Arial",13,False,False,False)
<br />
<br />
; set the font and print sizes
<br />
SetFont fntArial
<br />
Text 400,0,"The font width of the widest character is:"+ FontWidth(),True,False
; enable graphics mode<br>
Graphics 800,600,16<br>
<br />
Text 400,30,"The height of the font is:"+ FontHeight(),True,False
; Set global on font variable<br>
Global fntArial<br>
<br>
;Load fonts to a file handle variables<br>
fntArial=LoadFont("Arial",13,False,False,False)<br>
<br>
; set the font and print sizes<br>
SetFont fntArial<br>
Text 400,0,"The font width of the widest character is:"+ FontWidth(),True,False<br>
Text 400,30,"The height of the font is:"+ FontHeight(),True,False<br>
<br>
; Standard 'wait for ESC' from user<br>
While Not KeyHit(1)<br>
Wend<br>
<br>
; Clear all the fonts from memory!<br>
FreeFont fntArial<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
@@ -1,23 +1,58 @@
<html><head><title>Command: FontWidth() </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FontWidth() &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Returns the width of the widest character of the currently selected font.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This returns the width, in pixels, of the currently selected font (using <a href='SetFont.htm'>SetFont</a> - previously loaded with <a href='LoadFont.htm'>LoadFont</a>). This command returns the width of the WIDEST character of the font.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; FontWidth()/FontHeight example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FontWidth()</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This returns the width, in pixels, of the currently selected font (using SetFont - previously loaded with LoadFont). This command returns the width of the WIDEST character of the font.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FontWidth.bb>Example</a></h1>
<table>
<tr>
<td>
; FontWidth()/FontHeight example
<br />
<br />
; enable graphics mode
<br />
Graphics 800,600,16
<br />
<br />
; Set global on font variable
<br />
Global fntArial
<br />
<br />
;Load fonts to a file handle variables
<br />
fntArial=LoadFont("Arial",13,False,False,False)
<br />
<br />
; set the font and print sizes
<br />
SetFont fntArial
<br />
Text 400,0,"The font width of the widest character is:"+ FontWidth(),True,False
; enable graphics mode<br>
Graphics 800,600,16<br>
<br />
Text 400,30,"The height of the font is:"+ FontHeight(),True,False
; Set global on font variable<br>
Global fntArial<br>
<br>
;Load fonts to a file handle variables<br>
fntArial=LoadFont("Arial",13,False,False,False)<br>
<br>
; set the font and print sizes<br>
SetFont fntArial<br>
Text 400,0,"The font width of the widest character is:"+ FontWidth(),True,False<br>
Text 400,30,"The height of the font is:"+ FontHeight(),True,False<br>
<br>
; Standard 'wait for ESC' from user<br>
While Not KeyHit(1)<br>
Wend<br>
<br>
; Clear all the fonts from memory!<br>
FreeFont fntArial<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
+47 -11
View File
@@ -1,14 +1,50 @@
<html><head><title>Command: For </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;For variable&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>First command of the FOR ... NEXT loop.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>variable = any valid variable name</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>The first command of the FOR ... NEXT loop, this command is used to assign a variable to a range of numbers in sequence and execute a set of code that many times. Using the <a href='STEP.htm'>STEP</a> command allows you to skip a certain value between each loop of the code.<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>For variable</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
variable = any valid variable name
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
The first command of the FOR ... NEXT loop, this command is used to assign a variable to a range of numbers in sequence and execute a set of code that many times. Using the STEP command allows you to skip a certain value between each loop of the code. Note that the STEP amount cannot be a variable.
<br />
<br />
This is frequently used when a specific pattern of numbers is needed to perform an evolution (moving something from point A to point B, adding a value to a score incrementally, etc). This allows you to assign a variable with the current value of the loop. See the example for more.<br>
Note: Unlike many BASIC languages, the <a href='NEXT.htm'>NEXT</a> command does NOT use the FOR command's variable as an identifier. If you have nested FOR ... NEXT commands, the language will automatically match the NEXT with the nearest FOR command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Print the values 1 through 10<br>
For t = 1 To 10<br>
Print t<br>
Next<br>
This is frequently used when a specific pattern of numbers is needed to perform an evolution (moving something from point A to point B, adding a value to a score incrementally, etc). This allows you to assign a variable with the current value of the loop. See the example for more.
; Print the values 1,3,5,7,9<br>
For t = 1 To 10 Step 2<br>
Print t<br>
Next<br>
</td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />
Note: Unlike many BASIC languages, the NEXT command does NOT use the FOR command's variable as an identifier. If you have nested FOR ... NEXT commands, the language will automatically match the NEXT with the nearest FOR command.
<br>
<br>
See also: <a class=small href=To.htm>To</a>, <a class=small href=Step.htm>Step</a>, <a class=small href=Each.htm>Each</a>, <a class=small href=Next.htm>Next</a>, <a class=small href=Exit.htm>Exit</a>, <a class=small href=While.htm>While</a>, <a class=small href=Repeat.htm>Repeat</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/For.bb>Example</a></h1>
<table>
<tr>
<td>
; Print the values 1 through 10
<br />
For t = 1 To 10
<br />
Print t
<br />
Next
<br />
<br />
; Print the values 1,3,5,7,9
<br />
+43 -7
View File
@@ -1,10 +1,46 @@
<html><head><title>Command: Forever </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;Forever &nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Used in a REPEAT loop to make the loop run endlessly.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>None.</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Replace the <a href='UNTIL.htm'>UNTIL</a> command in a <a href='REPEAT.htm'>REPEAT</a> ... UNTIL loop to make the loop run forever. Remember, the program execution will continue indefinately until either you break out of it programmatically! This is often known as 'the infinate loop'. Once more for the cheap seats: "Make sure you provide a means for breaking out of the loop". Use <a href='EXIT.htm'>EXIT</a> (to leave the loop) or <a href='END.htm'>END</a> to quit the program.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; FOREVER Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>Forever</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
None.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Replace the UNTIL command in aREPEAT ... UNTIL loop to make the loop run forever. Remember, the program execution will continue indefinately until either you break out of it programmatically! This is often known as 'the infinate loop'. Once more for the cheap seats: "Make sure you provide a means for breaking out of the loop". Use EXIT (to leave the loop) or END to quit the program.
<br>
Repeat<br>
If KeyHit(1) Then Exit<br>
Print "You are trapped in an infinate loop! Press ESC!"<br>
Forever<br>
<br>
Print "The infinate loop has ended!"<br>
<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
See also: <a class=small href=Repeat.htm>Repeat</a>, <a class=small href=Until.htm>Until</a>, <a class=small href=Exit.htm>Exit</a>, <a class=small href=While.htm>While</a>, <a class=small href=For.htm>For</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/Forever.bb>Example</a></h1>
<table>
<tr>
<td>
; FOREVER Example
<br />
<br />
Repeat
<br />
If KeyHit(1) Then Exit
<br />
Print "You are trapped in an infinate loop! Press ESC!"
<br />
Forever
<br />
<br />
Print "The infinate loop has ended!"
</td>
+49 -15
View File
@@ -1,20 +1,54 @@
<html><head><title>Command: FreeBank </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FreeBank bank&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Frees a memory bank from memory.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>bank = variable containing handle to valid bank</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This releases a memory bank allocated with the <a href='CreateBank.htm'>CreateBank</a> command.</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; Bank Commands Example<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FreeBank bank</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
bank - bank handle
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Frees a bank.
<br>
bnkTest=CreateBank(500)<br>
<br>
For t = 1 To 50<br>
PokeByte bnkTest,t,Rnd(255)<br>
PokeInt bnkTest,t+1,Rnd(10000)<br>
PokeShort bnkTest,t+2,Rnd(10000)<br>
PokeFloat bnkTest,t+3,Rnd(-.999,.999)<br>
Next<br>
See also: <a class=small href=CreateBank.htm>CreateBank</a>.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FreeBank.bb>Example</a></h1>
<table>
<tr>
<td>
; Bank Commands Example
<br />
; ---------------------
<br />
<br />
bnkTest=CreateBank(12)
<br />
<br />
PokeByte bnkTest,0,Rand(255)
<br />
PokeShort bnkTest,1,Rand(65535)
<br />
PokeInt bnkTest,3,Rand(-2147483648,2147483647)
<br />
PokeFloat bnkTest,7,0.5
<br />
<br />
For t = 1 To 50<br>
Print PeekByte (bnkTest,t)<br>
Print PeekInt (bnkTest,t+1)<br>
Print PeekShort (bnkTest,t+2)<br>
Print PeekFloat (bnkTest,t+3)<br>
Next<br>
Print PeekByte(bnkTest,0)
<br />
Freebank bnkTest<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
Print PeekShort(bnkTest,1)
<br />
+70 -42
View File
@@ -1,45 +1,73 @@
<html><head><title>Command: FreeFont </title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><link rel='stylesheet' href='../css/commands.css' type='text/css'></head><body><span class='Command'>&nbsp;&nbsp;FreeFont fonthandle&nbsp;&nbsp;</span></p><span class='header'>Definition:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>Deletes a previously loaded font and frees its memory.</td></tr></table><span class='header'><br>Parameter Description:</span> <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>fontname = string containing font name<br>
height = font height desired<br>
bold = set to TRUE to load font as BOLD<br>
italic = set to TRUE to load font as ITALIC<br>
underlined set to TRUE to load font as UNDERLINED<br>
</td></tr></table><p class='header'>Command Description: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>This removes a TrueType font previously loaded into memory (though the <a href='LoadFont.htm'>LoadFont</a> command).<br>
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>FreeFont fonthandle</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
fonthandle = A handle to a previously loaded font.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
This removes a TrueType font previously loaded into memory (though the LoadFont command).
<br />
<br />
Note: Blitz doesn't work with SYMBOL fonts, like Webdings and WingDings.
</td>
</tr>
</table>
<h1><a href=../2d_examples/FreeFont.bb>Example</a></h1>
<table>
<tr>
<td>
; LoadFont/SetFont/FreeFont example
<br />
<br />
; enable graphics mode
<br />
Graphics 800,600,16
<br />
<br />
; Set global on font variables
<br />
Global fntArial,fntArialB,fntArialI,fntArialU
<br />
<br />
;Load fonts to a file handle variables
<br />
fntArial=LoadFont("Arial",24,False,False,False)
<br />
fntArialB=LoadFont("Arial",18,True,False,False)
<br />
fntArialI=LoadFont("Arial",32,False,True,False)
<br />
fntArialU=LoadFont("Arial",14,False,False,True)
<br />
<br />
; set the font and print text
<br />
SetFont fntArial
<br />
Text 400,0,"This is just plain Arial 24 point",True,False
<br />
<br />
SetFont fntArialB
Note: Blitz doesn't work with SYMBOL fonts, like Webdings and WingDings.<br>
</td></tr></table><p class='header'>Example: <br><br><table width='100%' border='0' cellspacing='2' cellpadding='2' align='center'><tr><td>; LoadFont/SetFont/FreeFont example<br>
<br />
Text 400,30,"This is bold Arial 18 point",True,False
; enable graphics mode<br>
Graphics 800,600,16<br>
<br>
; Set global on font variables<br>
Global fntArial,fntArialB,fntArialI,fntArialU<br>
<br>
;Load fonts to a file handle variables<br>
fntArial=LoadFont("Arial",24,False,False,False)<br>
fntArialB=LoadFont("Arial",18,True,False,False)<br>
fntArialI=LoadFont("Arial",32,False,True,False)<br>
fntArialU=LoadFont("Arial",14,False,False,True)<br>
<br>
; set the font and print text<br>
SetFont fntArial<br>
Text 400,0,"This is just plain Arial 24 point",True,False<br>
<br>
SetFont fntArialB<br>
Text 400,30,"This is bold Arial 18 point",True,False<br>
<br>
SetFont fntArialI<br>
Text 400,60,"This is italic Arial 32 point",True,False<br>
<br>
SetFont fntArialU<br>
Text 400,90,"This is underlined Arial 14 point",True,False<br>
<br>
; Standard 'wait for ESC' from user<br>
While Not KeyHit(1)<br>
Wend<br>
<br>
; Clear all the fonts from memory!<br>
FreeFont fntArial<br>
FreeFont fntArialB<br>
FreeFont fntArialI<br>
FreeFont fntArialU<br></td></tr></table><p><b><a target="_top" href="../index.htm">Index</a></b></p></body>
<br />

Some files were not shown because too many files have changed in this diff Show More