1
1
Fork 0
mirror of https://github.com/DualBrain/QB64.git synced 2023-11-19 13:10:13 +00:00

Compare commits

...

7 commits

Author SHA1 Message Date
Cory Smith 9879ba3bb5 Delete NOT.md 2022-12-24 19:37:28 -06:00
Cory Smith 61ef2c8d7f Delete LPRINT-USING.md 2022-12-24 19:34:42 -06:00
Cory Smith 17bf0ec105 Delete Keyword-Reference---By-Usage.md 2022-12-24 19:32:50 -06:00
Cory Smith 1dc46f69a6 Delete IMP.md 2022-12-24 19:30:37 -06:00
Cory Smith 2d3228a76e Delete EQV.md 2022-12-24 19:25:56 -06:00
Cory Smith ca88ba2965 More wiki experiment. 2022-12-24 19:12:43 -06:00
Cory Smith b87992c038 More wiki experimenting. 2022-12-24 19:00:19 -06:00
287 changed files with 1 additions and 17610 deletions

View file

@ -3,6 +3,7 @@
## Wiki
- **[PRINT](wiki/PRINT.md)**
- **[VIEW](wiki/VIEW.md)**
Although you can find several copies of the QB64 wiki on the internet, many of these exist as *backup copies* due to the past instability issues around QB64 .org and .net websites and (most likely) aren't currently maintained.

View file

@ -1,27 +0,0 @@
The [EQV](EQV) operator returns a value based on the *equivalence* of two conditions or values.
## Syntax
> result = firstValue [EQV](EQV) secondValue
## Description
* Returns true (-1) when both values are the same (*equivalent*).
* Turns a bit on if both bits are the same, turns a bit off if both bits are different.
The results of the bitwise logical operations, where *A* and *B* are operands, and *T* and *F* indicate that a bit is set or not set:
| A | B | | [NOT](NOT) B | A [AND](AND) B | A [OR](OR) B | A [XOR](XOR) B | A [EQV](EQV) B | A [IMP](IMP) B |
| - | - | - | - | - | - | - | - | - |
| T | T | | F | T | T | F | T | T |
| T | F | | T | F | T | T | F | F |
| F | T | | F | F | T | T | F | T |
| F | F | | T | F | F | F | T | T |
**[Relational Operations](Relational-Operations) return negative one (-1, all bits set) and zero (0, no bits set) for *true* and *false*, respectively.**
This allows relational tests to be inverted and combined using the bitwise logical operations.
## See Also
* [Binary](Binary)
* [Boolean](Boolean)

View file

@ -1,29 +0,0 @@
The [IMP](IMP) logical operator converts the result of two comparative values and returns a bit result.
## Syntax
> result = firstValue [IMP](IMP) secondValue
## Description
* Returns a different result from [AND](AND), [OR](OR) or [XOR](XOR) - see truth table below.
* Evaluates if firstValue ***imp**lies* secondValue.
**If firstValue is true then secondValue must also be true.
**So if firstValue is true, and secondValue false, then the condition is false, otherwise it is true (see table below).
The results of the bitwise logical operations, where *A* and *B* are operands, and *T* and *F* indicate that a bit is set or not set:
| A | B | | [NOT](NOT) B | A [AND](AND) B | A [OR](OR) B | A [XOR](XOR) B | A [EQV](EQV) B | A [IMP](IMP) B |
| - | - | - | - | - | - | - | - | - |
| T | T | | F | T | T | F | T | T |
| T | F | | T | F | T | T | F | F |
| F | T | | F | F | T | T | F | T |
| F | F | | T | F | F | F | T | T |
**[Relational Operations](Relational-Operations) return negative one (-1, all bits set) and zero (0, no bits set) for *true* and *false*, respectively.**
This allows relational tests to be inverted and combined using the bitwise logical operations.
## See Also
* [Binary](Binary)
* [Boolean](Boolean)

File diff suppressed because it is too large Load diff

View file

@ -1,48 +0,0 @@
The [LPRINT USING](LPRINT-USING) statement sends formatted data to LPT1, the parallel port printer.
## Syntax
> **LPRINT** [*text$*{;|,}] **USING** template$; variable[; ...][{;|,}]
## Parameter(s)
* Literal or variable [STRING](STRING) *text$* can be placed between [LPRINT](LPRINT) and USING or it can be included in the template$.
* A [semicolon](semicolon) or [comma](comma) may follow the text$ to stop or tab the print cursor before the template$ [LPRINT](LPRINT).
* The literal or variable [STRING](STRING) template$ should use the template symbols to display each variable [Variable Types](Variable-Types) in the list following it.
* The list of data *variables* used in the template$ are **separated by semicolons** after the template string value.
* A [semicolon](semicolon) or [comma](comma) may follow the variable list to stop or tab the print cursor for pending prints.
## Description
* The *variable* list should be listed in the order that they are used in the template from left to right.
* **If the *template* string is omitted or symbols don't match the *variable(s)* an "Illegal Function Call" [ERROR Codes](ERROR-Codes) will occur.**
* No more than 25 # digit places are allowed in a template number or an [ERROR Codes](ERROR-Codes) will occur.
* Can convert numerical exponential or [scientific notation](scientific-notation) values to normal decimal point values using less digits.
* **NOTE:** If the numerical value exceeds the template's digit range a % symbol will appear in the leftmost digit area.
Template is a literal or variable [string](STRING) using the following formatting characters:
| & | Prints an entire string value. STRING length should be limited as template width will vary. |
| -- | -- |
| \  \ | Denotes the start and end point of a fixed string area with spaces between(LEN = spaces + 2). |
| ! | Prints only the leading character of a string value. Exclamation points require underscore prefix. |
| # | Denotes a numerical digit. An appropriate number of digits should be used for values received. |
| ^^^^ | After # digits prints numerical value in exponential E+xx format. Use ^^^^^ for E+xxx values.* |
| . | Period sets a number's decimal point position. Digits following determine rounded value accuracy. |
| ,. | Comma to left of decimal point, prints a comma every 3 used # digit places left of the decimal point. |
| + | Plus sign denotes the position of the number's sign. + or - will be displayed. |
| - | Minus sign (dash) placed after the number, displays only a negative value's sign. |
| $ | Prints a dollar sign immediately before the highest non-zero # digit position of the numerical value. |
| ** | Prints an asterisk in any leading empty spaces of a numerical value. Adds 2 extra digit positions. |
| **$ | Combines ** and $. Negative values will display minus sign to left of $. |
| _ | Underscore preceding a format symbol prints those symbols as literal string characters. |
**Note: Any string character not listed above will be printed as a literal text character.**
* Any # decimal point position may be specified. The exponent is adjusted with significant digits left-justified.
## See Also
* [PRINT USING](PRINT-USING)
* [LPRINT](LPRINT)
* [PRINT](PRINT)

View file

@ -1,116 +0,0 @@
[NOT](NOT) is a [Boolean](Boolean) logical operator that will change a false statement to a true one and vice-versa.
## Syntax
> *True* = -1: *False* = [NOT](NOT) True
## Description
* In QBasic, True = -1 and False = 0 in boolean logic and evaluation statements.
* [NOT](NOT) evaluates a value and returns the bitwise opposite, meaning that `NOT 0 = -1`.
* Often called a negative logic operator, it returns the opposite of a value as true or false.
* Values are changed by their bit values so that each bit is changed to the opposite of on or off. See example 3 below.
**Relational Operators:**
| Symbol | Condition | Example Usage |
| -- | -- | -- |
| = | Equal | IF a = b THEN |
| <> | NOT equal | IF a <> b THEN |
| < | Less than | IF a < b THEN |
| > | Greater than | IF a > b THEN |
| <= | Less than or equal | IF a <= b THEN |
| >= | Greater than or equal | IF a >= b THEN |
The results of the bitwise logical operations, where *A* and *B* are operands, and *T* and *F* indicate that a bit is set or not set:
| A | B | | [NOT](NOT) B | A [AND](AND) B | A [OR](OR) B | A [XOR](XOR) B | A [EQV](EQV) B | A [IMP](IMP) B |
| - | - | - | - | - | - | - | - | - |
| T | T | | F | T | T | F | T | T |
| T | F | | T | F | T | T | F | F |
| F | T | | F | F | T | T | F | T |
| F | F | | T | F | F | F | T | T |
**[Relational Operations](Relational-Operations) return negative one (-1, all bits set) and zero (0, no bits set) for *true* and *false*, respectively.**
This allows relational tests to be inverted and combined using the bitwise logical operations.
## Example(s)
Alternating between two conditions in a program loop.
```vb
DO
switch = NOT switch 'NOT changes value from -1 to 0 and vice-versa
LOCATE 10, 38
IF switch THEN PRINT "True!" ELSE PRINT "False"
SLEEP
k$ = INKEY$
LOOP UNTIL k$ = CHR$(27) ' escape key quit
```
Reading a file until it reaches the End Of File.
```vb
DO WHILE NOT EOF(1)
INPUT #1, data1, data2, data3
LOOP
```
> *Explanation:* [EOF](EOF) will return 0 until a file ends. NOT converts 0 to -1 so that the loop continues to run. When EOF becomes -1, NOT converts it to 0 to end the loop.
So why does **NOT 5 = -6**? Because NOT changes every bit of a value into the opposite:
```vb
PRINT NOT 5
PRINT
ReadBits 5
ReadBits -6
SUB ReadBits (n AS INTEGER) 'change type value and i bit reads for other whole type values
FOR i = 15 TO 0 STEP -1 'see the 16 bit values
IF n AND 2 ^ i THEN PRINT "1"; ELSE PRINT "0";
NEXT
PRINT
END SUB
```
```text
-6
0000000000000101
1111111111111010
```
> *Explanation:* The bit values of an [INTEGER](INTEGER) are 2 [_BYTE](_BYTE)s and each bit is an exponent of 2 from 15 to 0 (16 bits). Thus comparing the numerical value with those exponents using [AND](AND) reveals the bit values as "1" for bits on or "0" for bits off as text.
> QB64 can use [&B](&B) to convert the above [_BIT](_BIT) values back to [INTEGER](INTEGER) or [_BYTE](_BYTE) values as shown below:
```vb
'16 bit INTEGER values from -32768 to 32767
a% = &B0000000000000101
PRINT a%
b% = &B1111111111111010
PRINT b%
'8 bit BYTE values from -128 to 127
a%% = &B00000101
PRINT a%%
b%% = &B11111010
PRINT b%%
```
## See Also
* [_BIT](_BIT), [&B](&B), [_BYTE](_BYTE)
* [AND](AND), [XOR](XOR), [OR](OR)
* [Binary](Binary), [Boolean](Boolean)
* [Mathematical Operations](Mathematical-Operations)

View file

@ -1,58 +0,0 @@
The [_ACCEPTFILEDROP](_ACCEPTFILEDROP) statement prepares a program window to receive files dropped from Windows Explorer in a drag/drop operation.
## Syntax
> [_ACCEPTFILEDROP](_ACCEPTFILEDROP) [{ON|OFF}]
## Description
* Calling the statement with no parameters turns drag/dropping ON.
* To know when files have been dropped into your program's window, check that [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) is greater than 0.
* Use [_DROPPEDFILE](_DROPPEDFILE) to read the list, either sequentially or by index.
* If using [_DROPPEDFILE](_DROPPEDFILE) with an index, you must call [_FINISHDROP](_FINISHDROP) after you finish working with the list.
* **[Keywords currently not supported](Keywords-currently-not-supported-by-QB64)**.
## Availability
* Version 1.3 and up.
## Example(s)
Accepting files dragged from a folder and processing the list received sequentially.
```vb
SCREEN _NEWIMAGE(128, 25, 0)
_ACCEPTFILEDROP 'enables drag/drop functionality
PRINT "Drag files from a folder and drop them in this window..."
DO
IF _TOTALDROPPEDFILES THEN
FOR i = 1 TO _TOTALDROPPEDFILES
a$ = _DROPPEDFILE 'reads the list sequentially; when the result is empty ("") it means the list is over
COLOR 15
PRINT i,
IF _FILEEXISTS(a$) THEN
COLOR 2: PRINT "file",
ELSE
IF _DIREXISTS(a$) THEN
COLOR 3: PRINT "folder",
ELSE
COLOR 4: PRINT "not found", 'highly unlikely, but who knows?
END IF
END IF
COLOR 15
PRINT a$
NEXT
END IF
_LIMIT 30
LOOP
```
## See Also
* [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES), [_DROPPEDFILE](_DROPPEDFILE), [_FINISHDROP](_FINISHDROP)
* [_FILEEXISTS](_FILEEXISTS), [_DIREXISTS](_DIREXISTS)

View file

@ -1,55 +0,0 @@
The [_ACOS](_ACOS) function returns the angle measured in radians based on an input [COS](COS)ine value ranging from -1 to 1.
## Syntax
> radian_angle! = [_ACOS](_ACOS)(cosine_value!)
## Description
* The *cosine_value!* must be measured >= -1 and <= 1, or an error will be generated. (PRINT _ACOS(1.2) would give the result of -1.#IND, which is basically QB64's way of telling us that the number doesn't exist, much like 1/0 would.)
* ARCCOSINE is the inverse function of [COS](COS)ine, which lets us turn a [COS](COS)ine value back into an angle.
* Note: Due to rounding with floating point math, the _ACOS may not always give a perfect match for the COS angle which generated this. You can reduce the number of rounding errors by increasing the precision of your calculations by using [DOUBLE](DOUBLE) or [_FLOAT](_FLOAT) precision variables instead of [SINGLE](SINGLE).
## Availability
* Version 1.000 and up.
## Example(s)
Converting a radian angle to its COSine and using that value to find the angle in degrees again using _ACOS:
```vb
DEFDBL A-Z
INPUT "Give me an Angle (in Degrees) => "; Angle
PRINT
C = COS(_D2R(Angle)) '_D2R is the command to convert Degrees to Radians, which is what COS expects
PRINT "The COSINE of the Angle is: "; C
A = _ACOS(C)
PRINT "The ACOS of "; C; " is: "; A
PRINT "Notice, A is the Angle in Radians. If we convert it to degrees, the value is "; _R2D(A)
```
```text
Give me an Angle (in Degrees) => ? 60
The COSINE of the Angle is: .5000000000000001
The ACOS of .5000000000000001 is: 1.047197551196598
Notice, A is the Angle in Radians. If we convert it to degrees, we discover the value is 60
```
## See Also
* [_D2G](_D2G) (degree to gradient, [_D2R](_D2R) (degree to radian)
* [_G2D](_G2D) (gradient to degree), [_G2R](_G2R) (gradient to degree
* [_R2D](_R2D) (radian to degree), [_R2G](_R2G) (radian to gradient
* [COS](COS) (cosine), [SIN](SIN) (sine), [TAN](TAN) (tangent)
* [_ASIN](_ASIN) (arc sine), [ATN](ATN) (arc tangent)
* [_ACOSH](_ACOSH) (arc hyperbolic cosine), [_ASINH](_ASINH) (arc hyperbolic sine), [_ATANH](_ATANH) (arc hyperbolic tangent)
* [_ATAN2](_ATAN2) (Compute arc tangent with two parameters)
* [_HYPOT](_HYPOT) (hypotenuse)
* [Mathematical Operations](Mathematical-Operations)

View file

@ -1,17 +0,0 @@
The [_ACOSH](_ACOSH) returns the nonnegative arc hyperbolic cosine of x!, expressed in radians.
## Syntax
> return_value! = [_ACOSH](_ACOSH)(x!)
## See Also
* [_D2G](_D2G) (degree to gradient, [_D2R](_D2R) (degree to radian)
* [_G2D](_G2D) (gradient to degree), [_G2R](_G2R) (gradient to degree)
* [_R2D](_R2D) (radian to degree), [_R2G](_R2G) (radian to gradient)
* [COS](COS) (cosine), [SIN](SIN) (sine), [TAN](TAN) (tangent)
* [_ACOS](_ACOS) (arc cosine), [_ASIN](_ASIN) (arc sine), [ATN](ATN) (arc tangent)
* [_ASINH](_ASINH) (arc hyperbolic sine), [_ATANH](_ATANH) (arc hyperbolic tangent)
* [_ATAN2](_ATAN2) (Compute arc tangent with two parameters)
* [_HYPOT](_HYPOT) (hypotenuse)
*[Mathematical Operations](Mathematical-Operations)

View file

@ -1,78 +0,0 @@
The [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN) statement allows setting the behavior of the ALT+ENTER combo.
## Syntax
> [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN) [{_STRETCH|_SQUAREPIXELS|OFF|_ALL}][, {_SMOOTH|OFF|_ALL}]
## Description
* Calling the statement with no parameters enables all four possible full screen modes (and is the default state when a program is started): both [_STRETCH](_STRETCH) ([_SMOOTH](_SMOOTH) and _OFF) and [_SQUAREPIXELS](_SQUAREPIXELS) ([_SMOOTH](_SMOOTH) and _OFF).
* Using [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN) _ALL, _ALL has the same effect.
* [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN) only affects the behavior of ALT+ENTER. The [_FULLSCREEN](_FULLSCREEN) statement is not bound by [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN)'s settings so all modes can be accessed programmatically.
* To limit just the mode but allow both _SMOOTH + _OFF antialiasing modes, pass just the first parameter: *Example:* [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN) _SQUAREPIXELS
* To allow multiple modes with _SMOOTH or _OFF as default, pass just the second parameter. *Example:* [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN) , _SMOOTH
* Any possible permutation of the parameters is allowed.
* With [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN) _OFF you can trap Alt+Enter manually in your program and reassign it. See example 2 below.
## Availability
* Version 1.3 and up.
## Example(s)
Allowing only one full-screen mode with square pixels and no anti-aliasing:
```vb
_ALLOWFULLSCREEN _SQUAREPIXELS, OFF
```
Disabling _FULLSCREEN with Alt+ENTER so the combo can be manually trapped:
```vb
DO
CLS
LOCATE 7
PRINT " - Press ALT+ENTER to test trapping the combo..."
PRINT " _ Press SPACEBAR to allow fullscreen again..."
k& = _KEYHIT
IF k& = 13 THEN
IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN
altEnter = altEnter + 1
END IF
ELSEIF k& = 32 THEN
fullscreenEnabled = NOT fullscreenEnabled
END IF
LOCATE 14
IF fullscreenEnabled THEN
_ALLOWFULLSCREEN _ALL, _ALL
altEnter = 0
PRINT "_ALLOWFULLSCREEN _ALL, _ALL"
LOCATE 18
PRINT "ALT+ENTER will trigger all four fullscreen modes now."
ELSE
_ALLOWFULLSCREEN OFF
PRINT "_ALLOWFULLSCREEN OFF"
END IF
IF altEnter THEN
LOCATE 18
PRINT "ALT+ENTER manually trapped"; altEnter; "times."
END IF
_DISPLAY
_LIMIT 30
LOOP
```
## See Also
* [_FULLSCREEN](_FULLSCREEN), [_SMOOTH (function)](_SMOOTH-(function))

View file

@ -1,74 +0,0 @@
The [_ALPHA](_ALPHA) function returns the alpha channel transparency level of a color value used on a screen page or image.
## Syntax
> result& = [_ALPHA](_ALPHA)(color~& [, imageHandle&])
## Description
* If imageHandle& is omitted, it is assumed to be the current write page. Invalid handles will create [ERROR Codes](ERROR-Codes) errors.
* [_NEWIMAGE](_NEWIMAGE) 32 bit [SCREEN](SCREEN) modes will always use an [_UNSIGNED](_UNSIGNED) [LONG](LONG) *color~&* value.
* Color values that are set as a [_CLEARCOLOR](_CLEARCOLOR) always have an alpha level of 0 (transparent).
* [_SETALPHA](_SETALPHA) can set any alpha level from 0 (or fully transparent) to 255 (or opaque).
* Normal color values that are set by [_RGB](_RGB) or [_RGB32](_RGB32) always have an alpha level of 255(opaque).
* In 4 (16 color) or 8 (256 color) bit palette screens the function will always return 255.
*[_RED32](_RED32), [_GREEN32](_GREEN32), [_BLUE32](_BLUE32) and [_ALPHA32](_ALPHA32) are all equivalent to [_RED](_RED), [_GREEN](_GREEN), [_BLUE](_BLUE) and [_ALPHA](_ALPHA) but they are highly optimized and only accept a 32-bit color (B8:G8:R8:A8). Using them (opposed to dividing then ANDing 32-bit color values manually) makes code easy to read.
* **NOTE: 32 bit [_NEWIMAGE](_NEWIMAGE) screen page backgrounds are transparent black or [_ALPHA](_ALPHA) 0. Use [_DONTBLEND](_DONTBLEND) or [CLS](CLS) for opaque.**
## Example(s)
Alpha transparency levels are always 255 in 4 or 8 bit screen modes.
```vb
SCREEN 13
clr~& = _RGBA(255, 0, 255, 192) 'returns closest palette color attribute
PRINT "Color:"; clr~&
COLOR clr~&
PRINT "Alpha:"; _ALPHA(clr~&)
END
```
```text
Color 36
Alpha: 255
```
> *Explanation:* [_RGBA](_RGBA) cannot change the [_ALPHA](_ALPHA) level. [_ALPHA32](_ALPHA32) would return 0 on any non-32 bit image or page.
Finding the transparency of a 32 bit screen mode's background before and after [CLS](CLS).
```vb
SCREEN _NEWIMAGE(640, 480, 32)
BG& = POINT(1, 1)
PRINT "Alpha ="; _ALPHA(BG&); "Press a key to use CLS!"
K$ = INPUT$(1)
CLS
BG& = POINT(1, 1)
PRINT "CLS Alpha ="; _ALPHA(BG&)
```
```text
CLS Alpha = 255
```
> *Explanation:* Set the ALPHA value to 255 using [CLS](CLS) to make the background opaque when overlaying pages.
## See Also
* [_ALPHA32](_ALPHA32), [_SETALPHA](_SETALPHA)
* [_RGBA](_RGBA), [_RGBA32](_RGBA32) (set color with alpha)
* [_CLEARCOLOR](_CLEARCOLOR), [_CLEARCOLOR (function)](_CLEARCOLOR-(function))
* [_RED](_RED), [_GREEN](_GREEN), [_BLUE](_BLUE)
* [_RED32](_RED32), [_GREEN32](_GREEN32). [_BLUE32](_BLUE32)
* [CLS](CLS), [COLOR](COLOR), [Images](Images)

View file

@ -1,54 +0,0 @@
The [_ALPHA32](_ALPHA32) function returns the alpha transparency level of a 32 bit color value.
## Syntax
> alpha& = [_ALPHA32](_ALPHA32)(color32~&)**
## Parameter(s)
* color32& is the [_UNSIGNED](_UNSIGNED) [LONG](LONG) 32 bit color value used to retrieve the alpha level.
* Color values that are set as a [_CLEARCOLOR](_CLEARCOLOR) always have an alpha level of 0 (transparent).
* [_SETALPHA](_SETALPHA) can set any alpha level from 0 (or fully transparent) to 255 (or opaque).
* Normal color values that are set by [_RGB](_RGB) or [_RGB32](_RGB32) always have an alpha level of 255 (opaque).
## Description
* In 4-bit (16 colors) or 8-bit (256 colors) palette screens the function will return 0.
* [_RED32](_RED32), [_GREEN32](_GREEN32), [_BLUE32](_BLUE32) and [_ALPHA32](_ALPHA32) are all equivalent to [_RED](_RED), [_GREEN](_GREEN), [_BLUE](_BLUE) and [_ALPHA](_ALPHA) but they are highly optimized and only accept a 32-bit color (RGBA) value. Using these in your code (opposed to dividing then ANDing 32-bit color values) makes code easy to read.
* **NOTE: 32 bit [_NEWIMAGE](_NEWIMAGE) screen page backgrounds are transparent black or [_ALPHA](_ALPHA) 0. Use [_DONTBLEND](_DONTBLEND) or [CLS](CLS) for opaque!**
## Example(s)
Finding the alpha transparency level in a 32 bit screen using an [_RGBA](_RGBA) [_UNSIGNED](_UNSIGNED) [LONG](LONG) color value.
```vb
SCREEN _NEWIMAGE(640, 480, 32)
clr~& = _RGBA(255, 0, 255, 192)
PRINT "Color:"; clr~&
COLOR clr~&
PRINT "Alpha32:"; _ALPHA32(clr~&)
END
```
```text
Color: 3237937407
Alpha32: 192
```
> *Notes:* The color value is equivalent to [&H](&H) &HC0FF00FF where &HC0 equals 192. [_RGB](_RGB) alphas are always &HFF(255).
## See Also
* [_ALPHA](_ALPHA), [_SETALPHA](_SETALPHA)
* [_RGBA](_RGBA), [_RGBA32](_RGBA32) (set color with alpha)
* [_RED](_RED), [_GREEN](_GREEN), [_BLUE](_BLUE)
* [_RED32](_RED32), [_GREEN32](_GREEN32). [_BLUE32](_BLUE32)
* [_CLEARCOLOR](_CLEARCOLOR), [_CLEARCOLOR (function)](_CLEARCOLOR-(function))
* [Images](Images)

View file

@ -1,55 +0,0 @@
The [_ASIN](_ASIN) function returns the angle measured in radians based on an input [SIN](SIN)e value ranging from -1 to 1.
## Syntax
> radian_angle! = [_ASIN](_ASIN)(sine_value!)
## Description
* The sine_value! must be measured >= -1 and <= 1, or else it will generate a return value of **-1.#IND**, which is basically QB64's way of telling us that the number doesn't exist.
* ARCSINE is the inverse function of [SIN](SIN)e, and turns a [SIN](SIN)e value back into an angle.
* Note: Due to rounding with floating point math, the [_ASIN](_ASIN) may not always give a perfect match for the [SIN](SIN) angle which generated this. You can reduce the number of rounding errors by increasing the precision of your calculations by using [DOUBLE](DOUBLE) or [_FLOAT](_FLOAT) precision variables instead of [SINGLE](SINGLE).
## Availability
* Version 1.000 and up.
## Example(s)
Converting a radian angle to its SINe and using that value to find the angle in degrees again using _ASIN:
```vb
DEFDBL A-Z
INPUT "Give me an Angle (in Degrees) => "; Angle
PRINT
C = SIN(_D2R(Angle)) '_D2R is the command to convert Degrees to Radians, which is what SIN expects
PRINT "The SINE of the Angle is: "; C
A = _ASIN(C)
PRINT "The ASIN of "; C; " is: "; A
PRINT "Notice, A is the Angle in Radians. If we convert it to degrees, the value is "; _R2D(A)
```
```text
Give me an Angle (in Degrees) => ? 60
The SINE of the Angle is: .8660254037844386
The ACOS of .8660254037844386 is: 1.047197551196598
Notice, A is the Angle in Radians. If we convert it to degrees, we discover the value is 60
```
## See Also
* [_D2G](_D2G) (degree to gradient, [_D2R](_D2R) (degree to radian)
* [_G2D](_G2D) (gradient to degree), [_G2R](_G2R) (gradient to degree
* [_R2D](_R2D) (radian to degree), [_R2G](_R2G) (radian to gradient
* [COS](COS) (cosine), [SIN](SIN) (sine), [TAN](TAN) (tangent)
* [_ACOS](_ACOS) (arc cosine), [ATN](ATN) (arc tangent)
* [_ACOSH](_ACOSH) (arc hyperbolic cosine), [_ASINH](_ASINH) (arc hyperbolic sine), [_ATANH](_ATANH) (arc hyperbolic tangent)
* [_ATAN2](_ATAN2) (Compute arc tangent with two parameters)
* [_HYPOT](_HYPOT) (hypotenuse)
*[Mathematical Operations](Mathematical-Operations)

View file

@ -1,17 +0,0 @@
The [_ASINH](_ASINH) function returns the arc hyperbolic sine of x, expressed in radians.
## Syntax
> return_value! = [_ASINH](_ASINH)(x!)
## See Also
* [_D2G](_D2G) (degree to gradient, [_D2R](_D2R) (degree to radian)
* [_G2D](_G2D) (gradient to degree), [_G2R](_G2R) (gradient to degree)
* [_R2D](_R2D) (radian to degree), [_R2G](_R2G) (radian to gradient)
* [COS](COS) (cosine), [SIN](SIN) (sine), [TAN](TAN) (tangent)
* [_ACOS](_ACOS) (arc cosine), [_ASIN](_ASIN) (arc sine), [ATN](ATN) (arc tangent)
* [_ACOSH](_ACOSH) (arc hyperbolic cosine), [_ATANH](_ATANH) (arc hyperbolic tangent)
* [_ATAN2](_ATAN2) (Compute arc tangent with two parameters)
* [_HYPOT](_HYPOT) (hypotenuse)
*[Mathematical Operations](Mathematical-Operations)

View file

@ -1,46 +0,0 @@
The [_ASSERT](_ASSERT) statement can be used to perform tests in code that's in development, for debugging purposes.
## Syntax
> [_ASSERT](_ASSERT) condition[, errorMessage$]
## Description
* condition is the condition that must be met in order to consider the _ASSERT valid.
* Optional errorMessage$ is the message to be displayed in the console window if [$ASSERTS]($ASSERTS) is used.
* If the condition is not met (that is, if it evaluates to 0), an error occurs ("_ASSERT failed on line #") and program execution stops.
## Availability
* Version 1.4 and up.
## Example(s)
Adding test checks for parameter inputs in a function.
```vb
$ASSERTS:CONSOLE
DO
a = INT(RND * 10)
b$ = myFunc$(a)
PRINT a, , b$
_LIMIT 3
LOOP UNTIL _KEYHIT
FUNCTION myFunc$ (value AS SINGLE)
_ASSERT value > 0, "Value cannot be zero"
_ASSERT value <= 10, "Value cannot exceed 10"
IF value > 1 THEN plural$ = "s"
myFunc$ = STRING$(value, "*") + STR$(value) + " star" + plural$ + " :-)"
END FUNCTION
```
## See Also
* [$ASSERTS]($ASSERTS)
* [$CHECKING]($CHECKING)
* [Relational Operations](Relational-Operations)

View file

@ -1,34 +0,0 @@
The [_ATAN2](_ATAN2) function returns the radian angle between the positive x-axis of a plane and the point given by the coordinates (x, y).
## Syntax
> angle! = [_ATAN2](_ATAN2)(y, x)
## Parameter(s)
* y is the vertical axis position (row) as a positive, zero or negative floating point value.
* x is the horizontal axis position (column) as a positive, zero or negative floating point value.
## Description
* The [DOUBLE](DOUBLE) radian angle returned is **positive** for upper row values where y > 0.
* _ATAN2(y, x) = [ATN](ATN)(y# / x#) when x > 0
* _ATAN2(y, x) = [ATN](ATN)(y# / x#) + [_PI](_PI) when x < 0
* _ATAN2(y, x) = [_PI](_PI) / 2 when x = 0
* The [DOUBLE](DOUBLE) radian angle returned is 0 when x > 0 and [_PI](_PI) when x < 0 where y = 0
* The [DOUBLE](DOUBLE) radian angle returned is **negative** for lower row values where y < 0.
* _ATAN2(y, x) = [ATN](ATN)(y# / x#) when x > 0
* _ATAN2(y, x) = [ATN](ATN)(y# / x#) - [_PI](_PI) when x < 0
* _ATAN2(y, x) = -[_PI](_PI) / 2 when x = 0
* _ATAN2(0, 0) is undefined and the function returns 0 instead of a division error.
## Error(s)
* With [ATN](ATN)(y / x), x can never be 0 as that would create a Division by Zero [ERROR Codes](ERROR-Codes) 11 or #IND.
## See Also
* [ATN](ATN) (arctangent)
* [_PI](_PI) (QB64 function)
* [Mathematical Operations](Mathematical-Operations)
* [Atan2 reference](https://en.wikipedia.org/wiki/Atan2)

View file

@ -1,17 +0,0 @@
The [_ATANH](_ATANH) returns the arc hyperbolic tangent of x!, expressed in radians.
## Syntax
> return_value! = [_ATANH](_ATANH)(x!)
## See Also
* [_D2G](_D2G) (degree to gradient, [_D2R](_D2R) (degree to radian)
* [_G2D](_G2D) (gradient to degree), [_G2R](_G2R) (gradient to degree)
* [_R2D](_R2D) (radian to degree), [_R2G](_R2G) (radian to gradient)
* [COS](COS) (cosine), [SIN](SIN) (sine), [TAN](TAN) (tangent)
* [_ACOS](_ACOS) (arc cosine), [_ASIN](_ASIN) (arc sine), [ATN](ATN) (arc tangent)
* [_ACOSH](_ACOSH) (arc hyperbolic cosine), [_ASINH](_ASINH) (arc hyperbolic sine)
* [_ATAN2](_ATAN2) (Compute arc tangent with two parameters)
* [_HYPOT](_HYPOT) (hypotenuse)
*[Mathematical Operations](Mathematical-Operations)

View file

@ -1,19 +0,0 @@
The [_AUTODISPLAY (function)](_AUTODISPLAY-(function)) function returns the current display mode as true (-1) if automatic or false (0) if disabled using [_DISPLAY](_DISPLAY).
## Syntax
> displayStatus%% = [_AUTODISPLAY (function)](_AUTODISPLAY-(function))
## Description
* The function returns true (-1) if [_AUTODISPLAY](_AUTODISPLAY) is enabled. This is the default state and indicates that every screen change (text or graphics) is displayed immediately to the user.
* If [_DISPLAY](_DISPLAY) is used, then [_AUTODISPLAY (function)](_AUTODISPLAY-(function)) returns 0, to indicate that screen changes (text or graphics) are only displayed per request, by calling [_DISPLAY](_DISPLAY) again to refresh the screen.
## Availability
* Build 20170924/69 and up.
## See Also
* [_AUTODISPLAY](_AUTODISPLAY)
* [_DISPLAY](_DISPLAY)

View file

@ -1,16 +0,0 @@
The [_AUTODISPLAY](_AUTODISPLAY) statement enables the automatic display of the screen image changes previously disabled by [_DISPLAY](_DISPLAY).
## Syntax
> [_AUTODISPLAY](_AUTODISPLAY)
## Description
* [_AUTODISPLAY](_AUTODISPLAY) is on by default and displays the screen at around 30 frames per second (normal vertical retrace speed).
* [_DISPLAY](_DISPLAY) disables automatic graphic displays, but it also eliminates having to use PCOPY or page flipping when used correctly. Placing _DISPLAY after screen draws or other screen changes assures completion of the changes before they are displayed. The speed of QB64 code execution makes this a viable option.
* The [_AUTODISPLAY (function)](_AUTODISPLAY-(function)) can be used to detect the current display behavior.
## See Also
* [_DISPLAY](_DISPLAY)
* [_AUTODISPLAY (function)](_AUTODISPLAY-(function))

View file

@ -1,51 +0,0 @@
The [_AXIS](_AXIS) function returns the relative position of a specified axis number on a controller device.
## Syntax
> move! = [_AXIS](_AXIS)(axis_number%)
* [SINGLE](SINGLE) values returned range between -1 and 1 as maximums and 0 indicating minimum or axis center.
* When the mouse is moved on the program screen, moves left or above center are negative while below or right are positive.
* The *axis_number* must be a number which does not exceed the number of axis found by the [_LASTAXIS](_LASTAXIS) function.
* **The number of [_DEVICES](_DEVICES) must be read before using [_DEVICE$](_DEVICE$), [_DEVICEINPUT](_DEVICEINPUT) or [_LASTAXIS](_LASTAXIS).**
## Example(s)
Reading multiple controller device buttons, axis and wheels.
```vb
FOR i = 1 TO _DEVICES
PRINT STR$(i) + ") " + _DEVICE$(i) + " Buttons:"; _LASTBUTTON(i); ",Axis:"; _LASTAXIS(i); ",Wheel:"; _LASTWHEEL(i)
NEXT
DO
d& = _DEVICEINPUT
IF d& THEN ' the device number cannot be zero!
PRINT "Found"; d&;
FOR b = 1 TO _LASTBUTTON(d&)
PRINT _BUTTONCHANGE(b); _BUTTON(b);
NEXT
FOR a = 1 TO _LASTAXIS(d&)
PRINT _AXIS(a);
NEXT
FOR w = 1 TO _LASTWHEEL(d&)
PRINT _WHEEL(w);
NEXT
PRINT
END IF
LOOP UNTIL INKEY$ = CHR$(27) 'escape key exit
END
```
> *Note:* When there is no device control to read, a [FOR...NEXT](FOR...NEXT) n = 1 TO 0 loop will not run thus avoiding a control function read error.
## See Also
* [_LASTWHEEL](_LASTWHEEL), [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS)
* [_WHEEL](_WHEEL), [_BUTTON](_BUTTON), [_BUTTONCHANGE](_BUTTONCHANGE)
* [_DEVICE$](_DEVICE$), [_DEVICES](_DEVICES)
* [_MOUSEMOVEMENTX](_MOUSEMOVEMENTX), [_MOUSEMOVEMENTY](_MOUSEMOVEMENTY) (relative movement)
* [Controller Devices](Controller-Devices)

View file

@ -1,55 +0,0 @@
The [_BACKGROUNDCOLOR](_BACKGROUNDCOLOR) function returns the current background color.
## Syntax
> BGcolor& = [_BACKGROUNDCOLOR](_BACKGROUNDCOLOR)
## Description
* Use it to get the current background color to restore later in a program.
* Returns the closest attribute value of the background color.
## Example(s)
Storing a background color for later use.
```vb
SCREEN 0
COLOR 1, 3
CLS
BG% = _BACKGROUNDCOLOR
PRINT BG%
```
```text
3
```
Understanding the function output
```vb
SCREEN 0
COLOR 1, 11
CLS
BG% = _BACKGROUNDCOLOR
PRINT BG% 'prints the attribute as 3 instead of 11
```
```text
3
```
> *Explanation: SCREEN 0 background colors over 7 will return the lower intensity color attribute values: EX: attribute - 8
## See Also
* [_DEFAULTCOLOR](_DEFAULTCOLOR)
* [COLOR](COLOR), [SCREEN](SCREEN)
* [SCREEN (function)](SCREEN-(function))
* [Windows Libraries](Windows-Libraries)

View file

@ -1,104 +0,0 @@
The [_BIT](_BIT) datatype can return only values of 0 (bit off) and -1 (bit on).
## Syntax
> [DIM](DIM) variable [AS](AS) [_UNSIGNED] [_BIT](_BIT) [* numberofbits]
> [_DEFINE](_DEFINE) Letter[-Range|,...] [AS](AS) [_UNSIGNED] [_BIT](_BIT) [* numberofbits]
## Description
* An [_UNSIGNED](_UNSIGNED) _BIT can hold 0 or 1 instead of 0 and -1, if you set the numberofbits you can hold larger values depending on the number of bits you have set (_BIT * 8 can hold the same values as [_BYTE](_BYTE) for example) and the information below is compromised if setting any number of bits other than 1.
* If you set the variable to any other number then the least significant bit of that number will be set as the variables number, if the bit is 1 (on) then the variable will be -1 and if the bit is 0 (off) then the variable will be 0.
* The least significant bit is the last bit on a string of bits (11111) since that bit will only add 1 to the value if set. The most significant bit is the first bit on a string of bits and changes the value more dramatically (significantly) if set on or off.
* The _BIT datatype can be succesfully used as a [Boolean](Boolean) (TRUE or FALSE) and it requires minimal amount of memory (the lowest amount possible actually, one byte can hold 8 bits, if you want to use bits in order to decrease memory usage, use them as arrays as a _BIT variable by itself allocates 4 bytes - DIM bitarray(800) AS _BIT uses 100 bytes).
* **When a variable has not been assigned or has no type suffix, the value defaults to [SINGLE](SINGLE).**
* **[Keywords_currently_not_supported_by_QB64](Keywords-currently-not-supported-by-QB64)** Use a [_BYTE](_BYTE) and assign up to 8 bit values as shown below.
Use a [_BYTE](_BYTE) and assign up to 8 bit values as shown below.
***Suffix Symbols** The [_BIT](_BIT) type suffix used is below the grave accent (\`), usually located under the tilde (~) key (not an apostrophe). Foreign keyboards may not have the \` key. Try Alt+96 in the IDE.
> You can define a bit on-the-fly by adding a \` after the variable, like this: `variable\` = -1`
> If you want an unsigned bit you can define it on-the-fly by adding ~\` instead, like this: `variable~\` = 1`
> You can set the number of bits on the fly by just adding that number - this defines it as being two bits: `variable\`2 = -1`
**[_BIT](_BIT)**
* The **MSB** is the most significant(largest) bit value and **LSB** is the least significant bit of a binary or register memory address value. The order in which the bits are read determines the binary or decimal byte value. There are two common ways to read a byte:
* **"Big-endian"**: MSB is the first bit encountered, decreasing to the LSB as the last bit by position, memory address or time.
* **"Little-endian"**: LSB is the first bit encountered, increasing to the MSB as the last bit by position, memory address or time.
```text
**Offset or Position: 0 1 2 3 4 5 6 7 Example: 11110000**
---------------------------------- --------
**Big-Endian Bit On Value:** 128 64 32 16 8 4 2 1 240
**Little-Endian Bit On Value:** 1 2 4 8 16 32 64 128 15
```
> The big-endian method compares exponents of 2<sup>7</sup> down to 2<sup>0</sup> while the little-endian method does the opposite.
**[_BYTE](_BYTE)**
* [INTEGER](INTEGER) values consist of 2 bytes called the **HI** and **LO** bytes. Anytime that the number of binary digits is a multiple of 16 (2bytes, 4 bytes, etc.) and the HI byte's MSB is on(1), the value returned will be negative. Even with [SINGLE](SINGLE) or [DOUBLE](DOUBLE) values!
```text
**16 BIT INTEGER OR REGISTER**
**AH (High Byte Bits) AL (Low Byte Bits)**
BIT: 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0
---------------------------------------|--------------------------------------
HEX: 8000 4000 2000 1000 800 400 200 100 | 80 40 20 10 8 4 2 1
|
DEC: -32768 16384 8192 4096 2048 1024 512 256 | 128 64 32 16 8 4 2 1
```
> The HI byte's **MSB** is often called the **sign** bit! When all 16 of the integer binary bits are on, the decimal return is -1.
## Example(s)
Shifting bits in a value in QB64 versions prior to 1.3 (you can use [_SHL](_SHL) and [_SHR](_SHR) starting with version 1.3).
```vb
n = 24
Shift = 3
PRINT LShift(n, Shift)
PRINT RShift(n, Shift)
END
FUNCTION LShift&(n AS LONG, LS AS LONG)
IF LS < 0 THEN EXIT FUNCTION
LShift = INT(n * (2 ^ LS))
END FUNCTION
FUNCTION RShift&(n AS LONG, RS AS LONG)
IF RS < 0 THEN EXIT FUNCTION
RShift = INT(n / (2 ^ RS))
END FUNCTION
```
```text
192
3
```
## See Also
* [&B](&B) (binary), [_BYTE](_BYTE)
* [_SHL](_SHL), [_SHR](_SHR)
* [_DEFINE](_DEFINE), [_UNSIGNED](_UNSIGNED)
* [DIM](DIM)
* [Binary](Binary), [Boolean](Boolean)
* [Variable Types](Variable-Types)
* [Converting Bytes to Bits](Converting-Bytes-to-Bits)

View file

@ -1,15 +0,0 @@
The [_BLEND (function)](_BLEND-(function)) function returns enabled or disabled for the current window or a specified image handle when 32 bit.
## Syntax
> result% = [_BLEND (function)](_BLEND-(function)) [(imageHandle&)]
## Description
* _BLEND returns -1 if enabled or 0 if disabled by [_DONTBLEND](_DONTBLEND) statement.
* **Note: [_DONTBLEND](_DONTBLEND) is faster than the default [_BLEND](_BLEND) unless you really need to use it in 32 bit.**
## See Also
* [_DONTBLEND](_DONTBLEND), [_BLEND](_BLEND)
* [Images](Images)

View file

@ -1,64 +0,0 @@
The [_BLEND](_BLEND) statement turns on 32 bit alpha blending for an image or screen mode and is on by default.
## Syntax
> [_BLEND](_BLEND) [imageHandle&]
### Parameters
* imageHandle& refers to an image in memory. If not specified, the current destination page (See [_DEST](_DEST)) is affected.
## Description
* Alpha blending is on by default when loading a .PNG image to a 32-bit surface.
* Normally it is used to turn blending on after a previous [_DONTBLEND](_DONTBLEND) call.
* [_BLEND](_BLEND) can only be used on 32-bit surfaces, otherwise it will produce the error [ERROR Codes](ERROR-Codes).
* **Note: [_DONTBLEND](_DONTBLEND) is faster than the default [_BLEND](_BLEND) unless you really need to use it in 32 bit.**
* **32 bit screen surface backgrounds (black) have zero [_ALPHA](_ALPHA) so that they are transparent when placed over other surfaces.**
## Example(s)
```vb
SCREEN _NEWIMAGE(640, 480, 32)
'CLS , _RGB(128, 128, 128) 'change background color for other results
_DONTBLEND
bg& = POINT(0, 0)
PRINT _RED(bg&), _GREEN(bg&), _BLUE(bg&), _ALPHA(bg&)
LINE (100, 100)-(200, 200), _RGBA32(255, 128, 0, 128), BF
LINE (440, 100)-(540, 200), _RGBA32(0, 0, 255, 64), BF
K$ = INPUT$(1)
_BLEND
LINE (270, 300)-(370, 400), _RGBA32(255, 128, 0, 128), BF
m& = POINT(303, 302)
PRINT _RED(m&), _GREEN(m&), _BLUE(m&), _ALPHA(m&)
K$ = INPUT$(1)
LINE (270, 300)-(370, 400), _RGBA32(0, 0, 255, 64), BF
m& = POINT(303, 302)
PRINT _RED(m&), _GREEN(m&), _BLUE(m&), _ALPHA(m&)
```
```text
_RGBA(255,128,0,128) onto _RGBA(0,0,255,64)
results in
_RGBA(95,48,64,128)
```
## See Also
* [_DONTBLEND](_DONTBLEND), [_BLEND (function)](_BLEND-(function))
* [Images](Images)

View file

@ -1,31 +0,0 @@
The [_BLINK](_BLINK) function returns the current blink setting for SCREEN 0 colors. If enabled, returns -1 (default), otherwise returns 0.
## Syntax
> blinkState%% = [_BLINK](_BLINK)
## Availability
* Build 20170816/61 and up.
## Example(s)
```vb
COLOR 16, 7
'Try uncommenting the line below:
'_BLINK OFF
IF _BLINK THEN
PRINT "I'm blinking"
ELSE
PRINT "I'm not blinking"
END IF
```
## See Also
* [_BLINK](_BLINK) (statement)
* [OUT](OUT)

View file

@ -1,35 +0,0 @@
The [_BLINK](_BLINK) statement toggles blinking colors in text mode (SCREEN 0). Default state is ON.
## Syntax
> [_BLINK](_BLINK) {ON|OFF}
## Description
* SCREEN 0 emulates the VGA palette with regular colors from 0 to 15 and blinking colors from 16-31 (these are the same colors as 0-15, except their blink attribute is set to on). [_BLINK](_BLINK) OFF emulates writing to the video memory and disabling blinking for colors 16-31.
* Using colors 16-31 for the foreground with [_BLINK](_BLINK) set to OFF will produce high intensity background colors.
* [_BLINK](_BLINK) is only effective in SCREEN 0. It's ignored in graphic modes.
* IF [_DISPLAY](_DISPLAY) is used, blinking is disabled, even if _BLINK is ON, but high intensity backgrounds aren't enabled in this case.
## Availability
* Build 20170816/61 up (August 16, 2017).
## Example(s)
```vb
COLOR 16, 7
PRINT "This is printed in black over gray background. Black letters are blinking."
PRINT "Hit a key..."
SLEEP
_BLINK OFF
PRINT "Now the same text is printed in black over bright white, because blinking was disabled."
```
## See Also
* [_BLINK (function)](_BLINK-(function))
* [OUT](OUT)
* [_DISPLAY](_DISPLAY)

View file

@ -1,27 +0,0 @@
The [_BLUE](_BLUE) function returns the palette intensity or the blue component intensity of a 32-bit image color.
## Syntax
> blueintensity& = [_BLUE](_BLUE)(rgbaColorIndex&[, imageHandle&])
## Description
* rgbaColorIndex& is the *RGBA* color value or palette index of the color to retrieve the blue component intensity from.
* The [LONG](LONG) intensity value returned ranges from 0 (no intensity, not present) to 255 (full intensity).
* If imageHandle& specifies a 32-bit color image, rgbaColorIndex& is interpreted as a 32-bit *RGBA* color value.
* If imageHandle& specifies an image that uses a palette, rgbaColorIndex& is interpreted as a palette index.
* If imageHandle& is not specified, it is assumed to be the current write page.
* If imageHandle& is an invalid handle, an [ERROR Codes](ERROR-Codes) error will occur.
* If rgbaColorIndex& is outside the range of valid indexes for a given image mode, an [ERROR Codes](ERROR-Codes) error occurs.
* Uses index parameters passed by the [_RGB](_RGB), [_RGBA](_RGBA), [_RGB32](_RGB32) or [_RGBA32](_RGBA32) funtions.
* An image handle is optional.
## Example(s)
* See the example for [POINT](POINT).
## See Also
* [_RED](_RED), [_GREEN](_GREEN)
* [_RGB](_RGB), [RGB32](RGB32)
* [_LOADIMAGE](_LOADIMAGE)

View file

@ -1,20 +0,0 @@
The [_BLUE32](_BLUE32) function returns the blue component intensity of a 32-bit image or surface color.
## Syntax
> blue32color& = [_BLUE32](_BLUE32)(rgbaColor&)
## Description
* rgbaColor& is the 32-bit *RGBA* color value to retrieve the blue component intensity value from.
* *RGBA* color values are returned by the [_PALETTECOLOR (function)](_PALETTECOLOR-(function)), [POINT](POINT), [_RGB](_RGB), [_RGB32](_RGB32), [_RGBA](_RGBA) or [_RGBA32](_RGBA32) functions.
* [LONG](LONG) intensity values returned range from 0 (no intensity, not present) to 255 (full intensity).
## Example(s)
* See the example for [POINT](POINT).
## See Also
* [_RED32](_RED32), [_GREEN32](_GREEN32)
* [_RGB32](_RGB32), [_BLUE](_BLUE)

View file

@ -1,54 +0,0 @@
The [_BUTTON](_BUTTON) function returns -1 when specified button number on a controller device is pressed.
## Syntax
> press%% = [_BUTTON](_BUTTON)(button_number%)
## Description
* The **[_DEVICEINPUT](_DEVICEINPUT) function should be read first to specify which device [_BUTTON](_BUTTON) is intended to check.**
* Values returned are -1 for a press and 0 when a button is released or not pressed.
* The button_number% must be a number which does not exceed the number of buttons found by the [_LASTBUTTON](_LASTBUTTON) function.
* **The number of [_DEVICES](_DEVICES) must be read before using [_DEVICE$](_DEVICE$), [_DEVICEINPUT](_DEVICEINPUT) or [_LASTBUTTON](_LASTBUTTON).**
* **Note:** The number 2 button is the center button in this device configuration. Center is also designated as [_MOUSEBUTTON](_MOUSEBUTTON)(3).
## Example(s)
Reading multiple controller device buttons, axis and wheels.
```vb
FOR i = 1 TO _DEVICES
PRINT STR$(i) + ") " + _DEVICE$(i) + " Buttons:"; _LASTBUTTON(i); ",Axis:"; _LASTAXIS(i); ",Wheel:"; _LASTWHEEL(i)
NEXT
DO
d& = _DEVICEINPUT
IF d& THEN ' the device number cannot be zero!
PRINT "Found"; d&;
FOR b = 1 TO _LASTBUTTON(d&)
PRINT _BUTTONCHANGE(b); _BUTTON(b);
NEXT
FOR a = 1 TO _LASTAXIS(d&)
PRINT _AXIS(a);
NEXT
FOR w = 1 TO _LASTWHEEL(d&)
PRINT _WHEEL(w);
NEXT
PRINT
END IF
LOOP UNTIL INKEY$ = CHR$(27) 'escape key exit
END
```
> *Note:* When there is no device control to read, a [FOR...NEXT](FOR...NEXT) n = 1 TO 0 loop will not run thus avoiding a control function read error.
## See Also
* [_LASTWHEEL](_LASTWHEEL), [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS)
* [_AXIS](_AXIS), [_WHEEL](_WHEEL), [_BUTTONCHANGE](_BUTTONCHANGE)
* [_DEVICE$](_DEVICE$), [_DEVICES](_DEVICES)
* [_MOUSEBUTTON](_MOUSEBUTTON)
* [Controller Devices](Controller-Devices)

View file

@ -1,54 +0,0 @@
The [_BUTTONCHANGE](_BUTTONCHANGE) function returns -1 or 1 when a specified button number on a controller device has been pressed or released.
## Syntax
> press% = [_BUTTONCHANGE](_BUTTONCHANGE)(button_number%)
## Description
* The **[_DEVICEINPUT](_DEVICEINPUT) function should be read first to specify which device [_BUTTONCHANGE](_BUTTONCHANGE) is intended to check.**
* Values returned are -1 for a press and 1 when a button is released. No press or release event returns zero.
* The button_number% must be a number which does not exceed the number of buttons found by the [_LASTBUTTON](_LASTBUTTON) function.
* **The number of [_DEVICES](_DEVICES) must be read before using [_DEVICE$](_DEVICE$), [_DEVICEINPUT](_DEVICEINPUT) or [_LASTBUTTON](_LASTBUTTON).**
* **Note:** The center mouse button is button number 2. Center can also be read using [_MOUSEBUTTON](_MOUSEBUTTON)(3).
## Example(s)
Reading multiple controller device buttons, axis and wheels.
```vb
FOR i = 1 TO _DEVICES
PRINT STR$(i) + ") " + _DEVICE$(i) + " Buttons:"; _LASTBUTTON(i); ",Axis:"; _LASTAXIS(i); ",Wheel:"; _LASTWHEEL(i)
NEXT
DO
d& = _DEVICEINPUT
IF d& THEN ' the device number cannot be zero!
PRINT "Found"; d&;
FOR b = 1 TO _LASTBUTTON(d&)
PRINT _BUTTONCHANGE(b); _BUTTON(b);
NEXT
FOR a = 1 TO _LASTAXIS(d&)
PRINT _AXIS(a);
NEXT
FOR w = 1 TO _LASTWHEEL(d&)
PRINT _WHEEL(w);
NEXT
PRINT
END IF
LOOP UNTIL INKEY$ = CHR$(27) 'escape key exit
END
```
> *Note:* When there is no device control to read, a [FOR...NEXT](FOR...NEXT) n = 1 TO 0 loop will not run thus avoiding a control function read error.
## See Also
* [_LASTWHEEL](_LASTWHEEL), [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS)
* [_AXIS](_AXIS), [_WHEEL](_WHEEL), [_BUTTON](_BUTTON)
* [_DEVICE$](_DEVICE$), [_DEVICES](_DEVICES)
* [_MOUSEBUTTON](_MOUSEBUTTON)
* [Controller Devices](Controller-Devices)

View file

@ -1,111 +0,0 @@
A [_BYTE](_BYTE) variable can hold signed variable values from -128 to 127 (one byte or 8 [_BIT](_BIT)s). [_UNSIGNED](_UNSIGNED) from 0 to 255.
## Syntax
> [DIM](DIM) byte [AS](AS) [[_UNSIGNED]([_UNSIGNED)] [[_BYTE]]
## Description
* Signed _BYTE values can range from -128 to 127.
* [_UNSIGNED](_UNSIGNED) _BYTEs can hold values from 0 to 255. [_UNSIGNED](_UNSIGNED) expands the range of positive values.
* Can be defined in a **QB64** [_DEFINE](_DEFINE) statement using a starting letter range of variable names.
* Also can be used in a subroutine parameter [AS](AS) _BYTE variable definitions.
* Define a byte using the suffix %% after the variable name: variable%% = -54
* Define an unsigned byte by adding the suffix ~%% after the variable name: variable~%% = 54
* **When a variable has not been assigned or has no type suffix, the value defaults to [SINGLE](SINGLE).**
**[_BIT](_BIT)**
* The **MSB** is the most significant(largest) bit value and **LSB** is the least significant bit of a binary or register memory address value. The order in which the bits are read determines the binary or decimal byte value. There are two common ways to read a byte:
* **"Big-endian"**: MSB is the first bit encountered, decreasing to the LSB as the last bit by position, memory address or time.
* **"Little-endian"**: LSB is the first bit encountered, increasing to the MSB as the last bit by position, memory address or time.
```text
**Offset or Position: 0 1 2 3 4 5 6 7 Example: 11110000**
---------------------------------- --------
**Big-Endian Bit On Value:** 128 64 32 16 8 4 2 1 240
**Little-Endian Bit On Value:** 1 2 4 8 16 32 64 128 15
```
> The big-endian method compares exponents of 2<sup>7</sup> down to 2<sup>0</sup> while the little-endian method does the opposite.
**[_BYTE](_BYTE)**
* [INTEGER](INTEGER) values consist of 2 bytes called the **HI** and **LO** bytes. Anytime that the number of binary digits is a multiple of 16 (2bytes, 4 bytes, etc.) and the HI byte's MSB is on(1), the value returned will be negative. Even with [SINGLE](SINGLE) or [DOUBLE](DOUBLE) values!
```text
**16 BIT INTEGER OR REGISTER**
**AH (High Byte Bits) AL (Low Byte Bits)**
BIT: 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0
---------------------------------------|--------------------------------------
HEX: 8000 4000 2000 1000 800 400 200 100 | 80 40 20 10 8 4 2 1
|
DEC: -32768 16384 8192 4096 2048 1024 512 256 | 128 64 32 16 8 4 2 1
```
> The HI byte's **MSB** is often called the **sign** bit! When all 16 of the integer binary bits are on, the decimal return is -1.
## Example(s)
> How negative assignments affect the _UNSIGNED value returned by a byte (8 bits).
```vb
DIM unsig AS _UNSIGNED _BYTE
DIM sig AS _BYTE
CLS
unsig = 1
sig = 1
PRINT "00000001 = unsigned & signed are both" + STR$(unsig AND sig)
unsig = 127
sig = 127
PRINT "&B01111111 = unsigned & signed are both" + STR$(unsig AND sig)
unsig = 255
sig = 255
PRINT "&B11111111 = unsigned is" + STR$(unsig) + " but signed is " + STR$(sig)
unsig = 254
sig = 254
PRINT "&B11111110 = unsigned is" + STR$(unsig) + " but signed is " + STR$(sig)
unsig = 253
sig = 253
PRINT "&B11111101 = unsigned is" + STR$(unsig) + " but signed is " + STR$(sig)
PRINT
PRINT "The signed value needs the MSB bit for the sign."
PRINT "The most significant bit is furthest to the left."
```
```text
&B00000001 = unsigned & signed are both 1
&B01111111 = unsigned & signed are both 127
&B11111111 = unsigned is 255 but signed is -1
&B11111110 = unsigned is 254 but signed is -2
&B11111101 = unsigned is 253 but signed is -3
The signed value needs the MSB bit for the sign.
The most significant bit is furthest to the left.
```
## See Also
* [_BIT](_BIT), [&B](&B)
* [_DEFINE](_DEFINE), [DIM](DIM)
* [_UNSIGNED](_UNSIGNED)
* [_SHL](_SHL), [_SHR](_SHR)
* [Mathematical Operations](Mathematical-Operations)
* [Screen Memory](Screen-Memory)
* [Variable Types](Variable-Types)
* [Converting Bytes to Bits](Converting-Bytes-to-Bits)

View file

@ -1,15 +0,0 @@
The [_CAPSLOCK (function)](_CAPSLOCK-(function)) function returns the current state of the Caps Lock key as on (-1) or off (0).
## Syntax
> keyStatus%% = [_CAPSLOCK (function)](_CAPSLOCK-(function))
## Availability
* Version 1.4 and up.
* [Keywords currently not supported](Keywords-currently-not-supported-by-QB64).
## See Also
* [_NUMLOCK (function)](_NUMLOCK-(function)), [_SCROLLLOCK (function)](_SCROLLLOCK-(function))
* [_CAPSLOCK](_CAPSLOCK) (statement), [_NUMLOCK](_NUMLOCK) (statement), [_SCROLLLOCK](_SCROLLLOCK) (statement)

View file

@ -1,15 +0,0 @@
The [_CAPSLOCK](_CAPSLOCK) statement sets the state of the Caps Lock key.
## Syntax
> [_CAPSLOCK](_CAPSLOCK) {ON|OFF|_TOGGLE}
## Availability
* Version 1.4 and up.
* [Keywords currently not supported](Keywords-currently-not-supported-by-QB64).
## See Also
* [_CAPSLOCK (function)](_CAPSLOCK-(function)), [_NUMLOCK (function)](_NUMLOCK-(function)), [_SCROLLLOCK (function)](_SCROLLLOCK-(function))
* [_NUMLOCK](_NUMLOCK) (statement), [_SCROLLLOCK](_SCROLLLOCK) (statement)

View file

@ -1,37 +0,0 @@
The [_CEIL](_CEIL) function rounds a numeric value up to the next whole number or [INTEGER](INTEGER) value.
## Syntax
> result = [_CEIL](_CEIL)(expression)
* [_CEIL](_CEIL) returns he smallest integral value that is greater than the numerical expression (as a floating-point value).
* This means that [_CEIL](_CEIL) rounds up for both positive and negative numbers.
## Availability
* Version 1.000 and up.
## Example(s)
Displaying the rounding behavior of [INT](INT), [CINT](CINT) and [FIX](FIX) vs [_CEIL](_CEIL).
```vb
PRINT INT(2.5), CINT(2.5), FIX(2.5), _CEIL(2.5)
PRINT INT(-2.5), CINT(-2.5), FIX(-2.5), _CEIL(-2.5)
```
```text
2 2 2 3
-3 -2 -2 -2
```
## See Also
* [INT](INT), [FIX](FIX)
* [CINT](CINT), [CLNG](CLNG),
* [CSNG](CSNG), [CDBL](CDBL)
* [_ROUND](_ROUND)

View file

@ -1,60 +0,0 @@
The [_CINP](_CINP) function returns keyboard key press codes from a [$CONSOLE]($CONSOLE) window. Windows-only.
## Syntax
> keycode& = [_CINP](_CINP)
## Description
* Return values are the same as the ones for [INP](INP) when used to read keyboard input. See table below.
* **Negative** [LONG](LONG) values returned indicate that a key was released or a lock function key has been turned off.
* [Keywords currently not supported](Keywords-currently-not-supported-by-QB64).
```text
' **Extended Keyboard Press Scancodes**
'
**' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SysReq ScrL Pause**
' 1 59 60 61 62 63 64 65 66 67 68 87 88 0 70 29
' **`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSpc Insert Home PgUp NumL / * -**
' 41 2 3 4 5 6 7 8 9 10 11 12 13 14 82 71 73 69 53 55 74
' **Tab Q W E R T Y U I O P [{ ]} \| Delete End PgDn 7/Home 8/▲ 9/PU + **
' 15 16 17 18 19 20 21 22 23 24 25 26 27 43 83 79 81 71 72 73 78
' **CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-► E**
' 58 30 31 32 33 34 35 36 37 38 39 40 28 75 76 77 **n**
' **Shift Z X C V B N M ,< .> /? Shift ▲ 1/End 2/▼ 3/PD t**
' 42 44 45 46 47 48 49 50 51 52 53 54 72 79 80 81 **e**
' **Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0/Insert ./Del r**
' 29 91 56 57 56 92 93 29 75 80 77 82 83 28
'
```
## Example(s)
Reading individual key strokes from a console window (Windows).
```vb
$CONSOLE:ONLY
_DEST _CONSOLE: _SOURCE _CONSOLE
PRINT "Press any key, and I'll give you the scan code for it. <ESC> quits the demo."
PRINT
PRINT
DO
x = _CONSOLEINPUT
IF x = 1 THEN 'read only keyboard input ( = 1)
c = _CINP
PRINT c;
END IF
LOOP UNTIL c = 1
END
```
## See Also
* [$CONSOLE]($CONSOLE), [_CONSOLE](_CONSOLE)
* [_CONSOLEINPUT](_CONSOLEINPUT)
* [_MOUSEX](_MOUSEX), [_MOUSEY](_MOUSEY), [_MOUSEBUTTON](_MOUSEBUTTON), [_MOUSEWHEEL](_MOUSEWHEEL)

View file

@ -1,21 +0,0 @@
The [_CLEARCOLOR (function)](_CLEARCOLOR-(function)) function returns the current transparent color of an image or page.
## Syntax
> *result&* = [_CLEARCOLOR (function)](_CLEARCOLOR-(function)) [Source_Handle&]
## Description
* If Source_Handle& is omitted, it is assumed to be the current [_DEST](_DEST) write page.
* If Source_Handle& is an invalid handle value(-1), then an [ERROR Codes](ERROR-Codes) is returned.
* In color modes using a palette, the index of the current transparent color value is returned, or -1 if no transparent color is set.
* In 32-bit color modes, zero is returned.
* Returns the color that currently is transparent, or if no color is transparent -1 without error.
* A [_CLEARCOLOR](_CLEARCOLOR) statement can set the transparent color of an image or screen.
* **NOTE: Default 32 bit backgrounds are clear black or [_RGBA](_RGBA)(0, 0, 0, 0). Use [CLS](CLS) to make the black opaque.**
## See Also
* [_CLEARCOLOR](_CLEARCOLOR) (sets a clear color)
* [_SETALPHA](_SETALPHA) (sets color transparency)
* [Images](Images)

View file

@ -1,99 +0,0 @@
The [_CLEARCOLOR](_CLEARCOLOR) statement sets a specific color to be treated as transparent when an image is later put (via [_PUTIMAGE](_PUTIMAGE)) onto another image.
## Syntax
> [_CLEARCOLOR](_CLEARCOLOR) {color&|_NONE}[, Dest_Handle&]
## Parameter(s)
* In color modes using a palette, color& is the palette index of the new transparent color value or _NONE designates no clear colors.
* If color& is not a valid palette index, an [ERROR Codes](ERROR-Codes) error will occur.
* In 32-bit color modes, color& is the [_LONG](_LONG) color value of the new transparent color.
* If Dest_Handle& is omitted, the destination is assumed to be the current write page. Zero can designate the current program screen.
## Description
* If Dest_Handle& is an invalid handle, then an [ERROR Codes](ERROR-Codes) error is returned. Check for bad handle values of -1 first.
* In 32-bit color modes, it simply sets the Alpha to 0 for all pixels matching the specified color.
* In the second syntax, transparency is disabled for color modes using a palette.
* **Note:** [_SETALPHA](_SETALPHA) can affect any _CLEARCOLOR alpha setting within the color range set.
* **NOTE: 32 bit [_NEWIMAGE](_NEWIMAGE) screen page backgrounds are transparent black or [_ALPHA](_ALPHA) 0. Use [_DONTBLEND](_DONTBLEND) or [CLS](CLS) for opaque.**
## Example(s)
Using _CLEARCOLOR to "mask" the background color of an image.
```vb
SCREEN 13
img& = _LOADIMAGE("qb64_trans.png")
_PUTIMAGE , img&, 0 'place actual image with background
K$ = INPUT$(1)
CLS , _RGB(255, 0, 0) 'clear screen with red background
_CLEARCOLOR _RGB(255, 255, 255), img&
_PUTIMAGE , img&, 0 'place image without white background
PRINT _CLEARCOLOR(img&) 'displays closest clear color attribute
END
```
Using a _CLEARCOLOR transparency with images created on a [_NEWIMAGE](_NEWIMAGE) page. Does not require an image file.
```vb
SCREEN _NEWIMAGE(512, 384, 32) ' screen uses handle value
CIRCLE(50, 50), 50, _RGB(128, 0, 0) ' create a red ball image
PAINT(50, 50), _RGB(255, 0, 0), _RGB(128, 0, 0)
redball = _NEWIMAGE(101, 101, 32) ' create a new image page
_PUTIMAGE , 0, redball,(0, 0)-(101, 101) ' put screen page 0 image onto redball page
_CLEARCOLOR _RGB(0, 0, 0), redball ' makes black become see-through
CLS, _RGB(0, 0, 255) ' erase original ball and create a blue background
DO
_PUTIMAGE (RND * 512, RND * 384), redball
SLEEP 1 ' one second delay
LOOP UNTIL INKEY$ <> ""
```
Fading an image with a _CLEARCOLOR background using a new page image to prevent [_SETALPHA](_SETALPHA) changes.
```vb
mainscreen = _NEWIMAGE(640, 480, 32) ' Main Screen (viewable)
SCREEN mainscreen
_SCREENMOVE _MIDDLE
Image1& = _LOADIMAGE("qb64_trans.png") '<<<<<< any image with one background color to clear
IF Image1& < -1 THEN 'check loaded image handle value before using!
_SOURCE Image1&
clr~& = POINT(0, 0) 'get background color from image source
_CLEARCOLOR clr~&, Image1& 'clear background color of loaded image
NewImage1& = _NEWIMAGE(_WIDTH(Image1&), _HEIGHT(Image1&), 32) 'new image page
_PUTIMAGE , Image1&, NewImage1& 'put image without background color on new page
_FREEIMAGE Image1& 'free loaded image from memory
END IF
_DEST mainscreen:
a& = 0: d = 1
DO
_LIMIT 10 'regulate speed of fades
CLS
a& = a& + d
IF a& = 255 THEN d = -d 'reverse fade
_SETALPHA a&, , NewImage1& 'sets alpha level of all colors to fade image page in/out
_PUTIMAGE (0, 342), NewImage1&
LOCATE 1, 1: PRINT "Alpha: "; a&
_DISPLAY
LOOP UNTIL a& = 0
END
```
> *Note:* If the _CLEARCOLOR background was not put onto a separate page, [_SETALPHA](_SETALPHA) would display it also.
## See Also
* [_CLEARCOLOR (function)](_CLEARCOLOR-(function))
* [_SETALPHA](_SETALPHA) (sets transparency level)
* [_ALPHA](_ALPHA), [_ALPHA32](_ALPHA32) (read functions)
* [Images](Images), [Creating Sprite Masks](Creating-Sprite-Masks)

View file

@ -1,48 +0,0 @@
The [_CLIP](_CLIP) option is used in a QB64 graphics [PUT (graphics statement)](PUT-(graphics-statement)) to allow placement of an image partially off of the screen.
## Syntax
> [PUT (graphics statement)](PUT-(graphics-statement)) [[STEP]([STEP)](column, row), image_array(start)[, [[_CLIP]]] [{XOR|PSET|AND|OR|PRESET}][, omitcolor]
## Description
* _CLIP should be placed immediately before the PUT action if used. XOR is default when not used.
* The offscreen portions of the image will be the omit color.
* [GET (graphics statement)](GET-(graphics-statement)) can get portions of the images off screen in **QB64**.
## Example(s)
Placing an image partially or fully offscreen.
```vb
DIM mypic(500)
SCREEN 13
CLS
CIRCLE (10,10),10
GET (0,0)-(20,20), mypic(0)
PRINT "This program puts an image off screen."
PRINT "Select which option you'd like to try."
PRINT "1 will produce an illegal function call."
PRINT "1 is putting without _CLIP."
PRINT "2 is putting with _CLIP PSET."
PRINT "3 is putting with _CLIP XOR."
PRINT "4 is putting with _CLIP PSET, 4."
INPUT sel
IF sel = 1 THEN PUT (-10, 10), mypic(0), PSET ' this causes an illegal function call
IF sel = 2 THEN PUT (-10, 10), mypic(0), _CLIP PSET ' allows graphic to be drawn off-screen
IF sel = 3 THEN PUT (-10, 10), mypic(0), _CLIP ' uses the default PUT XOR operation
IF sel = 4 THEN PUT (-10, 10), mypic(0), _CLIP PSET, 4 ' doesn't draw red pixels
END
```
## See Also
* [PUT (graphics statement)](PUT-(graphics-statement))
* [GET (graphics statement)](GET-(graphics-statement))
* [STEP](STEP)

View file

@ -1,45 +0,0 @@
The [_CLIPBOARD$ (statement)](_CLIPBOARD$-(statement)) statement copies the specified [STRING](STRING) value into the operating system's clipboard.
## Syntax
> [_CLIPBOARD$ (statement)](_CLIPBOARD$-(statement)) = string_expression$
## Description
* string_expression$ is the string value to be sent to the clipboard.
* The string value will replace everything previously in the clipboard.
* Assemble long text into one string variable value before using this statement.
* Add CHR$(13) + CHR$(10) CRLF characters to move to a new clipboard line.
* When copying text files, end line CRLF characters 13 and 10 do not have to be added.
* Numerical values can be converted to strings using [STR$](STR$), [_MK$](_MK$), [MKI$](MKI$), [MKL$](MKL$), [MKS$](MKS$), [MKD$](MKD$), [HEX$](HEX$) or [OCT$](OCT$).
* The clipboard can be used to copy, paste and communicate between running programs.
## Example(s)
Set 2 lines of text in the clipboard using a carriage return to end text lines
```vb
DIM CrLf AS STRING * 2 'define as 2 byte STRING
CrLf = CHR$(13) + CHR$(10) 'carriage return & line feed
_CLIPBOARD$ = "This is line 1" + CrLf + "This is line 2"
PRINT _CLIPBOARD$ 'display what is in the clipboard
```
```text
This is line 1
This is line 2
```
> *Note:* The text in the clipboard could also be sent to a file using [PRINT (file statement)](PRINT-(file-statement)) [_CLIPBOARD$](_CLIPBOARD$).
## See Also
* [_CLIPBOARD$](_CLIPBOARD$) (function)
* [_CLIPBOARDIMAGE (function)](_CLIPBOARDIMAGE-(function)), [_CLIPBOARDIMAGE](_CLIPBOARDIMAGE) (statement)
* [CHR$](CHR$), [ASCII](ASCII) (code table)

View file

@ -1,150 +0,0 @@
The [_CLIPBOARD$](_CLIPBOARD$) function returns the current operating system's clipboard contents as a [STRING](STRING).
## Syntax
> result$ = [_CLIPBOARD$](_CLIPBOARD$)
## Description
* Text returned can contain the entire contents of a copied file or web page or text from a previous [_CLIPBOARD$ (statement)](_CLIPBOARD$-(statement)) statement.
* The string returned can also contain formatting like CRLF ([CHR$](CHR$)(13) + [CHR$](CHR$)(10)) end of line characters.
* The clipboard can be used to copy, paste and communicate between running programs.
## Example(s)
Passing a string value between two running programs no matter where they are located.
> *Program1:*
```vb
PRINT "Start Program2 to read your text entries! Empty entry quits!"
_CLIPBOARD$ = "Entry program started!" 'set clipboard initially
DO
LINE INPUT "Enter some text to send to other program: ", text$
IF text$ = "" THEN EXIT DO
_CLIPBOARD$ = text$
LOOP
SYSTEM
```
> *Program2:*
```vb
PRINT "Enter text in Program1 and this program will read it. Esc key quits!"
DO: _LIMIT 100
text$ = _CLIPBOARD$ 'function returns clipboard contents
IF LEN(text$) THEN
PRINT text$
_CLIPBOARD$ = "" 'clear clipboard after a read
END IF
LOOP UNTIL INKEY$ = CHR$(27)
END
```
> *Explanation:* Compile and run both programs at once to see the interaction. You could also run them on different paths.
A minimized program that pops up when Ctrl + Shift is entered anytime in **Windows** and adds clipboard text to be Pasted:
```vb
'"ClippyBoard" program uses GetKeyState Win API to monitor a specific key combination.
'This demo will maximize the window and focus on program when Shift+A is pressed.
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION FindWindowA%& (BYVAL ClassName AS _OFFSET, WindowName$) 'find process handle by title
FUNCTION GetKeyState% (BYVAL nVirtKey AS LONG) 'Windows virtual key presses
FUNCTION ShowWindow& (BYVAL hwnd AS _OFFSET, BYVAL nCmdShow AS LONG) 'maximize process
FUNCTION GetForegroundWindow%& 'find currently focused process handle
FUNCTION SetForegroundWindow& (BYVAL hwnd AS _OFFSET) 'set foreground window process(focus)
END DECLARE
title$ = "Clippy Clipboard (Ctrl+Shift)" 'title of program window
_TITLE title$ 'set program title
hwnd%& = FindWindowA(0, title$ + CHR$(0)) 'find this program's process handle
SCREEN 13
_SCREENMOVE _MIDDLE
COLOR 10: PRINT
PRINT " Press Ctrl+Shift to see clipboard menu."
_DELAY 4
x& = ShowWindow&(hwnd%&, 2) 'minimize
DO: _LIMIT 30 'save CPU usage while waiting for key press
IF GetKeyState(16) < 0 AND GetKeyState(17) < 0 THEN '<==== Shift+A
FGwin%& = GetForegroundWindow%& 'get current process in focus
y& = ShowWindow&(hwnd%&, 1) 'maximize minimized program
IF FGwin%& <> hwnd%& THEN z& = SetForegroundWindow&(hwnd%&) 'set focus when necessary
_DELAY 1
GetKey
x& = ShowWindow&(hwnd%&, 2) 'minimize after letter key entry
COLOR 10: PRINT
PRINT " Press Ctrl+Shift to see clipboard menu."
END IF
LOOP
SUB GetKey
CLS
COLOR 12: PRINT: PRINT _CLIPBOARD$
DO: LOOP UNTIL INKEY$ = ""
_DELAY 1
CLS
COLOR 11: PRINT "Select a letter clipboard option:"
PRINT
PRINT "A = Address"
PRINT "C = Cell phone"
PRINT "E = Email"
PRINT "F = First Name"
PRINT "H = Home phone"
PRINT "L = Last Name"
PRINT "N = Name"
PRINT "M = MAC address"
PRINT "P = Password"
PRINT "W = Work name"
PRINT "X = QUIT!"
PRINT "Z = Zip code"
COLOR 14: PRINT
PRINT "Another letter will skip or X = EXIT!"
K$ = UCASE$(INPUT$(1))
SELECT CASE K$ 'The following text should be your personal user info:
CASE "A": _CLIPBOARD$ = "my address"
CASE "C": _CLIPBOARD$ = "cell number"
CASE "E": _CLIPBOARD$ = "myemail"
CASE "F": _CLIPBOARD$ = "formal name"
CASE "H": _CLIPBOARD$ = "home number"
CASE "L": _CLIPBOARD$ = "lastname"
CASE "M": _CLIPBOARD$ = "modempassword"
CASE "N": _CLIPBOARD$ = "name"
CASE "P": _CLIPBOARD$ = "password"
CASE "X": END
CASE "Z": _CLIPBOARD$ = "zipcode"
END SELECT
CLS
PRINT
PRINT
COLOR 14: PRINT _CLIPBOARD$
BEEP
_DELAY 2
END SUB
```
> *Explanation:* The program will run minimized until Ctrl + Shift is entered and will pop up to ask for a letter choice that contains the text you want in the clipboard. More letter choices can be added. Text can be pasted into a web page or entry box and the program will minimize until it is needed later. The program uses very little resources!
## See Also
* [_CLIPBOARD$ (statement)](_CLIPBOARD$-(statement))
* [_CLIPBOARDIMAGE (function)](_CLIPBOARDIMAGE-(function)), [_CLIPBOARDIMAGE](_CLIPBOARDIMAGE) (statement)

View file

@ -1,50 +0,0 @@
The [_CLIPBOARDIMAGE (function)](_CLIPBOARDIMAGE-(function)) function pastes an image from the clipboard into a new 32-bit image in memory.
## Syntax
> newImageHandle& = [_CLIPBOARDIMAGE (function)](_CLIPBOARDIMAGE-(function))
## Description
* When the paste operation is successful, newImageHandle& will be < -1. Handle values of -1 or 0 indicate that there wasn't an image in the clipboard or that the format wasn't accepted.
* Use [_FREEIMAGE](_FREEIMAGE) to free the memory used by newImageHandle& when it's no longer needed by your program.
* [Keywords currently not supported](Keywords-currently-not-supported-by-QB64).
## Availability
* Build 20170906/64 and up.
## Example(s)
Monitoring the clipboard for new images copied from other programs:
```vb
SCREEN _NEWIMAGE(800, 600, 32)
DO
CLS
COLOR _RGB32(177, 177, 177)
PRINT "Monitoring clipboard..."
IF img& < -1 THEN _FREEIMAGE img&
img& = _CLIPBOARDIMAGE
IF img& < -1 THEN
PRINT "Image found:"
COLOR _RGB32(255, 255, 255)
PRINT "Width :"; _WIDTH(img&)
PRINT "Height:"; _HEIGHT(img&)
w = _WIDTH / 2 - _WIDTH(img&) / 2
IF w < 0 THEN w = 0
_PUTIMAGE (w, CSRLIN * _FONTHEIGHT), img&
ELSE
PRINT "No image found."
END IF
_DISPLAY
_LIMIT 10
LOOP
```
## See Also
* [_CLIPBOARDIMAGE](_CLIPBOARDIMAGE) (statement - used to copy an image to the clipboard)
* [_CLIPBOARD$](_CLIPBOARD$), [_CLIPBOARD$ (statement)](_CLIPBOARD$-(statement)) (used to copy/paste text)

View file

@ -1,55 +0,0 @@
The [_CLIPBOARDIMAGE](_CLIPBOARDIMAGE) statement copies a valid QB64 image to the clipboard.
## Syntax
> [_CLIPBOARDIMAGE](_CLIPBOARDIMAGE) = existingImageHandle&
## Description
* existingImageHandle& is a valid handle to a graphic QB64 image in memory, created with [_NEWIMAGE](_NEWIMAGE), [_LOADIMAGE](_LOADIMAGE) or [_COPYIMAGE](_COPYIMAGE).
* You can pass [_SOURCE](_SOURCE), [_DEST](_DEST) or [_DISPLAY](_DISPLAY) to copy the current source, destination or active display pages, as long as they are valid graphic images.
* SCREEN 0 handles (created either with [_NEWIMAGE](_NEWIMAGE) or passed using _DEST while in a text screen) are not valid and will create an [ERROR Codes](ERROR-Codes) or [ERROR Codes](ERROR-Codes) error.
* [Keywords currently not supported](Keywords-currently-not-supported-by-QB64).
## Availability
* Build 20170906/64 and up.
## Example(s)
Create a sample image and copy it to the clipboard:
```vb
SCREEN _NEWIMAGE(800, 600, 32)
'Create image in memory:
canvas& = _NEWIMAGE(300, 200, 32)
_DEST canvas&
'Draw some random rectangles:
RANDOMIZE TIMER
FOR i = 1 TO 100
LINE (-100 + RND * _WIDTH, -100 + RND * _HEIGHT)-STEP(RND * 150, RND * 150), _RGB(RND * 255, RND * 255, RND * 255), BF
NEXT
LINE (0, 0)-(_WIDTH - 1, _HEIGHT - 1), _RGB(255, 255, 255), B
COLOR _RGB(0, 0, 0), _RGB(255, 255, 255)
m$ = " Hello, world! "
_PRINTSTRING (_WIDTH / 2 - _PRINTWIDTH(m$) / 2, _HEIGHT / 2 - _FONTHEIGHT / 2), m$
'Show the image:
_DEST 0
_PUTIMAGE (_WIDTH / 2 - _WIDTH(canvas&) / 2, _HEIGHT / 2 - _HEIGHT(canvas&) / 2), canvas&
PRINT "Image generated."
'Copy to the clipboard:
_CLIPBOARDIMAGE = canvas&
PRINT "Image copied to clipboard."
```
## See Also
* [_CLIPBOARDIMAGE (function)](_CLIPBOARDIMAGE-(function)) (function - used to paste an image from the clipboard)
* [_CLIPBOARD$](_CLIPBOARD$), [_CLIPBOARD$ (statement)](_CLIPBOARD$-(statement)) (used to copy/paste text)

View file

@ -1,31 +0,0 @@
The [_COMMANDCOUNT](_COMMANDCOUNT) function returns the number or arguments passed from the command line to the [COMMAND$](COMMAND$) function.
## Syntax
> result& = [_COMMANDCOUNT](_COMMANDCOUNT)
## Description
* The function returns the number of arguments passed from the command line to a program when it's executed.
* Arguments are spaced as separate numerical or text values. Spaced text inside of quotes is considered as one argument.
* In C, this function would generally be regarded as 'argc' when the main program is defined as the following: **int main(int argc, char *argv[])**
## Example(s)
The code below gets the number of parameters passed to our program from the command line with _COMMANDCOUNT:
```vb
limit = _COMMANDCOUNT
FOR i = 1 TO limit
PRINT COMMAND$(i)
NEXT
```
> *Explanation:* If we start *ThisProgram.exe* from the command window with **ThisProgram -l "loadfile.txt" -s "savefile.txt"**, the _COMMANDCOUNT would be 4, "-l", "loadfile.txt", "-s", "savefile.txt" command arguments passed to the program, which we could then read separately with COMMAND$(n).
## See Also
* [COMMAND$](COMMAND$)
* [SHELL](SHELL)

View file

@ -1,22 +0,0 @@
The [_CONNECTED](_CONNECTED) function returns the status of a TCP/IP connection handle.
## Syntax
> result& = [_CONNECTED](_CONNECTED)(connectionHandle&)
## Description
* The handle can come from the [_OPENHOST](_OPENHOST), [OPENCLIENT](OPENCLIENT) or [_OPENCONNECTION](_OPENCONNECTION) QB64 TCP/IP functions.
* Returns -1 if still connected or 0 if connection has ended/failed.
* Do not rely solely on this function to check for ending communication.
* Use "time-out" checking as well and [CLOSE](CLOSE) any suspect connections.
* If this function indicates the handle is not connected, any unread messages can still be read using [GET (TCP/IP statement)](GET-(TCP-IP-statement)).
* Even if this function indicates the handle is not connected, it is important to [CLOSE](CLOSE) the connection anyway or important resources cannot be reallocated.
## See Also
* [_OPENCONNECTION](_OPENCONNECTION)
* [_OPENHOST](_OPENHOST)
* [_OPENCLIENT](_OPENCLIENT)
* [_CONNECTIONADDRESS$](_CONNECTIONADDRESS$)
* [Downloading Files](Downloading-Files)

View file

@ -1 +0,0 @@
See [_CONNECTIONADDRESS](_CONNECTIONADDRESS).

View file

@ -1,44 +0,0 @@
The [_CONNECTIONADDRESS](_CONNECTIONADDRESS) function returns a connected user's [STRING](STRING) IP address value.
## Syntax
> result$ = [_CONNECTIONADDRESS](_CONNECTIONADDRESS)](connectionHandle&)
## Description
* The handle can come from the [_OPENHOST](_OPENHOST), [OPENCLIENT](OPENCLIENT) or [_OPENCONNECTION](_OPENCONNECTION) QB64 TCP/IP functions.
* For **[_OPENHOST](_OPENHOST)s**: It may return "TCP/IP:8080:213.23.32.5" where 8080 is the port it is listening on and 213.23.32.5 is the global IP address which any computer connected to the internet could use to locate your computer. If a connection to the internet is unavailable or your firewall blocks it, it returns your 'local IP' address (127.0.0.1). You might like to store this address somewhere where other computers can find it and connect to your host. Dynamic IPs which can change will need to be updated.
* For **[_OPENCLIENT](_OPENCLIENT)s**: It may return "TCP/IP:8080:213.23.32.5" where 8080 is the port it used to connect to the listening host and 213.23.32.5 is the IP address of the host name it resolved.
* For **[_OPENCONNECTION](_OPENCONNECTION)s** (from clients): It may return "TCP/IP:8080:34.232.321.25" where 8080 was the host listening port it connected to and 34.232.321.25 is the IP address of the client that connected. This is very useful because the host can log the IP address of clients for future reference (or banning, for example).
* The $ symbol is optional for compatibility with older versions.
## Example(s)
A Host logging new chat clients in a Chat program. See the [_OPENHOST](_OPENHOST) example for the rest of the code used.
```vb
f = FREEFILE
OPEN "ChatLog.dat" FOR APPEND AS #f ' code at start of host section before DO loop.
newclient = _OPENCONNECTION(host) ' receive any new client connection handles
IF newclient THEN
numclients = numclients + 1 ' increment index
Users(numclients) = newclient ' place handle into array
IP$ = _CONNECTIONADDRESS(newclient)
PRINT IP$ + " has joined." ' displayed to Host only
PRINT #f, IP$, numclients ' print info to a log file
PRINT #Users(numclients),"Welcome!" ' from Host to new clients only
END IF
```
> *Explanation:* The function returns the new client's IP address to the IP$ variable. Prints the IP and the original login position to a log file. The information can later be used by the host for reference if necessary. The host could set up a ban list too.
## See Also
* [_OPENCONNECTION](_OPENCONNECTION)
* [_OPENHOST](_OPENHOST)
* [_OPENCLIENT](_OPENCLIENT)
* [_CONNECTED](_CONNECTED)
* [WGET](WGET) (HTTP and FTP file transfer)

View file

@ -1,64 +0,0 @@
The [_CONSOLE](_CONSOLE) statement can be used to turn a console window ON/OFF.
## Syntax
> [_CONSOLE](_CONSOLE) {OFF|ON}
> _DEST [_CONSOLE](_CONSOLE)
* [_CONSOLE](_CONSOLE) OFF or ON must be used after the [$CONSOLE]($CONSOLE) [Metacommand](Metacommand) has established that a console window is desired.
* [_CONSOLE](_CONSOLE) OFF turns the console window off once a console has been established using [$CONSOLE]($CONSOLE):ON or ONLY.
* [_CONSOLE](_CONSOLE) ON should only be used after the console window has been turned OFF previously.
* [_DEST](_DEST) [_CONSOLE](_CONSOLE) can be used to send screen output to the console window using QB64 commands such as [PRINT](PRINT).
* [_SCREENHIDE](_SCREENHIDE) or [_SCREENSHOW](_SCREENSHOW) can be used to hide or display the main program window.
* The [$SCREENHIDE]($SCREENHIDE) [Metacommand](Metacommand) can hide the main program window throughout a program when only the console is used.
* **Note:** Text can be copied partially or totally from console screens in Windows by highlighting and using the title bar menu.
* To copy console text output, right click the title bar and select *Edit* for *Mark* to highlight and repeat to *Copy*.
## Example(s)
Hiding and displaying a console window. Use [_DELAY](_DELAY) to place console in front of main program window.
```vb
$CONSOLE
_CONSOLE OFF 'close original console
_DELAY 2
_CONSOLE ON 'place console above program window
_DEST _CONSOLE
INPUT "Enter your name: ", nme$ 'get program input
_CONSOLE OFF 'close console
_DEST 0 'destination program window
PRINT nme$
END
```
> *Explanation:* The [_DEST](_DEST) must be changed with [_DEST](_DEST) [_CONSOLE](_CONSOLE) to get [INPUT](INPUT) from the [$CONSOLE]($CONSOLE) screen.
[_CONSOLETITLE](_CONSOLETITLE) can be used to create a console title, but it must be redone every time the console window is restored once turned off:
```vb
$CONSOLE
_CONSOLETITLE "firstone"
_DELAY 10
_CONSOLE OFF
_DELAY 10
_CONSOLE ON
_CONSOLETITLE "secondone"
```
> *Note:* Some versions of Windows may display the program path or Administrator: prefix in console title bars.
## See Also
* [$CONSOLE]($CONSOLE), [_CONSOLETITLE](_CONSOLETITLE)
* [$SCREENHIDE]($SCREENHIDE), [$SCREENSHOW]($SCREENSHOW) (QB64 [Metacommand](Metacommand)s)
* [_SCREENHIDE](_SCREENHIDE), [_SCREENSHOW](_SCREENSHOW)
* [_DEST](_DEST)

View file

@ -1,42 +0,0 @@
The [_CONSOLEINPUT](_CONSOLEINPUT) function is used to monitor any new mouse or keyboard input coming from a $CONSOLE window. It must be called in order for [_CINP](_CINP) to return valid values. Windows-only.
## Syntax
> infoExists%% = [_CONSOLEINPUT](_CONSOLEINPUT)
## Description
* Returns 1 if new keyboard information is available, 2 if mouse information is available, otherwise it returns 0.
* Must be called before reading any of the other mouse functions and before reading [_CINP](_CINP).
* To clear all previous input data, read [_CONSOLEINPUT](_CONSOLEINPUT) in a loop until it returns 0.
* To capture mouse input, turn off Quick Edit in the settings of command prompt and use [_SOURCE](_SOURCE) [_CONSOLE](_CONSOLE).
* [Keywords currently not supported](Keywords-currently-not-supported-by-QB64).
## Example(s)
Reading individual key strokes from a console window (Windows).
```vb
$CONSOLE:ONLY
_DEST _CONSOLE: _SOURCE _CONSOLE
PRINT "Press any key, and I'll give you the scan code for it. <ESC> quits the demo."
PRINT
PRINT
DO
x = _CONSOLEINPUT
IF x = 1 THEN 'read only keyboard input ( = 1)
c = _CINP
PRINT c;
END IF
LOOP UNTIL c = 1
END
```
## See Also
* [$CONSOLE]($CONSOLE), [_CONSOLE](_CONSOLE)
* [_CINP](_CINP), [Keyboard scancodes](Keyboard-scancodes)
* [_MOUSEX](_MOUSEX), [_MOUSEY](_MOUSEY), [_MOUSEBUTTON](_MOUSEBUTTON), [_MOUSEWHEEL](_MOUSEWHEEL)

View file

@ -1,34 +0,0 @@
The [_CONSOLETITLE](_CONSOLETITLE) statement sets the console window's title-bar text.
## Syntax
> [_CONSOLETITLE](_CONSOLETITLE) text$
## Parameter(s)
* *text$* can be any literal or variable [STRING](STRING) value.
## Example(s)
Hiding the main program window while displaying the console window with a title.
```vb
$SCREENHIDE
_DELAY 4
$CONSOLE
_CONSOLETITLE "Error Log"
_DEST _CONSOLE
PRINT "Errors go here! (fyi, this line is not an error)"
END
```
> *Note:* You can also use [SHELL](SHELL) "title consoletitle" to set the title of the console window. However, the recommended practice is to use [_CONSOLETITLE](_CONSOLETITLE).
## See Also
* [$CONSOLE]($CONSOLE), [_CONSOLE](_CONSOLE)
* [$SCREENHIDE]($SCREENHIDE), [$SCREENSHOW]($SCREENSHOW)
* [_SCREENHIDE](_SCREENHIDE), [_SCREENSHOW](_SCREENSHOW)

View file

@ -1,33 +0,0 @@
The [_CONTINUE](_CONTINUE) statement is used in a [DO...LOOP](DO...LOOP), [WHILE...WEND](WHILE...WEND) or [FOR...NEXT](FOR...NEXT) block to skip the remaining lines of code in a block (without exiting it) and start the next iteration. It works as a shortcut to a [GOTO](GOTO), but without the need for a [line numbers](line-numbers).
## Syntax
> [_CONTINUE](_CONTINUE)
## Availability
* Build 20170628/55 and up.
## Example(s)
```vb
FOR i = 1 TO 10
IF i = 5 THEN _CONTINUE
PRINT i;
NEXT
```
```text
1 2 3 4 6 7 8 9 10
```
## See Also
* [DO...LOOP](DO...LOOP)
* [WHILE...WEND](WHILE...WEND)
* [FOR...NEXT](FOR...NEXT)
* [GOTO](GOTO)

View file

@ -1,18 +0,0 @@
The [_CONTROLCHR (function)](_CONTROLCHR-(function)) function returns the current state of the [_CONTROLCHR](_CONTROLCHR) statement as -1 when OFF and 0 when ON.
## Syntax
> status% = [_CONTROLCHR (function)](_CONTROLCHR-(function))
## Description
* The function requires no parameters.
* Default return is 0 when the _CONTROLCHR statement has never been used previous to a function read.
* When the statement has been use to turn OFF control characters, the characters can be printed as text without screen formatting.
## See Also
* [_CONTROLCHR](_CONTROLCHR)
* [CHR$](CHR$), [ASC](ASC)
* [INKEY$](INKEY$), [_KEYHIT](_KEYHIT)
* [ASCII](ASCII) (codes)

View file

@ -1,48 +0,0 @@
The [_CONTROLCHR](_CONTROLCHR) statement can be used to turn OFF control character attributes and allow them to be printed.
## Syntax
> [_CONTROLCHR](_CONTROLCHR) {OFF|ON}
## Description
* The [OFF](OFF) clause allows control characters 0 to 31 to be printed and not format printing as normal text characters.
* For example: **PRINT CHR$(13)** 'will not move the cursor to the next line and **PRINT CHR$(9)** 'will not tab.
* The default [ON](ON) statement allows [ASCII](ASCII) to be used as control commands where some will not print or will format prints.
* **Note:** File prints may be affected also when using Carriage Return or Line Feed/Form Feed formatting.
* The QB64 IDE may allow Alt + number pad character entries, but they must be inside of [STRING](STRING) values. Otherwise the IDE may not recognize them.
## Example(s)
Printing the 255 [ASCII](ASCII) characters in [SCREEN](SCREEN) 0 with 32 colors.
```vb
DIM i AS _UNSIGNED _BYTE
WIDTH 40, 25
CLS
_CONTROLCHR OFF
i = 0
DO
PRINT CHR$(i);
i = i + 1
IF (i AND &HF) = 0 THEN PRINT
LOOP WHILE i
LOCATE 1, 20
DO
COLOR i AND &HF OR (i AND &H80) \ &H8, (i AND &H70) \ &H10
PRINT CHR$(i);
i = i + 1
IF (i AND &HF) = 0 THEN LOCATE 1 + i \ &H10, 20
LOOP WHILE i
END
```
## See Also
* [_CONTROLCHR (function)](_CONTROLCHR-(function))
* [CHR$](CHR$), [ASC](ASC)
* [INKEY$](INKEY$), [_KEYHIT](_KEYHIT)
* [ASCII](ASCII) (codes)
* [ASCII](ASCII)

View file

@ -1,75 +0,0 @@
The [_COPYIMAGE](_COPYIMAGE) function creates an identical designated image in memory with a different negative [LONG](LONG) handle value.
## Syntax
> newhandle& = [_COPYIMAGE](_COPYIMAGE)[(imageHandle&[, mode%)]]
## Parameter(s)
* The [LONG](LONG) *newhandle&* value returned will be different than the source handle value supplied.
* If *imageHandle&* parameter is omitted or zero is designated, the current software [_DEST](_DEST) screen or image is copied.
* If 1 is designated instead of an *imageHandle&*, it designates the last OpenGL hardware surface to copy.
* *Mode* 32 can be used to convert 256 color images to 32 bit colors.
* *Mode* 33 images are hardware accelerated in **version 1.000 and up**, and are created using [_LOADIMAGE](_LOADIMAGE) or [_COPYIMAGE](_COPYIMAGE).
## Description
* The function copies any image or screen handle to a new and unique negative [LONG](LONG) handle value.
* Valid copy handles are less than -1. Invalid handles return -1 or 0 if it was never created.
* Every attribute of the passed image or program screen is copied to a new handle value in memory.
* **32 bit screen surface backgrounds (black) have zero [_ALPHA](_ALPHA) so that they are transparent when placed over other surfaces.**
> Use [CLS](CLS) or [_DONTBLEND](_DONTBLEND) to make a new surface background [_ALPHA](_ALPHA) 255 or opaque.
* **Images are not deallocated when the [SUB](SUB) or [FUNCTION](FUNCTION) they are created in ends. Free them with [_FREEIMAGE](_FREEIMAGE).**
* **It is important to free discarded images with [_FREEIMAGE](_FREEIMAGE) to prevent PC memory allocation errors!**
* **Do not try to free image handles currently being used as the active [SCREEN](SCREEN). Change screen modes first.**
## Example(s)
Restoring a Legacy SCREEN using the _COPYIMAGE return value.
```vb
SCREEN 13
CIRCLE (160, 100), 100, 40
DO: SLEEP: LOOP UNTIL INKEY$ <> ""
'backup screen before changing SCREEN mode
oldmode& = _COPYIMAGE(0) 'the 0 value designates the current destination SCREEN
s& = _NEWIMAGE(800, 600, 32)
SCREEN s&
LINE (100, 100)-(500, 500), _RGB(0, 255, 255), BF
DO: SLEEP: LOOP UNTIL INKEY$ <> ""
SCREEN oldmode& 'restore original screen
IF s& < -1 THEN _FREEIMAGE s&
END
```
> *Note:* Only free valid handle values with [_FREEIMAGE](_FREEIMAGE) AFTER a new [SCREEN](SCREEN) mode is being used by the program.
Program that copies desktop to a hardware image to form a 3D triangle:
```vb
SCREEN _NEWIMAGE(640, 480, 32)
my_hardware_handle = _COPYIMAGE(_SCREENIMAGE, 33) 'take a screenshot and use it as our texture
_MAPTRIANGLE (0, 0)-(500, 0)-(250, 500), my_hardware_handle TO_
(-1, 0, -1)-(1, 0, -1)-(0, 5, -10), , _SMOOTH
_DISPLAY
DO: _LIMIT 30: LOOP UNTIL INKEY$ <> ""
```
## See Also
* [_LOADIMAGE](_LOADIMAGE), [_NEWIMAGE](_NEWIMAGE)
* [_PUTIMAGE](_PUTIMAGE), [_MAPTRIANGLE](_MAPTRIANGLE)
* [_SOURCE](_SOURCE), [_DEST](_DEST)
* [_FREEIMAGE](_FREEIMAGE)
* [FILELIST$ (function)](FILELIST$-(function)) (Demo of _COPYIMAGE)
* [_DISPLAYORDER](_DISPLAYORDER)
* [Hardware images](Hardware-images)

View file

@ -1,26 +0,0 @@
The [_COPYPALETTE](_COPYPALETTE) statement copies the color palette intensities from one 4 or 8 BPP image to another image or a [_NEWIMAGE](_NEWIMAGE) screen page using 256 or less colors.
## Syntax
> [_COPYPALETTE](_COPYPALETTE) [sourceImageHandle&[, destinationImageHandle&]]
## Description
* Palette Intensity settings are **not** used by 24/32 bit images. Use only with 4 or 8 BPP images.
* [_PIXELSIZE](_PIXELSIZE) function returns 1 to indicate that _COPYPALETTE can be used. 4 indicates 24/32 bit images.
* If sourceImageHandle& is omitted, it is assumed to be the current read page.
* If destinationImageHandle& is omitted, it is assumed to be the current write page.
* If either of the images specified by sourceImageHandle& or destinationImageHandle& do not use a palette, an [ERROR Codes](ERROR-Codes) error is returned.
* If either sourceImageHandle& or destinationImageHandle& is an invalid handle, an [ERROR Codes](ERROR-Codes) error is returned.
* When loading 4 or 8 BPP image files, it is necessary to adopt the color palette of the image or it may not have the correct colors!
## Example(s)
* See the example in [SAVEIMAGE](SAVEIMAGE).
## See Also
* [_LOADIMAGE](_LOADIMAGE)
* [_PIXELSIZE](_PIXELSIZE)
* [_PALETTECOLOR](_PALETTECOLOR), [_PALETTECOLOR (function)](_PALETTECOLOR-(function))
* [PALETTE](PALETTE), [Images](Images)

View file

@ -1,58 +0,0 @@
The [_CV](_CV) function is used to convert [_MK$](_MK$), [ASCII](ASCII), [STRING](STRING) values to numerical values.
## Syntax
> result = [_CV](_CV)(numericalType, MKstringValue$)
## Parameter(s)
* numericalType is any number type: [INTEGER](INTEGER), [LONG](LONG), [SINGLE](SINGLE), [DOUBLE](DOUBLE), [_INTEGER64](_INTEGER64), [_FLOAT](_FLOAT), [_BYTE](_BYTE) or [_OFFSET](_OFFSET).
* Integer, Long, Byte and Bit values can be signed or [_UNSIGNED](_UNSIGNED).
* The MKstringvalue$ parameter must be a string value generated by [_MK$](_MK$)
## Description
* The MKstringvalue$ value type must match the numerical type parameter used.
* [_MK$](_MK$) [STRING](STRING) values consist of [ASCII](ASCII) characters in the same byte length as the number value type.
## Example(s)
Using the _MK$ and _CV functions:
```vb
DIM i64 AS _INTEGER64
DIM i64str AS STRING
i64 = 2 ^ 61
i64str = _MK$(_INTEGER64, i64)
PRINT "I64:"; i64
PRINT "_MK$: "; i64str
i64 = _CV(_INTEGER64, i64str)
PRINT "_CV:"; i64
```
```text
I64: 2305843009213693952
_MK$:
_CV: 2305843009213693952
```
> The _MK$ string result may not print anything to the screen, as in the example above, unless [_CONTROLCHR](_CONTROLCHR) is set to OFF.
## See Also
* [_MK$](_MK$) (QB64 string conversion function)
* [MKI$](MKI$), [CVI](CVI), [INTEGER](INTEGER)
* [MKL$](MKL$), [CVL](CVL), [LONG](LONG)
* [MKS$](MKS$), [CVS](CVS), [SINGLE](SINGLE)
* [MKD$](MKD$), [CVD](CVD), [DOUBLE](DOUBLE)
* [MKSMBF$](MKSMBF$), [CVSMBF](CVSMBF) (Microsoft Binary Format)
* [MKDMBF$](MKDMBF$), [CVDMBF](CVDMBF) (Microsoft Binary Format)
* [PDS (7.1) Procedures](PDS-(7.1)-Procedures)
* [_CONTROLCHR](_CONTROLCHR)

View file

@ -1,51 +0,0 @@
The [_CWD$](_CWD$) function returns the current working directory path as a string value without a trailing path separator.
## Syntax
> workingDirectory$ = [_CWD$](_CWD$)
## Description
* By default, the initial working directory path is usually the same as the directory of the executable file run.
* The current working directory can be changed with the [CHDIR](CHDIR) or [SHELL](SHELL) command; CHDIR sets it, _CWD$ returns it.
* Path returns will change only when the working path has changed. When in C:\ and run QB64\cwd.exe, it will still return C:\
* The current working directory string can be used in [OPEN](OPEN) statements and [SHELL](SHELL) commands that deal with files.
* Works in Windows, macOS and Linux. [_OS$](_OS$) can be used by a program to predict the proper slash separations in different OS's.
## Error(s)
* If an error occurs while obtaining the working directory from the operating system, [ERROR Codes](ERROR-Codes) 51 (Internal Error) will be generated.
## Example(s)
Get the current working directory, and move around the file system:
```vb
startdir$ = _CWD$
PRINT "We started at "; startdir$
MKDIR "a_temporary_dir"
CHDIR "a_temporary_dir"
PRINT "We are now in "; _CWD$
CHDIR startdir$
PRINT "And now we're back in "; _CWD$
RMDIR "a_temporary_dir"
```
```text
We started at C:\QB64
We are now in C:\QB64\a_temporary_dir
And now we're back in C:\QB64
```
## See Also
* [CHDIR](CHDIR) (Change the current working directory)
* [RMDIR](RMDIR) (Remove a directory in the file system)
* [KILL](KILL) (Delete a file in the file system)
* [MKDIR](MKDIR) (Create a directory in the file system)
* [_OS$](_OS$) (returns current OS to program)
* [_STARTDIR$](_STARTDIR$) (returns path the user called program from)

View file

@ -1,34 +0,0 @@
The [_D2G](_D2G) function converts a **degree** value into a **gradian** value.
## Syntax
> result = [_D2G](_D2G)(num)
## Availability
* Version 1.000 and up.
## Example(s)
Coverting Degrees into Gradians.
```vb
INPUT "Give me an angle in Degrees ", D
R = _D2G(D)
PRINT "That angle in Gradians is "; R
```
```text
Give me an angle in Degrees 60
That angle in Gradient is 66.66666
```
## See Also
* [_D2R](_D2R)
* [_G2D](_G2D), [_G2R](_G2R)
* [_R2D](_R2D), [_R2G](_R2G)

View file

@ -1,34 +0,0 @@
The [_D2R](_D2R) function converts a **degree** value into a **radian** value.
## Syntax
> result = [_D2R](_D2R)(num)
## Availability
* Version 1.000 and up.
## Example(s)
Coverting Degrees into Radians.
```vb
INPUT "Give me an angle in Degrees ", D
R = _D2R(D)
PRINT "That angle in Radians is "; R
```
```text
Give me an angle in Degrees 60
That angle in Radians is 1.047198
```
## See Also
* [_D2G](_D2G), [_D2R](_D2R)
* [_G2D](_G2D), [_G2R](_G2R)
* [_R2D](_R2D), [_R2G](_R2G)

View file

@ -1,33 +0,0 @@
The [_DEFAULTCOLOR](_DEFAULTCOLOR) function returns the current default text color for an image handle or page.
## Syntax
> result& = [_DEFAULTCOLOR](_DEFAULTCOLOR) [(imageHandle&)]
## Description
* If imageHandle& is omitted, it is assumed to be the current write page or image designated by [_DEST](_DEST).
* If imageHandle& is an invalid handle, an [ERROR Codes](ERROR-Codes) error occurs. Check handle values first.
* Default foreground colors are: [SCREEN](SCREEN) 0 = 7, [SCREEN](SCREEN) 1 and 10 = 3, [SCREEN](SCREEN) 2 and 11 = 1. All other [SCREEN](SCREEN)s = 15.
## Example(s)
The default color is the color assigned to the text foreground. The [SCREEN](SCREEN) 12 default is [COLOR](COLOR) 15.
```vb
SCREEN 12
OUT &H3C8, 0: OUT &H3C9, 63: OUT &H3C9, 63: OUT &H3C9, 63 'assign background RGB intensities
OUT &H3C8, 8: OUT &H3C9, 0: OUT &H3C9, 0: OUT &H3C9, 0 'assign RGB intensities to COLOR 8
_PRINTMODE _KEEPBACKGROUND
COLOR 8 'assign color 8 to text foreground
PRINT "The default color is attribute"; _DEFAULTCOLOR
```
## See Also
* [COLOR](COLOR)
* [_DEST](_DEST)
* [Images](Images)
* [Windows Libraries](Windows-Libraries)

View file

@ -1,52 +0,0 @@
[_DEFINE](_DEFINE) defines a set of variable names according to their first character as a specified data type.
## Syntax
> [_DEFINE](_DEFINE) letter[-range, ...] [AS](AS) [_UNSIGNED] data[Variable Types](Variable-Types)
## Parameter(s)
* Variable start *letter range* is in the form firstletter-endingletter (like A-C) or just a single letter.
* *Data types*: [INTEGER](INTEGER), [SINGLE](SINGLE), [DOUBLE](DOUBLE), [LONG](LONG), [STRING](STRING), [_BIT](_BIT), [_BYTE](_BYTE), [_INTEGER64](_INTEGER64), [_FLOAT](_FLOAT), [_OFFSET](_OFFSET), [_MEM](_MEM)
* Can also use the [_UNSIGNED](_UNSIGNED) definition for positive whole [INTEGER](INTEGER) type numerical values.
## Description
* **When a variable has not been defined or has no type suffix, the value defaults to a [SINGLE](SINGLE) precision floating point value.**
* _DEFINE sets the [Variable Types](Variable-Types) of all variable names with the starting letter(s) or letter ranges when encountered in the progression of the program (even in conditional statement blocks not executed and subsequent [SUB](SUB) procedures).
* **NOTE: Many QBasic keyword variable names CAN be used with a [STRING](STRING) suffix ($)! You cannot use them without the suffix, use a numerical suffix or use [DIM](DIM), [REDIM](REDIM), [_DEFINE](_DEFINE), [BYVAL](BYVAL) or [TYPE](TYPE) variable [AS](AS) statements.**
* **QBasic's IDE** added DEF statements before any [SUB](SUB) or [FUNCTION](FUNCTION). **QB64** (like QB) will change all variable types in subsequent sub-procedures to that default variable type without giving a [ERROR Codes](ERROR-Codes) warning or adding the proper DEF statement to subsequent procedures. If you do not want that to occur, either remove that DEF statement or add the proper DEF type statements to subsequent procedures.
* May also affect [$INCLUDE]($INCLUDE) procedures.
## Example(s)
Defining variables that start with the letters A, B, C or F as unsigned integers, including the *Add2* [FUNCTION](FUNCTION).
```vb
_DEFINE A-C, F AS _UNSIGNED INTEGER
PRINT Add2(-1.1, -2.2)
END
FUNCTION Add2 (one, two)
Add2 = one + two
END FUNCTION
```
```text
65533
```
> *Explanation:* Unsigned integers can only return positive values while ordinary [INTEGER](INTEGER) can also return negative values.
## See Also
* [DEFSTR](DEFSTR), [DEFLNG](DEFLNG), [DEFINT](DEFINT), [DEFSNG](DEFSNG), [DEFDBL](DEFDBL)
* [DIM](DIM), [REDIM](REDIM)
* [COMMON](COMMON), [SHARED](SHARED)
* [_UNSIGNED](_UNSIGNED)

View file

@ -1,50 +0,0 @@
The [_DEFLATE$](_DEFLATE$) function compresses a [STRING](STRING).
## Syntax
> result$ = [_DEFLATE$](_DEFLATE$)(stringToCompress$)
## Description
* result$ will contain the compressed version of stringToCompress$.
* To decompress the resulting string, use [_INFLATE$](_INFLATE$).
## Availability
* Version 1.4 and up.
## Example(s)
Compressing a long string of text.
```vb
a$ = "The quick brown fox jumps over the lazy dog. "
PRINT "Original string (a$): "; a$
FOR i = 1 TO 15
a$ = a$ + a$
NEXT
PRINT "After concatenating it into itself several times, LEN(a$) ="; LEN(a$)
b$ = _DEFLATE$(a$)
PRINT "After using _DEFLATE$ to compress it, LEN ="; LEN(b$)
PRINT USING "(compressed size is #.###% of the original)"; ((LEN(b$) * 100) / LEN(a$))
c$ = _INFLATE$(b$)
PRINT "After using _INFLATE$ to decompress it, LEN ="; LEN(c$)
```
```text
Original string (a$): The quick brown fox jumps over the lazy dog
After concatenating it into itself several times, LEN(a$) = 1474560
After using _DEFLATE$ to compress it, LEN = 4335
(compressed size is 0.295% of the original)
After using _INFLATE$ to decompress it, LEN = 1474560
```
## See Also
* [_INFLATE$](_INFLATE$)

View file

@ -1,20 +0,0 @@
The [_DELAY](_DELAY) statement suspends program execution for the specified number of seconds.
## Syntax
> [_DELAY](_DELAY) seconds!
## Parameter(s)
* seconds! is the time to wait, accurate to nearest millisecond (.001).
## Description
* While waiting, CPU cycles are relinquished to other applications.
* Delays are not affected by midnight timer corrections.
## See Also
* [_LIMIT](_LIMIT)
* [TIMER](TIMER)
* [ON TIMER(n)](ON-TIMER(n))

View file

@ -1,21 +0,0 @@
The [_DEPTHBUFFER](_DEPTHBUFFER) statement turns depth buffering ON or OFF, LOCKs or _CLEARS the buffer.
## Syntax
> [_DEPTHBUFFER](_DEPTHBUFFER) {ON|OFF|LOCK|_CLEAR}[,handle&]
## Description
* Depth buffers store the distance of each pixel on an image/surface. When 3D drawing occurs new pixels are only drawn if they are closer than the existing pixels. After all content is drawn, it results in a scene which looks correct because content which is closer hides content which is further away.
* Depth buffers are automatically created for any hardware image or surface which is the target/destination of a 3D command (such as the 3D version of [_MAPTRIANGLE](_MAPTRIANGLE)).
* The buffering can be turned ON, OFF or LOCKed. The default state is ON.
* [_DEPTHBUFFER](_DEPTHBUFFER) _CLEAR can be used to reset/erase the depth buffer, meaning that future drawing will not be blocked by existing/previously buffered depth content.
* Whenever _DISPLAY is called the primary surface's depth buffer is automatically _CLEARed, so unless you are drawing onto a hardware image you may never need to use this option.
* LOCKing the depth buffer makes it read only. New content cannot be drawn unless it is closer than existing content, but when that new content is drawn it will not update the depth buffer.
* Turning OFF or LOCKing the depth buffer is typically performed when semi-transparent content is being drawn.
## See Also
* [_MAPTRIANGLE](_MAPTRIANGLE)
* [_PUTIMAGE](_PUTIMAGE)
* [_DISPLAY](_DISPLAY)

View file

@ -1,32 +0,0 @@
The [_DESKTOPHEIGHT](_DESKTOPHEIGHT) function returns the height of the users current desktop.
## Syntax
> y& = [_DESKTOPHEIGHT](_DESKTOPHEIGHT)
## Description
* No parameters are needed for this function.
* This returns the height of the user's desktop, not the size of any screen or window which might be open on that desktop.
## Availability
* Version 1.000 and up.
## Example(s)
```vb
s& = _NEWIMAGE(800, 600, 256)
SCREEN s&
PRINT _DESKTOPWIDTH, _DESKTOPHEIGHT
PRINT _WIDTH, _HEIGHT
```
> *Explanation:* This will print the size of the user desktop (for example *1920, 1080* for a standard hdmi monitor), and then the size of the current [SCREEN](SCREEN) (800, 600).
## See Also
* [_HEIGHT](_HEIGHT), [_DESKTOPWIDTH](_DESKTOPWIDTH)
* [_WIDTH](_WIDTH), [_SCREENIMAGE](_SCREENIMAGE)

View file

@ -1,32 +0,0 @@
The [_DESKTOPWIDTH](_DESKTOPWIDTH) function returns the width of the users current desktop.
## Syntax
> x& = [_DESKTOPWIDTH](_DESKTOPWIDTH)
## Description
* No parameters are needed for this function.
* This returns the width of the user's desktop, not the size of any screen or window which might be open on that desktop.
## Availability
* Version 1.000 and up.
## Example(s)
```vb
s& = _NEWIMAGE(800, 600, 256)
SCREEN s&
PRINT _DESKTOPWIDTH, _DESKTOPHEIGHT
PRINT _WIDTH, _HEIGHT
```
> *Explanation:* This will print the size of the user desktop (for example *1920, 1080* for a standard hdmi monitor), and then the size of the current [SCREEN](SCREEN) (800, 600).
## See Also
* [_HEIGHT](_HEIGHT), [_DESKTOPHEIGHT](_DESKTOPHEIGHT)
* [_WIDTH](_WIDTH), [_SCREENIMAGE](_SCREENIMAGE)

View file

@ -1,18 +0,0 @@
The [_DEST](_DEST) function returns the handle value of the current write page (the image used for drawing).
## Syntax
> result& = [_DEST](_DEST)
## Description
* The current write page is where all drawing occurs by default.
* The value returned is the same as the latest [SCREEN](SCREEN)'s handle when creating custom screen modes using [_NEWIMAGE](_NEWIMAGE).
* Keep the _NEWIMAGE handle values when you move to another SCREEN mode so that you can return to that screen later. You can go to another screen mode and return without having to redo the screen.
* [_DEST](_DEST) return values do not change in legacy screen modes. The value will not help restore them.
## See Also
* [_DEST](_DEST)
* [_SOURCE (function)](_SOURCE-(function))
* [SCREEN](SCREEN)

View file

@ -1,113 +0,0 @@
The [_DEST](_DEST) statement sets the current write image or page. All graphic and print changes will be done to this image.
## Syntax
> [_DEST](_DEST) imageHandle&
## Description
* imageHandle& is the handle of the image that will act as the current write page.
* **_DEST 0** refers to the present program [SCREEN](SCREEN). You can use 0 to refer to the present program [SCREEN](SCREEN).
* [_DEST](_DEST) [_CONSOLE](_CONSOLE) can set the destination to send information to a console window using [PRINT](PRINT) or [INPUT](INPUT).
* If imageHandle& is an invalid handle, an [ERROR Codes](ERROR-Codes) error occurs. Always check for valid handle values first (imageHandle& < -1).
* *Note:* Use [_SOURCE](_SOURCE) when you need to read a page or image with [POINT](POINT), [GET (graphics statement)](GET-(graphics-statement)) or the [SCREEN (function)](SCREEN-(function)) function.
## Example(s)
Placing a center point and a circle using [_CLEARCOLOR](_CLEARCOLOR) to eliminate the background color black.
```vb
SCREEN 13 'program screen can use 256 colors
a& = _NEWIMAGE(320,200,13) 'create 2 screen page handles a& and b&
b& = _NEWIMAGE(320,200,13)
_DEST a& 'set destination image to handle a&
PSET (100, 100), 15 'draw a dot on the current destination handle a&
_DEST b& 'set destination image to handle b&
CIRCLE (100, 100), 50, 15 'draw a circle on the current destination handle b&
_CLEARCOLOR 0 'make page b color 0 (black) transparent
_PUTIMAGE , b&, a& 'put circle on image b to image a& (a PSET dot)
_PUTIMAGE , a&, 0 'put what is on image a& to the screen (handle 0)
```
Demonstrates how [PRINT](PRINT) text can be stretched using [_PUTIMAGE](_PUTIMAGE) with [_DEST](_DEST) pages.
```vb
DIM a(10) AS LONG
DIM b AS LONG
REM Sets up a newimage for B then sets the screen to that.
b = _NEWIMAGE(640, 480, 32)
SCREEN b
REM Make pages 48 pixels tall. If the image is not at least that it wont work
a(1) = _NEWIMAGE(240, 48, 32)
a(2) = _NEWIMAGE(240, 48, 32)
a(3) = _NEWIMAGE(98, 48, 32)
xa = 100
ya = 120
xm = 4
ym = 4
REM Some fun things for the bouncing text.
st$(0) = "doo"
st$(1) = "rey"
st$(2) = "mee"
st$(3) = "faa"
st$(4) = "soo"
st$(5) = "laa"
st$(6) = "tee"
sta$(0) = "This is a demo"
sta$(1) = "showing how to use"
sta$(2) = "the _DEST command"
sta$(3) = "with PRINT"
sta$(4) = "and _PUTIMAGE"
REM prints to a(3) image then switches back to the default 0
_DEST a(3): f = INT(RND * 6): PRINT st$(3): _DEST 0
DO
REM prints to a(1) and a(2) then switches bac to 0
_DEST a(1)
CLS
PRINT sta(r)
_DEST a(2)
CLS
PRINT sta(r + 1)
_DEST 0 'destination zero is the main program page
REM a loop to putimage the images in a(1) and a(2) in a way to make it look like its rolling
FOR yat = 150 TO 380 STEP 4
CLS
_PUTIMAGE (0, yat)-(640, 380), a(1)
_PUTIMAGE (0, 150)-(640, yat), a(2)
GOSUB bounce
_DISPLAY
_LIMIT 20
NEXT yat
r = r + 1
IF r = 4 THEN r = 0
LOOP UNTIL INKEY$ <> ""
END
bounce:
IF xa > 600 OR xa < 20 THEN xm = xm * -1: _DEST a(3): f = INT(RND * 6): CLS: _CLEARCOLOR 0: PRINT st$(f): _DEST 0
IF ya > 400 OR ya < 20 THEN ym = ym * -1: _DEST a(3): f = INT(RND * 7): CLS: _CLEARCOLOR 0: PRINT st$(f): _DEST 0
_PUTIMAGE (xa, ya)-(xa + 150, ya + 80), a(3)
xa = xa + xm
ya = ya + ym
RETURN
```
## See Also
* [_DEST (function)](_DEST-(function))
* [_SOURCE](_SOURCE)
* [_PUTIMAGE](_PUTIMAGE)
* [_CONSOLE](_CONSOLE)

View file

@ -1,73 +0,0 @@
The **_DEVICE$** function returns a [STRING](STRING) value holding the controller type, name and input types of the input devices on a computer.
## Syntax
> device$ = _DEVICE$(device_number)
* The **[_DEVICES](_DEVICES) function must be read first to get the number of devices and to enable [_DEVICE$](_DEVICE$) and [_DEVICEINPUT](_DEVICEINPUT).**
* The device_number parameter indicates the number of the controller device to be read.
* Returns the [STRING](STRING) control type, name of the device and input types each can use included in brackets:
* Control type:
* [KEYBOARD] always listed as first device when keyboard(s) available. Only one keyboard will show.
* [MOUSE]] always listed as second device when keyboard(s) and mouse(mice) are available. Only one mouse will show.
* [CONTROLLER] subsequent devices are listed as controllers which include joysticks and game pads.
* When [CONTROLLER] is returned it may also give the [STRING](STRING) [NAME] [device description](NAME] [device description) of the controller.
* Returns the type of input after the device name as one or more of the following types:
* [[BUTTON](BUTTON)] indicates there are button types of input. [_LASTBUTTON](_LASTBUTTON) can return the number of buttons available.
* [[AXIS](AXIS)] indicates there are stick types of input. [_LASTAXIS](_LASTAXIS) can return the number of axis available.
* [[WHEEL](WHEEL)] indicates that a scrolling input can be read. [_LASTWHEEL](_LASTWHEEL) can return the number of wheels available.
* **Device numbers above the number of [_DEVICES](_DEVICES) found will return an OS error.**
* Devices found include keyboard, mouse, joysticks, game pads and multiple stick game controllers.
## Example(s)
Checking for the system's input devices and the number of buttons available.
```vb
devices = _DEVICES 'MUST be read in order for other 2 device functions to work!
PRINT "Number of input devices found ="; devices
FOR i = 1 TO devices
PRINT _DEVICE$(i)
PRINT "Buttons:"; _LASTBUTTON(i); "Axis:"; _LASTAXIS(i); "Wheels:"; _LASTWHEEL(i)
NEXT
```
```text
Number of input devices found = 3
[KEYBOARD][BUTTON]
Buttons: 512 Axis: 0 Wheels: 0
[MOUSE][BUTTON][AXIS][WHEEL]
Buttons: 3 Axis: 2 Wheels: 3
[CONTROLLER][NAME][Microsoft Sidewinder Precision Pro (USB)](NAME][Microsoft Sidewinder Precision Pro (USB))[BUTTON][AXIS]
Buttons: 9 Axis: 6 Wheels: 0
```
> Note: The [STRIG](STRIG)/[STICK](STICK) commands won't read from the keyboard or mouse device the above example lists. They will only work on controllers.
Finding the number of mouse buttons available in QB64. This could also be used for other devices.
```vb
FOR d = 1 TO _DEVICES 'number of input devices found
dev$ = _DEVICE$(d)
IF INSTR(dev$, "[MOUSE]") THEN buttons = _LASTBUTTON(d): EXIT FOR
NEXT
PRINT buttons; "mouse buttons available"
```
## See Also
* [_DEVICES](_DEVICES), [_DEVICEINPUT](_DEVICEINPUT)
* [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS), [_LASTWHEEL](_LASTWHEEL)
* [_BUTTON](_BUTTON), [_BUTTONCHANGE](_BUTTONCHANGE)
* [_AXIS](_AXIS), [_WHEEL](_WHEEL)
* [_MOUSEBUTTON](_MOUSEBUTTON)
* [STRIG](STRIG), [STICK](STICK)
* [ON STRIG(n)](ON-STRIG(n)), [STRIG(n)](STRIG(n))
* [Controller Devices](Controller-Devices)

View file

@ -1,117 +0,0 @@
The **_DEVICEINPUT** function returns the device number when a controller device button, wheel or axis event occurs.
## Syntax
> device% = [_DEVICEINPUT](_DEVICEINPUT)
> device_active% = [_DEVICEINPUT](_DEVICEINPUT)(device_number%)
## Parameter(s)
* Use the _DEVICEINPUT device% [INTEGER](INTEGER) returned to find the number of the controller device being used.
* A literal specific device_number% parameter can be used to return -1 if active or 0 if inactive. EX: **WHILE _DEVICEINPUT(2)**
## Description
* Use [_DEVICES](_DEVICES) to find the number of controller devices available BEFORE using this function.
* [_DEVICE$](_DEVICE$) can be used to list the device names and control types using valid [_DEVICES](_DEVICES) numbers.
* When a device button is pressed or a scroll wheel or axis is moved, the device number will be returned.
* Devices are numbered as 1 for keyboard and 2 for mouse. Other controller devices will be numbered 3 or higher if installed.
* [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS), or [_LASTWHEEL](_LASTWHEEL) will indicate the number of functions available with the specified *device* number.
* User input events can be monitored reading valid numbered [_AXIS](_AXIS), [_BUTTON](_BUTTON), [_BUTTONCHANGE](_BUTTONCHANGE) or [_WHEEL](_WHEEL) functions.
* *Note:* [ON...GOSUB](ON...GOSUB) keyboard, mouse, gamecontrol can be used to control the devices 1,2 and 3, etc.
## Example(s)
Checking device controller interfaces and finding out what devices are being used.
```vb
FOR i = 1 TO _DEVICES
PRINT STR$(i) + ") " + _DEVICE$(i)
PRINT "Button:"; _LASTBUTTON(i); ",Axis:"; _LASTAXIS(i); ",Wheel:"; _LASTWHEEL(i)
NEXT
PRINT
DO
x = _DEVICEINPUT
IF x THEN PRINT "Device ="; x;
LOOP UNTIL INKEY$ = CHR$(27) 'escape key exit
END
```
```text
[KEYBOARD][BUTTON]
Buttons: 512 Axis: 0 Wheels: 0
[MOUSE][BUTTON][AXIS][WHEEL]
Buttons: 3 Axis: 2 Wheels: 3
[CONTROLLER][NAME][Microsoft Sidewinder Precision Pro (USB)](NAME][Microsoft Sidewinder Precision Pro (USB))[BUTTON][AXIS]
Buttons: 9 Axis: 6 Wheels: 0
Device = 2 Device = 2
```
> *Note:* Mouse events must be within the program screen area. Keyboard presses are registered only when program is in focus.
Why does a mouse have 3 wheels? Relative x and y movements can be read using the first 2 [_WHEEL](_WHEEL) reads.
```vb
ignore = _MOUSEMOVEMENTX 'dummy call to put mouse into relative movement mode
PRINT "Move your mouse and/or your mouse wheel (ESC to exit)"
d = _DEVICES ' always read number of devices to enable device input
DO: _LIMIT 30 'main loop
DO WHILE _DEVICEINPUT(2) 'loop only runs during a device 2 mouse event
PRINT _WHEEL(1), _WHEEL(2), _WHEEL(3)
LOOP
LOOP UNTIL INKEY$ = CHR$(27)
```
> *Explanation:* Referencing the [_MOUSEMOVEMENTX](_MOUSEMOVEMENTX) function hides the mouse and sets the mouse to a relative movement mode which can be read by [_WHEEL](_WHEEL). [_DEVICEINPUT](_DEVICEINPUT)(2) returns -1 (true) only when the mouse is moved, scrolled or clicked.
Using [ON...GOSUB](ON...GOSUB) with the [_DEVICEINPUT](_DEVICEINPUT) number to add keyboard, mouse and game controller event procedures.
```vb
n = _DEVICES 'required when reading devices
PRINT "Number of devices found ="; n
FOR i = 1 TO n
PRINT i; _DEVICE$(i) ' 1 = keyboard, 2 = mouse, 3 = other controller, etc.
NEXT
PRINT
DO: device = _DEVICEINPUT
ON device GOSUB keyboard, mouse, controller 'must be inside program loop
LOOP UNTIL INKEY$ = CHR$(27)
END
keyboard:
PRINT device; "Keyboard";
RETURN
mouse:
PRINT device; "Mouse ";
RETURN
controller:
PRINT device; "Game control ";
RETURN
```
> *Note:* [ON...GOSUB](ON...GOSUB) and [ON...GOTO](ON...GOTO) events require numerical values to match the order of line labels listed in the event used inside loops.
## See Also
* [_DEVICES](_DEVICES), [_DEVICE$](_DEVICE$)
* [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS), [_LASTWHEEL](_LASTWHEEL)
* [_BUTTON](_BUTTON), [_AXIS](_AXIS), [_WHEEL](_WHEEL)
* [STRIG](STRIG), [STICK](STICK)
* [ON...GOSUB](ON...GOSUB) (numerical events)
* [Controller Devices](Controller-Devices)

View file

@ -1,49 +0,0 @@
The [_DEVICES](_DEVICES) function returns the number of INPUT devices on your computer including keyboard, mouse and game devices.
## Syntax
> device_count% = [_DEVICES](_DEVICES)
## Description
* Returns the number of devices that can be listed separately with the [_DEVICE$](_DEVICE$) function by the device number.
* Devices include keyboard, mouse, joysticks, game pads and multiple stick game controllers.
* **Note: This function must be read before trying to use the [_DEVICE$](_DEVICE$), [_DEVICEINPUT](_DEVICEINPUT) or _LAST control functions.**
## Example(s)
Checking for the system's input devices.
```vb
devices = _DEVICES 'MUST be read in order for other 2 device functions to work!
PRINT "Number of input devices found ="; devices
FOR i = 1 TO devices
PRINT _DEVICE$(i)
PRINT "Buttons:"; _LASTBUTTON(i)
NEXT
```
```text
Number of input devices found = 2
[KEYBOARD][BUTTON]
Buttons: 512
[MOUSE][BUTTON][AXIS][WHEEL]
Buttons: 3
```
> Note: The [STRIG](STRIG)/[STICK](STICK) commands won't read from the keyboard or mouse device the above example lists.
## See Also
* [_DEVICE$](_DEVICE$), [_DEVICEINPUT](_DEVICEINPUT)
* [_LASTBUTTON](_LASTBUTTON), [_LASTAXIS](_LASTAXIS), [_LASTWHEEL](_LASTWHEEL)
* [_BUTTON](_BUTTON), [_BUTTONCHANGE](_BUTTONCHANGE)
* [_AXIS](_AXIS), [_WHEEL](_WHEEL)
* [_MOUSEINPUT](_MOUSEINPUT), [_MOUSEX](_MOUSEX), [_MOUSEBUTTON](_MOUSEBUTTON)
* [STRIG](STRIG), [STICK](STICK)
* [ON STRIG(n)](ON-STRIG(n)), [STRIG(n)](STRIG(n))
* [Controller Devices](Controller-Devices)

View file

@ -1,56 +0,0 @@
The [_DIR$](_DIR$) function returns common paths in **Windows** only such as My Documents, My Pictures, My Music, Desktop.
## Syntax
> d$ = [_DIR$](_DIR$)("folderspecification")
## Parameter(s)
* *folderspecification* may be "desktop", "download", "documents", "music", "video", "pictures", "appdata", "program data", "local data", "program files", "program files (x86)", "temp".
* Some variation is accepted for the folder specification:
* MY DOCUMENTS, TEXT, DOCUMENT, DOCUMENTS, DOWNLOAD, DOWNLOADS
* MY MUSIC, MUSIC, AUDIO, SOUND, SOUNDS
* MY PICTURES, PICTURE, PICTURES, IMAGE, IMAGES, PHOTO, PHOTOS, DCIM, CAMERA, CAMERA ROLL
* MY VIDEOS, VIDEO, VIDEOS, MOVIE, MOVIES,
* DATA, APPDATA, APPLICATION DATA, PROGRAM DATA, LOCAL DATA, LOCALAPPDATA, LOCAL APPLICATION DATA, LOCAL PROGRAM DATA
## Description
* The path returned ends with a backslash (Windows).
* A nonexistent folder specification usually defaults to the Desktop folder path.
* In Linux and macOS the function always returns **"./"**
## Example(s)
Displaying default paths in Windows only.
```vb
PRINT "DESKTOP=" + _DIR$("desktop")
PRINT "DOWNLOADS=" + _DIR$("download")
PRINT "DOCUMENTS=" + _DIR$("my documents")
PRINT "PICTURES=" + _DIR$("pictures")
PRINT "MUSIC=" + _DIR$("music")
PRINT "VIDEO=" + _DIR$("video")
PRINT "APPLICATION DATA=" + _DIR$("data")
PRINT "LOCAL APPLICATION DATA=" + _DIR$("local application data")
```
```text
DESKTOP=C:\Documents and Settings\Administrator\Desktop\
DOWNLOADS=C:\Documents and Settings\Administrator\Downloads\
DOCUMENTS=C:\Documents and Settings\Administrator\My Documents\
PICTURES=C:\Documents and Settings\Administrator\My Documents\My Pictures\
MUSIC=C:\Documents and Settings\Administrator\My Documents\My Music\
VIDEO=C:\Documents and Settings\Administrator\My Documents\My Videos\
APPLICATION DATA=C:\Documents and Settings\Administrator\Application Data\
LOCAL APPLICATION DATA=C:\Documents and Settings\Administrator\Local Settings\Application Data\
```
## See Also
* [_CWD$](_CWD$)
* [_STARTDIR$](_STARTDIR$)

View file

@ -1,32 +0,0 @@
The [_DIREXISTS](_DIREXISTS) function determines if a designated file path or folder exists and returns true (-1) or false (0).
## Syntax
> dirExists% = [_DIREXISTS](_DIREXISTS)(filepath$)
## Description
* The filepath$ parameter can be a literal or variable [STRING](STRING) path value.
* The function returns -1 when a path or folder exists and 0 when it does not.
* The function reads the system information directly without using a [SHELL](SHELL) procedure.
* The function will use the appropriate Operating System path separators. [_OS$](_OS$) can determine the operating system.
* **This function does not guarantee that a path can be accessed, only that it exists.**
* **NOTE: Checking if a folder exists in a CD drive may cause the tray to open automatically to request a disk when empty.**
## Example(s)
Checks if a folder exists before proceeding.
```vb
IF _DIREXISTS("internal\temp") THEN
PRINT "Folder found."
END IF
```
## See Also
* [_FILEEXISTS](_FILEEXISTS)
* [SHELL](SHELL)
* [_OS$](_OS$)

View file

@ -1,50 +0,0 @@
The [_DISPLAY](_DISPLAY) function returns the handle of the current image that is displayed on the screen.
## Syntax
> currentImage& = [_DISPLAY](_DISPLAY)
## Description
* Returns the current image handle value that is being displayed. Returns 0 if in the default [SCREEN](SCREEN) image.
* Not to be confused with the [_DISPLAY](_DISPLAY) statement that displays the screen when not using [_AUTODISPLAY](_AUTODISPLAY).
## Example(s)
Creating a mouse cursor using a page number that **you create** in memory without setting up page flipping.
```vb
SCREEN _NEWIMAGE(640, 480, 32) 'any graphics mode should work without setting up pages
_MOUSEHIDE
SetupCursor
PRINT "Hello World!"
DO: _LIMIT 30
DO WHILE _MOUSEINPUT: LOOP 'main loop must contain _MOUSEINPUT
' other program code
LOOP
SUB SetupCursor
ON TIMER(0.02) UpdateCursor
TIMER ON
END SUB
SUB UpdateCursor
PCOPY _DISPLAY, 100 'any page number as desination with the _DISPLAY function as source
PSET (_MOUSEX, _MOUSEY), _RGB(0, 255, 0)
DRAW "ND10F10L3F5L4H5L3"
_DISPLAY 'statement shows image
PCOPY 100, _DISPLAY 'with the function return as destination page
END SUB
```
*Note:* Works with the **_DISPLAY function** return as the other page. If mouse reads are not crucial, put the [_MOUSEINPUT](_MOUSEINPUT) loop inside of the UpdateCursor SUB.
## See Also
* [SCREEN](SCREEN)
* [PCOPY](PCOPY)
* [_DISPLAY](_DISPLAY) (statement)
* [_AUTODISPLAY](_AUTODISPLAY) (default mode)
* [_DISPLAYORDER](_DISPLAYORDER) (statement)

View file

@ -1,82 +0,0 @@
The [_DISPLAY](_DISPLAY) statement turns off the automatic display while only displaying the screen changes when called.
## Syntax
> [_DISPLAY](_DISPLAY)
## Description
* **_DISPLAY** turns off the auto refresh screen default [_AUTODISPLAY](_AUTODISPLAY) behavior. Prevents screen flickering.
* Call _DISPLAY each time the screen graphics are to be displayed. Place call after the image has been changed.
* Re-enable automatic display refreshing by calling [_AUTODISPLAY](_AUTODISPLAY). If it isn't re-enabled, things may not be displayed later.
* _DISPLAY tells **QB64** to render all of the hardware [_PUTIMAGE](_PUTIMAGE) commands loaded into the buffer previously.
* The [_AUTODISPLAY (function)](_AUTODISPLAY-(function)) can be used to detect the current display behavior.
* **QB64** can set the graphic rendering order of _SOFTWARE, _HARDWARE, and _GLRENDER with [_DISPLAYORDER](_DISPLAYORDER).
## Example(s)
Displaying a circle bouncing around the screen.
```vb
SCREEN 12
x = 21: y =31 'start position
dx = 3: dy = 3 'number of pixel moves per loop
DO
_LIMIT 100 ' set to 100 frames per second
x = x + dx: y = y + dy
IF x < 0 OR x > 640 THEN dx = -dx 'limit columns and reverse column direction each side
IF y < 0 OR y > 480 THEN dy = -dy 'limit rows and reverse row direction top or bottom
IF px <> x OR py <> y THEN FOR d = 1 to 20: CIRCLE (px, py), d, 0: NEXT 'erase
FOR c = 1 TO 20: CIRCLE (x, y), c, 6: NEXT 'draw new circle at new position
px = x: py = y 'save older coordinates to erase older circle next loop
_DISPLAY 'after new circle is set, show it
LOOP UNTIL INKEY$ = CHR$(27)
```
> *Explanation:* The loop is set with [_LIMIT](_LIMIT) to 100 frames per second to limit CPU usage and the speed of the ball. Each loop a circle is drawn while the previous one is erased when the coordinates change. _DISPLAY only shows the new circle position once each loop. The **_DISPLAY** routine eliminates the need for setting [SCREEN (statement)](SCREEN-(statement)) swap pages, [CLS](CLS) and [PCOPY](PCOPY). _DISPLAY keeps the image off of the screen until the changes have all completed. Drawing 40 circles every loop helps slow down the ball.
[_DISPLAY](_DISPLAY) must be used to render hardware images placed with [_PUTIMAGE](_PUTIMAGE) (**version 1.000 and up**).
```vb
CONST MenuHeight = 200
SCREEN _NEWIMAGE(640, 480, 32)
'SLEEP 1
LOCATE 20
DO
_LIMIT 30
DisplayMenu
k = _KEYHIT
IF k <> 0 THEN PRINT k,
LOOP UNTIL k = 32 OR k = 27
SUB DisplayMenu
STATIC init, MS_HW AS LONG
IF NOT init THEN
init = -1
MS = _NEWIMAGE(640, MenuHeight, 32) 'MenuScreen image
D = _DEST: _DEST MS
CLS , &HFFAAAAAA 'background color gray
_PRINTSTRING (20, 2), "Menu Test" 'image text
MS_HW = _COPYIMAGE(MS, 33) 'create the MenuScreen_HardWare image
_FREEIMAGE MS
_DEST D
END IF
_PUTIMAGE (0, 0)-(640, MenuHeight), MS_HW
_DISPLAY
END SUB
```
> *Notes:* When _DISPLAY is commented out, the hardware Menu Test screen portion will blink and key codes may be seen underneath.
## See Also
* [_DISPLAY (function)](_DISPLAY-(function))
* [_DISPLAYORDER](_DISPLAYORDER)
* [_AUTODISPLAY](_AUTODISPLAY), [_AUTODISPLAY (function)](_AUTODISPLAY-(function))
* [_PUTIMAGE](_PUTIMAGE)
* [PCOPY](PCOPY)

View file

@ -1,36 +0,0 @@
The [_DISPLAYORDER](_DISPLAYORDER) statement defines the order to render software, hardware and custom-OpenGL-code.
## Syntax
> [_DISPLAYORDER](_DISPLAYORDER) [{_SOFTWARE|_HARDWARE|_HARDWARE1|_GLRENDER}][, ...][, ...][, ...][, ...]
## Parameter(s)
* _SOFTWARE refers to software created surfaces or [SCREEN](SCREEN)s.
* _HARDWARE and _HARDWARE1 refer to surfaces created by OpenGL hardware acceleration.
* _GLRENDER refers to OpenGL code rendering order
## Description
* The default on program start is: _DISPLAYORDER _SOFTWARE, _HARDWARE, _GLRENDER, _HARDWARE1
* Any content or combination order is allowed, except listing the same content twice consecutively.
* Simply using [_DISPLAYORDER](_DISPLAYORDER) _HARDWARE will render hardware surfaces only.
* Use an [underscore](underscore) to continue a code line on a new text row in the IDE.
* After _DISPLAYORDER has been used, it must be used to make any changes, even to default.
## Error(s)
* If a rendering content is not listed it will not be rendered except when using the startup default.
* Rendering the same content twice consecutively in a combination is not allowed.
## Availability
* Version 1.000 and up.
## See Also
* [_DISPLAY](_DISPLAY)
* [_PUTIMAGE](_PUTIMAGE)
* [_LOADIMAGE](_LOADIMAGE)
* [_COPYIMAGE](_COPYIMAGE)
* [Hardware images](Hardware-images)

View file

@ -1,103 +0,0 @@
The [_DONTBLEND](_DONTBLEND) statement turns off 32 bit alpha blending for the current image or screen mode where [_BLEND](_BLEND) is default.
## Syntax
> [_DONTBLEND](_DONTBLEND) [imageHandle&]
## Parameter(s)
* If imageHandle& is omitted, it is assumed to be the current [_DEST](_DEST)ination write page.
## Description
* If imageHandle& is not valid, an [ERROR Codes](ERROR-Codes) error will occur.
* [_DONTBLEND](_DONTBLEND) is faster than the default [_BLEND](_BLEND). **You may want to disable it**, unless you really need to use it in 32 bit.
* **32 bit screen surface backgrounds (black) have zero [_ALPHA](_ALPHA) so that they are transparent when placed over other surfaces.**
* Use [CLS](CLS) to make a new surface background [_ALPHA](_ALPHA) 255 or opaque.
* Both [_SOURCE](_SOURCE) and [_DEST](_DEST) must have [_BLEND](_BLEND) enabled, or else colors will NOT blend.
## Example(s)
Use _DONTBLEND when you want the 32 bit screen surface to be opaque so that it covers up other backgrounds. [CLS](CLS) works too.
```vb
SCREEN _NEWIMAGE(1280, 720, 32)
'CLS
_DONTBLEND '<<< comment out to see the difference
LINE (100, 100)-(500, 500), _RGB32(255, 255, 0), BF
b& = SaveBackground&
PRINT "This is just test junk"
PRINT
PRINT "Hit any key and the text should disappear, leaving us our pretty yellow box."
SLEEP
RestoreBackground b&
END
FUNCTION SaveBackground&
SaveBackground& = _COPYIMAGE(0)
END FUNCTION
SUB RestoreBackground (Image AS LONG)
_PUTIMAGE , Image, 0
END SUB
```
Turning off blending to create transparency.
```vb
SCREEN _NEWIMAGE(640, 480, 32)
alphaSprite& = _NEWIMAGE(64, 64, 32)
_DONTBLEND alphaSprite& ' turn off alpha-blending
'Create a simple sprite with transparency
_DEST alphaSprite&
FOR y = 0 TO 63
FOR x = 0 TO 63
alpha = SQR((x - 32) ^ 2 + (y - 32) ^ 2) / 32
IF alpha < 0 THEN alpha = 0
alpha = (1 - alpha * alpha) 'parabolic curve
PSET (x, y), _RGBA32(255, 255, 255, alpha * 255)
NEXT
NEXT
'Make a simple background texture
_DEST 0
FOR y = 1 TO 479
FOR x = 0 TO 639
PSET (x, y), _RGB32(x AND 255, y AND 255, (x XOR y) AND 255)
NEXT
NEXT
'Store background so we can show moveable objects on it
background& = _COPYIMAGE
'Treat my alpha values as transparency
_BLEND alphaSprite&
ph = 0
DO: _LIMIT 60
x = 320 - 250 * COS(ph) - (_WIDTH(alphaSprite&) \ 2)
y = 240 - 150 * COS(ph * 1.3) - (_HEIGHT(alphaSprite&) \ 2)
ph = ph + 0.03
_PUTIMAGE , background&, 0
_PUTIMAGE (x, y), alphaSprite&, 0
_DISPLAY
LOOP UNTIL LEN(INKEY$)
```
*Explanation:* To make the alpha image, turn alpha blending off. Otherwise PSET blends the pixel to instead of making the sprite transparent.
## See Also
* [_BLEND](_BLEND)
* [_BLEND (function)](_BLEND-(function))
* [Images](Images)

View file

@ -1,41 +0,0 @@
[_DONTWAIT](_DONTWAIT) is used with the [SHELL](SHELL) statement in **QB64** to specify that the program shouldn't wait until the external command/program is finished (which it otherwise does by default).
## Syntax
> [SHELL](SHELL) [_DONTWAIT] [commandLine$]
## Description
*Runs the command/program specified in commandline$ and lets the calling program continue at the same time in its current screen format.
*Especially useful when CMD /C or START is used in a SHELL command line to run another program.
* **QB64** automatically uses CMD /C or COMMAND /C when using SHELL.
* **QB64** program screens will not get distorted or minimized like QBasic fullscreen modes would.
## Example(s)
```vb
SHELL _DONTWAIT "notepad " + filename$
FOR x = 1 TO 5
_LIMIT 1
PRINT x
NEXT
```
(opens up notepad at the same time as counting to 5)
```text
1
2
3
4
5
```
## See Also
* [SHELL](SHELL), [_HIDE](_HIDE)

View file

@ -1,65 +0,0 @@
The [_DROPPEDFILE](_DROPPEDFILE) function returns the list of items (files or folders) dropped in a program's window after [_ACCEPTFILEDROP](_ACCEPTFILEDROP) is enabled.
## Syntax
*Syntax 1*
> nextItem$ = [_DROPPEDFILE](_DROPPEDFILE)
*Syntax 2*
> nextItem$ = [_DROPPEDFILE](_DROPPEDFILE)(index&)
## Description
* After [_ACCEPTFILEDROP](_ACCEPTFILEDROP) is enabled, once [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) is greater than 0 the list of dropped items will be available for retrieval with [_DROPPEDFILE](_DROPPEDFILE)
* When using [_DROPPEDFILE](_DROPPEDFILE) to read the list sequentially (without specifying an *index&*), an empty string ("") indicates the list is over and then [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) gets reset to 0.
* When using [_DROPPEDFILE](_DROPPEDFILE) with an index (which goes from 1 to [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES)), you must call [_FINISHDROP](_FINISHDROP) after you finish working with the list.
* Because it returns a string, [_DROPPEDFILE](_DROPPEDFILE) also accepts being followed by a string suffix ([_DROPPEDFILE](_DROPPEDFILE)**$**)
* **[Keywords currently not supported](Keywords-currently-not-supported-by-QB64)**.
## Availability
* Version 1.3 and up.
## Example(s)
Accepting files dragged from a folder and processing the list received by specifying an index.
```vb
SCREEN _NEWIMAGE(128, 25, 0)
_ACCEPTFILEDROP 'enables drag/drop functionality
PRINT "Drag files from a folder and drop them in this window..."
DO
IF _TOTALDROPPEDFILES THEN
FOR i = 1 TO _TOTALDROPPEDFILES
a$ = _DROPPEDFILE(i)
COLOR 15
PRINT i,
IF _FILEEXISTS(a$) THEN
COLOR 2: PRINT "file",
ELSE
IF _DIREXISTS(a$) THEN
COLOR 3: PRINT "folder",
ELSE
COLOR 4: PRINT "not found", 'highly unlikely, but who knows?
END IF
END IF
COLOR 15
PRINT a$
NEXT
_FINISHDROP
END IF
_LIMIT 30
LOOP
```
## See Also
* [_ACCEPTFILEDROP](_ACCEPTFILEDROP), [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES), [_FINISHDROP](_FINISHDROP)
* [_FILEEXISTS](_FILEEXISTS), [_DIREXISTS](_DIREXISTS)

View file

@ -1,30 +0,0 @@
The [_ECHO](_ECHO) statement allows outputting text to a [$CONSOLE]($CONSOLE) window without having to alternate between [_DEST](_DEST) pages.
## Syntax
> [_ECHO](_ECHO) {*"text to output"* | textVariable$}
## Description
* [_ECHO](_ECHO) is a shorthand to saving current [_DEST](_DEST), switching to [_DEST](_DEST) [_CONSOLE](_CONSOLE), [PRINT](PRINT)ing, then switching back to the previous [_DEST](_DEST).
* To output numbers, use the [STR$](STR$) function.
## Availability
* Version 1.3 and up.
## Example(s)
```vb
$CONSOLE
PRINT "this will show in the main window"
_ECHO "this will show in the console"
```
## See Also
* [_DEST](_DEST)
* [$CONSOLE]($CONSOLE), [_CONSOLE](_CONSOLE)
* [STR$](STR$)

View file

@ -1,17 +0,0 @@
The [_ENVIRONCOUNT](_ENVIRONCOUNT) function returns the number of items (key/value pairs) currently stored in the system environment variables table.
## Syntax
> totalKeys& = [_ENVIRONCOUNT](_ENVIRONCOUNT)
## Description
* Any changes made at runtime to the environment table are discarded when your program ends
## Availability
* Version 2.0 and up.
## See Also
* [ENVIRON$](ENVIRON$), [ENVIRON](ENVIRON)

View file

@ -1,36 +0,0 @@
The [_ERRORLINE](_ERRORLINE) function returns the source code line number that caused the most recent runtime error.
## Syntax
> e% = [_ERRORLINE](_ERRORLINE)
## Description
* Used in program error troubleshooting.
* Does not require that the program use line numbers as it counts the actual lines of code.
* The code line can be found using the QB64 IDE (Use the shortcut **Ctrl+G** to go to a specific line) or any other text editor such as Notepad.
## Example(s)
Displaying the current program line using a simulated [ERROR](ERROR) code.
```vb
ON ERROR GOTO DebugLine 'can't use GOSUB
ERROR 250 'simulated error code
END
DebugLine:
PRINT _ERRORLINE
RESUME NEXT
```
## See Also
* [ON ERROR](ON-ERROR)
* [_INCLERRORLINE](_INCLERRORLINE), [_INCLERRORFILE$](_INCLERRORFILE$), [_ERRORMESSAGE$](_ERRORMESSAGE$)
* [ERR](ERR), [ERL](ERL)
* [ERROR](ERROR)
* [ERROR Codes](ERROR-Codes)

View file

@ -1,42 +0,0 @@
The [_ERRORMESSAGE$](_ERRORMESSAGE$) function returns a human-readable description of the most recent runtime error, or the description of an arbitrary error code passed to it.
## Syntax
> e$ = [_ERRORMESSAGE$](_ERRORMESSAGE$)
>
> e$ = [_ERRORMESSAGE$](_ERRORMESSAGE$)(errorCode%)
## Description
* Used in program error troubleshooting.
* The message returned is identical to the message shown in the dialog box that appears if your program has no error handler. See [ERROR Codes](ERROR-Codes) for the full list of error codes and their messages.
## Example(s)
Using an error handler that ignores any error.
```vb
ON ERROR GOTO Errhandler
' Main module program error simulation code
ERROR 7 ' simulate an Out of Memory Error
PRINT "Error handled...ending program"
SLEEP 4
SYSTEM ' end of program code
Errhandler: 'error handler sub program line label
PRINT "Error"; ERR; "on program file line"; _ERRORLINE
PRINT "Description: "; _ERRORMESSAGE$; "."
BEEP ' warning beep
RESUME NEXT ' moves program to code following the error.
```
## See Also
* [ON ERROR](ON-ERROR)
* [_ERRORLINE](_ERRORLINE)
* [_INCLERRORLINE](_INCLERRORLINE), [_INCLERRORFILE$](_INCLERRORFILE$)
* [ERR](ERR), [ERL](ERL)
* [ERROR](ERROR)
* [ERROR Codes](ERROR-Codes)

View file

@ -1,68 +0,0 @@
The [_EXIT](_EXIT) function prevents the user from closing a program and indicates if a user has clicked the close button in the window title (**X** button) or used CTRL + BREAK.
## Syntax
> exitSignal% = [_EXIT](_EXIT)
## Description
* Once the [_EXIT](_EXIT) function is used, the user can no longer manually exit the program until it is ended with [END](END) or [SYSTEM](SYSTEM).
* [_EXIT](_EXIT) returns any exit requests made after the initial call as:
* 0 = no exit request has been made since _EXIT monitoring began in the program.
* 1 = exit attempted by clicking the window X (close) button since last function call. (Bit 0 set)
* 2 = exit attempted with CTRL + BREAK since last call. (Bit 1 set)
* 3 = both CTRL + BREAK and the X box have been used since last call. (Bit 0 and 1 set)
* If a return value is not 0 the program can handle an exit request at a more convenient time if necessary.
* After being read, the _EXIT value is reset to 0 so store the value when a program delays an exit request.
* **Note: Once _EXIT has been used once, you must monitor your program by checking it for user _EXIT requests.**
* Don't just use _EXIT once to prevent a user from exiting a program early, as that constitutes bad practice.
## Example(s)
Using an ON TIMER check to read the _EXIT request return values.
```vb
q = _EXIT 'function read prevents any program exit at start of program
ON TIMER(5) GOSUB quit
TIMER ON
PRINT " The Timer will check for exit request every 5 seconds."
PRINT "Click the X box and/or Ctrl - Break to see the _EXIT return!"
PRINT " Any Key Quits"
PRINT
DO: _LIMIT 30
' ' simulated program loop
LOOP UNTIL INKEY$ <> ""
END
quit:
q = _EXIT
IF q THEN PRINT q;
SELECT CASE q
CASE 1: PRINT "= X button was clicked"
CASE 2: PRINT "= Ctrl + Break keypress"
CASE 3: PRINT "= Both X and Ctrl + Break!"
END SELECT
RETURN
```
Removing temporary files before closing a program upon a user's exit request.
```vb
x = _EXIT 'initial function call blocks a user exit
OPEN "t3mpdata.tmp" FOR APPEND AS #1
DO
IF _EXIT THEN CLOSE: KILL "t3mpdata.tmp": _DELAY 1: SYSTEM
LOOP
```
Note: If you have a file named *t3mpdata.tmp* change the file name!
## See Also
* [SYSTEM](SYSTEM)
* [END](END)
* [EXIT](EXIT)

View file

@ -1,31 +0,0 @@
The **_FILEEXISTS** function determines if a designated file name exists and returns true (-1) or false (0).
## Syntax
> theFileExists% = [_FILEEXISTS](_FILEEXISTS)(filename$)
## Description
* The filename$ parameter can be a literal or variable [STRING](STRING) value that can include a path.
* The function returns -1 when a file exists and 0 when it does not.
* The function reads the system information directly without using a [SHELL](SHELL) procedure.
* The function will use the appropriate Operating System path separators. [_OS$](_OS$) can determine the operating system.
* **This function does not guarantee that a file can be accessed or opened, just that it exists.**
## Example(s)
Checks if a file exists before opening it.
```vb
IF _FILEEXISTS("mysettings.ini") THEN
PRINT "Settings file found."
END IF
```
## See Also
* [_DIREXISTS](_DIREXISTS), [_OS$](_OS$)
* [SHELL](SHELL), [FILES](FILES)
* [KILL](KILL)

View file

@ -1,56 +0,0 @@
The [_FINISHDROP](_FINISHDROP) statement resets [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES) and clears the [_DROPPEDFILE](_DROPPEDFILE) list of items (files/folders).
## Syntax
> [_FINISHDROP](_FINISHDROP)
## Description
* When using [_DROPPEDFILE](_DROPPEDFILE) with an index (which goes from 1 to [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES)), you must call [_FINISHDROP](_FINISHDROP) after you finish working with the list in order to prepare for the next drag/drop operation.
* **[Keywords currently not supported](Keywords-currently-not-supported-by-QB64)**.
## Availability
* Version 1.3 and up.
## Example(s)
Accepting files dragged from a folder and processing the list received by specifying an index.
```vb
SCREEN _NEWIMAGE(128, 25, 0)
_ACCEPTFILEDROP 'enables drag/drop functionality
PRINT "Drag files from a folder and drop them in this window..."
DO
IF _TOTALDROPPEDFILES THEN
FOR i = 1 TO _TOTALDROPPEDFILES
a$ = _DROPPEDFILE(i)
COLOR 15
PRINT i,
IF _FILEEXISTS(a$) THEN
COLOR 2: PRINT "file",
ELSE
IF _DIREXISTS(a$) THEN
COLOR 3: PRINT "folder",
ELSE
COLOR 4: PRINT "not found", 'highly unlikely, but who knows?
END IF
END IF
COLOR 15
PRINT a$
NEXT
_FINISHDROP 'If _FINISHDROP isn't called here then _TOTALDROPPEDFILES never gets reset.
END IF
_LIMIT 30
LOOP
```
## See Also
* [_ACCEPTFILEDROP](_ACCEPTFILEDROP), [_TOTALDROPPEDFILES](_TOTALDROPPEDFILES), [_DROPPEDFILE](_DROPPEDFILE)
* [_FILEEXISTS](_FILEEXISTS), [_DIREXISTS](_DIREXISTS)

View file

@ -1,26 +0,0 @@
**_FLOAT** numerical values offer the maximum floating-point decimal precision available using **QB64**.
## Syntax
> [DIM](DIM) variable AS [_FLOAT](_FLOAT)
## Description
* **QB64** always allocates 32 bytes to store this value.
* It is safe to assume this value is at least as precise as [DOUBLE](DOUBLE).
* Under the current implementation it is stored in a 10-byte floating point variable.
* [_FLOAT](_FLOAT) variables can also use the ## variable name type suffix.
* Values returned may be expressed using exponential or [scientific notation](scientific-notation) using **E** for SINGLE or **D** for DOUBLE precision.
* According to [IEEE-754](http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html) this can store a value of up to 1.1897E+4932 compared to a DOUBLE which goes up to 1.7976E+308.
* Floating decimal point numerical values cannot be [_UNSIGNED](_UNSIGNED).
* Values can be converted to 32 byte [ASCII](ASCII) strings using [_MK$](_MK$) and back with [_CV](_CV).
* **When a variable has not been assigned or has no type suffix, the value defaults to [SINGLE](SINGLE).**
* Note: OpenGL's [_GL_FLOAT](_GL-FLOAT) constant is a [SINGLE](SINGLE) (4 byte) floating point number, while a native QB64 _FLOAT is a 10-byte floating point number.
## See Also
* [DOUBLE](DOUBLE), [SINGLE](SINGLE)
* [_MK$](_MK$), [_CV](_CV)
* [_DEFINE](_DEFINE), [DIM](DIM)
* [PDS (7.1) Procedures](PDS-(7.1)-Procedures)
* [Variable Types](Variable-Types)

View file

@ -1,14 +0,0 @@
The [_FONT (function)](_FONT-(function)) function retrieves the font handle from the specified image handle or the current [_DEST](_DEST)ination page's font.
## Syntax
> fontHandle& = [_FONT (function)](_FONT-(function))[(imageHandle&)]
## Description
* imageHandle& is the handle to the image which you want to retrieve the font from. If not specified, it is assumed to be the current [_DEST](_DEST)ination page.
## See Also
* [_LOADFONT](_LOADFONT), [_FONT](_FONT)
* [_DEST](_DEST)

View file

@ -1,77 +0,0 @@
The [_FONT](_FONT) statement sets the current [_LOADFONT](_LOADFONT) function font handle to be used by [PRINT](PRINT).
## Syntax
> [_FONT](_FONT) fontHandle&[, imageHandle&]
## Parameter(s)
* fontHandle& is the handle retrieved from [_LOADFONT](_LOADFONT) function, the [_FONT (function)](_FONT-(function)) function, or a predefined handle.
* If the image handle is omitted the current image [_DEST](_DEST)ination is used. Zero can designate the current program [SCREEN](SCREEN).
## Description
* Predefined **QB64** font handle numbers can be used before freeing a font:
* **_FONT 8** - default font for [SCREEN (statement)](SCREEN-(statement)) 1, 2, 7, 8 or 13
* **_FONT 14** - default font for [SCREEN (statement)](SCREEN-(statement)) 9 or 10
* **_FONT 16** - default font for [SCREEN (statement)](SCREEN-(statement)) 0 ([WIDTH](WIDTH) 80, 25 text only), 11 or 12
* **_FONT 9, 15** and **17** are the double width versions of 8, 14 and 16 respectively in text **SCREEN 0 only**.
* [Unicode](Unicode) characters can be assigned to a monospace font that contains those unicode characters using the [_MAPUNICODE](_MAPUNICODE) TO [ASCII](ASCII) mapping statement. The optional **IME cyberbit.ttf** font included with QB64 can also be used.
* Can alpha blend a font with a background screen created by [_NEWIMAGE](_NEWIMAGE) in 32 bit color.
* **Check for valid handle values greater than 0 before using or freeing font handles.**
* Free **unused** font handles with [_FREEFONT](_FREEFONT). Freeing invalid handles will create an [ERROR Codes](ERROR-Codes) error.
* **NOTE: SCREEN 0 can only use one font type and style per viewed SCREEN page. Font size may also affect the window size.**
## Example(s)
Previewing a font in SCREEN 0. A different true type font can be substituted below.
```vb
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
DO: CLS
DO
style$ = "MONOSPACE"
PRINT
INPUT "Enter A FONT Size 8 TO 25: ", fontsize%
LOOP UNTIL fontsize% > 7 and fontsize% < 26
DO
PRINT
INPUT "Enter (0) for REGULAR OR (1) for ITALIC FONT: ", italic%
LOOP UNTIL italic% = 0 or italic% = 1
DO
PRINT
INPUT "Enter (0) for REGULAR OR (1) for BOLD FONT: ", bold%
LOOP UNTIL italic% = 0 or italic% = 1
IF italic% = 1 THEN style$ = style$ + ", ITALIC"
IF bold% = 1 then style$ = style$ + ", BOLD"
GOSUB ClearFont
font& = _LOADFONT(fontpath$, fontsize%, style$)
_FONT font&
PRINT
PRINT "This is your LUCON font! Want to try another STYLE?(Y/N): ";
DO: SLEEP: K$ = UCASE$(INKEY$): LOOP UNTIL K$ = "Y" OR K$ = "N"
LOOP UNTIL K$ = "N"
GOSUB ClearFont
PRINT "This is the QB64 default _FONT 16!"
END
ClearFont:
IF font& > 0 THEN
_FONT 16 'select inbuilt 8x16 default font
_FREEFONT font&
END IF
RETURN
```
**NOTE:** [ENVIRON$](ENVIRON$)("SYSTEMROOT") returns a string value of: "C:\WINDOWS". Add the "\FONTS\" folder and the **.TTF** font file name.
## See Also
* [_FONT (function)](_FONT-(function))
* [_LOADFONT](_LOADFONT), [_FREEFONT](_FREEFONT)
* [Unicode](Unicode), [_MAPUNICODE](_MAPUNICODE)
* [Windows Libraries](Windows-Libraries)

View file

@ -1,55 +0,0 @@
The [_FONTHEIGHT](_FONTHEIGHT) function returns the font height of a font handle created by [_LOADFONT](_LOADFONT).
## Syntax
> pixelHeight% = [_FONTHEIGHT](_FONTHEIGHT)[(fontHandle&)]
## Description
* Returns the height of the last font used if a handle is not designated.
* If no font is set it returns the current screen mode's text block height.
## Example(s)
Finding the [_FONT](_FONT) or text block size of printed [STRING](STRING) characters in graphic [SCREEN](SCREEN) modes.
```vb
DO
INPUT "Enter Screen mode 1, 2 or 7 to 13 or 256, 32 for _NEWIMAGE: ", scr$
mode% = VAL(scr$)
LOOP UNTIL mode% > 0
SELECT CASE mode%
CASE 1, 2, 7 TO 13: SCREEN mode%
CASE 256, 32: SCREEN _NEWIMAGE(800, 600, mode%)
CASE ELSE: PRINT "Invalid mode selected!": END
END SELECT
INPUT "Enter first name of TTF font to use or hit enter for text block size: ", TTFont$
IF LEN(TTFont$) THEN INPUT "Enter font height: ", hi$
height& = VAL(hi$)
IF height& > 0 THEN
fnt& = _LOADFONT("C:\Windows\Fonts\" + TTFont$ + ".ttf", height&, style$)
IF fnt& <= 0 THEN PRINT "Invalid Font handle!": END
_FONT fnt&
END IF
TextSize wide&, high& 'get the font or current screen mode's text block pixel size
_PRINTSTRING (20, 100), "Block size = " + CHR$(1) + STR$(wide&) + " X" + STR$(high&) + " " + CHR$(2)
END
SUB TextSize (TextWidth&, TextHeight&)
TextWidth& = _PRINTWIDTH("W") 'measure width of one font or text character
TextHeight& = _FONTHEIGHT 'can measure normal text block heights also
END SUB
```
## See Also
* [_FONTWIDTH](_FONTWIDTH), [_FONT](_FONT)
* [_PRINTWIDTH](_PRINTWIDTH), [_PRINTSTRING](_PRINTSTRING)
* [SCREEN](SCREEN), [_LOADFONT](_LOADFONT)
* [Text Using Graphics](Text-Using-Graphics) (Demo)

View file

@ -1,55 +0,0 @@
The [_FONTHEIGHT](_FONTHEIGHT) function returns the font height of a font handle created by [_LOADFONT](_LOADFONT).
## Syntax
> pixelHeight% = [_FONTHEIGHT](_FONTHEIGHT)[(fontHandle&)]
## Description
* Returns the height of the last font used if a handle is not designated.
* If no font is set it returns the current screen mode's text block height.
## Example(s)
Finding the [_FONT](_FONT) or text block size of printed [STRING](STRING) characters in graphic [SCREEN](SCREEN) modes.
```vb
DO
INPUT "Enter Screen mode 1, 2 or 7 to 13 or 256, 32 for _NEWIMAGE: ", scr$
mode% = VAL(scr$)
LOOP UNTIL mode% > 0
SELECT CASE mode%
CASE 1, 2, 7 TO 13: SCREEN mode%
CASE 256, 32: SCREEN _NEWIMAGE(800, 600, mode%)
CASE ELSE: PRINT "Invalid mode selected!": END
END SELECT
INPUT "Enter first name of TTF font to use or hit enter for text block size: ", TTFont$
IF LEN(TTFont$) THEN INPUT "Enter font height: ", hi$
height& = VAL(hi$)
IF height& > 0 THEN
fnt& = _LOADFONT("C:\Windows\Fonts\" + TTFont$ + ".ttf", height&, style$)
IF fnt& <= 0 THEN PRINT "Invalid Font handle!": END
_FONT fnt&
END IF
TextSize wide&, high& 'get the font or current screen mode's text block pixel size
_PRINTSTRING (20, 100), "Block size = " + CHR$(1) + STR$(wide&) + " X" + STR$(high&) + " " + CHR$(2)
END
SUB TextSize (TextWidth&, TextHeight&)
TextWidth& = _PRINTWIDTH("W") 'measure width of one font or text character
TextHeight& = _FONTHEIGHT 'can measure normal text block heights also
END SUB
```
## See Also
* [_FONTWIDTH](_FONTWIDTH), [_FONT](_FONT)
* [_PRINTWIDTH](_PRINTWIDTH), [_PRINTSTRING](_PRINTSTRING)
* [SCREEN](SCREEN), [_LOADFONT](_LOADFONT)
* [Text Using Graphics](Text-Using-Graphics) (Demo)

View file

@ -1,17 +0,0 @@
The [_FONTWIDTH (function)](_FONTWIDTH-(function)) function returns the point-size width of a monospace font.
## Syntax
> *result&* = [_FONTWIDTH (function)](_FONTWIDTH-(function))(fontHandle&)
## Description
* If fontHandle& is omitted, it is assumed to be the font of the current write page.
* If fontHandle& is an invalid handle, an [ERROR Codes](ERROR-Codes) error is thrown.
* If the font specified by fontHandle& is not a monospace font, 0 (zero) is returned.
## See Also
* [_FONTWIDTH](_FONTWIDTH)
* [_FONTHEIGHT](_FONTHEIGHT), [_FONTHEIGHT (function)](_FONTHEIGHT-(function))
* [_LOADFONT](_LOADFONT)

View file

@ -1,18 +0,0 @@
The [_FONTWIDTH](_FONTWIDTH) function returns the font width of a MONOSPACE font handle created by [_LOADFONT](_LOADFONT).
## Syntax
> pixelWidth% = [_FONTWIDTH](_FONTWIDTH)[(fontHandle&)]
* Returns the character width of the last font used if a handle is not specified.
* **Variable width fonts always return pixelWidth% = 0.** Even fixed width fonts return 0 unless the [LOADFONT](LOADFONT) style option is used.
* QB64 **version 1.000 and up** can load a variable width font as monospaced with the [LOADFONT](LOADFONT) style parameter.
* The font width is generally 3/4 of the [_FONTHEIGHT](_FONTHEIGHT) specified when loading the font.
* In **graphics** [SCREEN (statement)](SCREEN-(statement)) modes, [_PRINTWIDTH](_PRINTWIDTH) can return the total **pixel width** of a literal or variable [STRING](STRING) of text.
## See Also
* [_FONTHEIGHT](_FONTHEIGHT)
* [_FONT](_FONT)
* [_LOADFONT](_LOADFONT)
* [_PRINTWIDTH](_PRINTWIDTH)

View file

@ -1,101 +0,0 @@
The [_FREEFONT](_FREEFONT) statement frees a font handle that was created by [_LOADFONT](_LOADFONT).
## Syntax
> [_FREEFONT](_FREEFONT) (fontHandle&)
## Description
* Unloads fonts that are no longer in use or needed in order to free program memory and resources.
* You cannot free a font which is in use. Change the font to a QB64 default font size before freeing the handle (see example below).
* Predefined **QB64** font handle numbers can be used before freeing a font:
* **_FONT 8** - default font for [SCREEN (statement)](SCREEN-(statement)) 1, 2, 7, 8 or 13
* **_FONT 14** - default font for [SCREEN (statement)](SCREEN-(statement)) 9 or 10
* **_FONT 16** - default font for [SCREEN (statement)](SCREEN-(statement)) 0 ([WIDTH](WIDTH) 80, 25 text only), 11 or 12
* **_FONT 9, 15** and **17** are the double width versions of 8, 14 and 16 respectively in text **SCREEN 0**.
* If the font handle is invalid (equals -1 or 0), an [ERROR Codes](ERROR-Codes) will occur. **Check handle values before using or freeing them.**
* You cannot free inbuilt/default QB64 fonts nor do they ever need freed.
## Example(s)
Previews and creates a file list of valid MONOSPACE TTF fonts by checking the [_LOADFONT](_LOADFONT) handle values.
```vb
SCREEN 12
path$ = "C:\WINDOWS\Fonts\" 'path to the font folder
SHELL _HIDE "DIR /b " + path$ + "\*.ttf > TTFonts.INF"
style$ = "monospace" 'set style to MONOSPACE
OPEN "TTFonts.INF" FOR INPUT AS #1 'list of TTF fonts only
OPEN "TTFMono.INF" FOR OUTPUT AS #2 'will hold list of valid MONOSPACE fonts
DO UNTIL EOF(1): found = found + 1
LINE INPUT #1, font$
f& =_LOADFONT(path$ + font$, 30, style$)
IF f& > 0 THEN 'check for valid handle values > 0
OK = OK + 1
PRINT #2, font$
_FONT f& 'will create error if handle is invalid!
PRINT "Hello World!"
PRINT: PRINT: PRINT font$; f&
PRINT "Press any key."
K$ = INPUT$(1)
_FONT 16 'use QB64 default font to free tested font
_FREEFONT f& 'returns an error if handle <= 0!
CLS
END IF
PRINT
IF K$ = CHR$(27) THEN EXIT DO
LOOP
CLOSE
PRINT: PRINT: PRINT "Found"; found; "TTF files,"; OK; "can use Monospace,"
END
```
```text
Found 106 TTF files, 13 can use Monospace.
```
Using a _FREEFONT sub-procedure.
```vb
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf"
style$ = "MONOSPACE, ITALIC, BOLD"
fontsize% = 20
_FONT 16
PRINT
PRINT "This is the QB64 default _FONT 16! To change, press any key!"
DO: SLEEP: LOOP UNTIL INKEY$ <> ""
GOSUB ClearFont 'call will not free anything if font& = 0
font& = _LOADFONT(fontpath$, fontsize%, style$)
IF font > 0 THEN _FONT font& 'NEVER try to load a font value less than 1!
PRINT
PRINT "A NEW _FONT style. To change to default, press any key!"
DO: SLEEP: LOOP UNTIL INKEY$ <> ""
GOSUB ClearFont 'call will free a valid font handle from memory
END
ClearFont:
IF font& > 0 THEN
_FONT 16 'change used font to the QB64 8x16 default font
_FREEFONT font&
PRINT: PRINT "The previous font was freed with _FREEFONT!"
ELSE : PRINT: PRINT "_FREEFONT was not used!"
END IF
RETURN
```
## See Also
* [_FONT](_FONT)
* [_LOADFONT](_LOADFONT)

View file

@ -1,40 +0,0 @@
The **_FREEIMAGE** statement releases the designated file image created by the [_LOADIMAGE](_LOADIMAGE), [_NEWIMAGE](_NEWIMAGE) or [_COPYIMAGE](_COPYIMAGE) functions from memory when they are no longer needed.
## Syntax
> [_FREEIMAGE](_FREEIMAGE) [handle&]
## Description
* If handle& is omitted, the current destination image is freed from memory.
* Freeing the destination image or source image will result in the display page being selected instead.
* **Invalid image handle values of -1 or 0 cannot be freed or an [ERROR Codes](ERROR-Codes) will occur.** Check the handle value first.
* **[SCREEN](SCREEN) modes in use cannot be freed or an [ERROR Codes](ERROR-Codes) will occur.** Change SCREEN modes before freeing.
* Once a specific image handle is no longer used or referenced by your program, it can be freed with [_FREEIMAGE](_FREEIMAGE).
* **Images are not deallocated when the [SUB](SUB) or [FUNCTION](FUNCTION) they are created in ends. Free them with [_FREEIMAGE](_FREEIMAGE).**
* **It is important to free unused or unneeded images with [_FREEIMAGE](_FREEIMAGE) to prevent memory overflow errors.**
* **Do not try to free image handles currently being used as the active [SCREEN](SCREEN). Change screen modes first.**
## Example(s)
Loading a program splash screen and freeing image when no longer necessary:
```vb
s& = _LOADIMAGE("SPLASH.BMP",32) 'load 32 bit(24 BPP) image
IF s& < -1 THEN SCREEN s& 'use image as a 32 bit SCREEN
_DELAY 6 'display splash screen for 6 seconds
SCREEN 0 'MUST change screen mode before freeing a SCREEN image!
IF s& < -1 THEN _FREEIMAGE s& 'handle value MUST be less than -1 or error!
CLS
```
> *Note:* A valid image file name must be used by [_LOADIMAGE](_LOADIMAGE) or the invalid handle memory value will not need to be freed.
## See Also
* [_NEWIMAGE](_NEWIMAGE)
* [_LOADIMAGE](_LOADIMAGE)
* [_SCREENIMAGE](_SCREENIMAGE)
* [_COPYIMAGE](_COPYIMAGE)

View file

@ -1,15 +0,0 @@
The [_FREETIMER](_FREETIMER) function returns a free [TIMER](TIMER) number for multiple [ON TIMER(n)](ON-TIMER(n)) events.
## Syntax
> timerhandle% = [_FREETIMER](_FREETIMER)
## Description
* QB64 can use an unlimited number of ON TIMER (number, seconds!) event [INTEGER](INTEGER) values at once.
* Every time _FREETIMER is called the [INTEGER](INTEGER) value returned will increase by one, starting at 1, whether it is used or not.
* Store multiple returns in different variable names to refer to separate events later.
## See Also
* [ON TIMER(n)](ON-TIMER(n))

View file

@ -1,106 +0,0 @@
The [_FULLSCREEN](_FULLSCREEN) function returns the present full screen mode setting of the screen window.
## Syntax
> full% = [_FULLSCREEN](_FULLSCREEN-(function))
## Description
* *Function returns:*
* 0 = _OFF (any positive non-0 value means fullscreen is on)
* 1 = _STRETCH
* 2 = _SQUAREPIXELS
* It **cannot** be assumed that calling [_FULLSCREEN](_FULLSCREEN) will succeed. It cannot be assumed that the type of full screen will match the requested one. **Always check the [_FULLSCREEN (function)](_FULLSCREEN-(function)) return in your programs.**
* **Warning:** Despite your software, the user's hardware, drivers and monitor may not function in some modes. Thus, it is highly recommended that you manually confirm with the user whether the switch to full screen was successful. This can be done "quietly" in some cases by getting the user to click on a button on screen with their mouse or press an unusual key. If the user does not respond after about 8 seconds, switch them back to windowed mode.
**Using large fonts with [_FULLSCREEN](_FULLSCREEN) can cause monitor or Windows Desktop problems or kill a program.**
## Example(s)
Shows how fonts and the _FULLSCREEN mode can resize a program window.
```vb
CLS
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
f& = _FONT: defaultf& = f&
DO
INPUT "1) DEFAULT 2) SIZE WINDOW 3) FULL SCREEN 4) FULL STRETCHED Q) QUIT: ", winmode$
IF UCASE$(winmode$) = "Q" THEN EXIT DO
style$ = "MONOSPACE"
SELECT CASE winmode$
CASE "1"
full = _FULLSCREEN 'get current full screen mode
IF full <> 0 THEN _FULLSCREEN _OFF
GOSUB ChangeFont
CASE "2"
DO
PRINT
INPUT "Enter a FONT SIZE 5 to 25: ", fontsize%
LOOP UNTIL fontsize% > 4 AND fontsize% < 26
DO
PRINT
INPUT "Enter (0) for REGULAR or (1) for ITALIC FONT: ", italic%
LOOP UNTIL italic% = 0 or italic% = 1
DO
PRINT
INPUT "Enter (0) for REGULAR or (1) for BOLD FONT: ", bold%
LOOP UNTIL italic% = 0 or italic% = 1
IF italic% = 1 THEN style$ = style$ + ", ITALIC"
IF bold% = 1 THEN style$ = style$ + ", BOLD"
full = _FULLSCREEN 'get current full screen mode
IF full <> 0 THEN _FULLSCREEN _OFF
GOSUB ChangeFont
CASE "3"
GOSUB ChangeFont
_FULLSCREEN _SQUAREPIXELS
GOSUB CheckFull
CASE "4"
GOSUB ChangeFont
_FULLSCREEN _STRETCH
GOSUB CheckFull
END SELECT
PRINT: PRINT "_FullScreen mode ="; _FULLSCREEN
PRINT
LOOP
GOSUB ChangeFont
END
CheckFull: '<<<<<<<<<<<<<< turn off full screen if function returns 0!
full = _FULLSCREEN 'get current full screen mode
IF full = 0 THEN _FULLSCREEN _OFF: SOUND 100, .75
RETURN
ChangeFont:
IF winmode$ <> "2" THEN
_FONT 16 'select inbuilt 8x16 default font
currentf& = _FONT
ELSE
currentf& = _LOADFONT(fontpath$, fontsize%, style$)
_FONT currentf&
END IF
IF currentf& <> f& AND f& <> defaultf& THEN _FREEFONT f&
f& = currentf&
RETURN
```
*Explanation:* The **_FULLSCREEN** function can avoid screen display and monitor problems when used to monitor the success of the full screen operation. If a full screen mode is **not** achieved (the function will return 0), **call [_FULLSCREEN](_FULLSCREEN) OFF**
## See Also
* [_FULLSCREEN](_FULLSCREEN) (statement)
* [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN)
* [_SCREENMOVE](_SCREENMOVE), [_SCREENX](_SCREENX), [_SCREENY](_SCREENY)

View file

@ -1,138 +0,0 @@
The [_FULLSCREEN](_FULLSCREEN) statement attempts to make the program window fullscreen.
## Syntax
> [_FULLSCREEN](_FULLSCREEN) [*_STRETCH | _SQUAREPIXELS| _OFF*][, *_SMOOTH*]
## Parameter(s)
* _STRETCH default first choice attempts to mimic QBasic's full screens if possible. [_FULLSCREEN (function)](_FULLSCREEN-(function)) returns 1.
* _SQUAREPIXELS alternate choice enlarges the pixels into squares on some monitors. [_FULLSCREEN (function)](_FULLSCREEN-(function)) returns 2
* _OFF turns _FULLSCREEN off after full screen has been enabled. [_FULLSCREEN (function)](_FULLSCREEN-(function)) returns 0.
* Second optional parameter *_SMOOTH* applies anti-aliasing to the stretched screen.
## Description
* **Set the [SCREEN](SCREEN) mode and text [WIDTH](WIDTH) when necessary first.** Otherwise there may be desktop view issues.
* _FULLSCREEN with no parameters chooses _STRETCH or _SQUAREPIXELS (prioritizes _STRETCH to mimic QBasic if possible)
* **Check the fullscreen mode with the [_FULLSCREEN (function)](_FULLSCREEN-(function)) function in your programs when a method is required.
* It is advisable to get [INPUT](INPUT) from the user to confirm that fullscreen was completed or there were possible monitor incompatibilities.
* If fullscreen is **not confirmed** with a [_FULLSCREEN (function)](_FULLSCREEN-(function)) return **greater than 0**, then disable with **_FULLSCREEN _OFF**.
* **NOTE:** _FULLSCREEN can also be affected by custom [_FONT](_FONT) size settings and make program screens too large.
## Example(s)
Setting the screen mode first prevents enlargement of the desktop before the program window is set:
```vb
SCREEN 12
_FULLSCREEN
IF _FULLSCREEN = 0 THEN _FULLSCREEN _OFF 'check that a full screen mode initialized
LINE (100, 100)-(500, 400), 13, BF
```
How fonts and _FULLSCREEN affect the program's window size.
```vb
SCREEN 0
DO
PRINT
LINE INPUT "Enter MODE 1) ENLARGE WINDOW 2) FULL _SQUAREPIXELS 3) FULL _STRETCH: ", WMODE$
PRINT
IF WMODE$ = "1" THEN INPUT "SIZE 1 TO 9: ", ENLARGE%
SELECT CASE ENLARGE%
CASE 1, 2, 3, 4, 5: STYLE$ = "MONOSPACE, BOLD"
CASE 6, 7, 8, 9: STYLE$ = "MONOSPACE"
CASE ELSE: STYLE$ = "MONOSPACE"
END SELECT
SELECT CASE WMODE$
CASE "1"
full = _FULLSCREEN
IF full > 0 THEN _FULLSCREEN _OFF
f& = _LOADFONT("c:\windows\fonts\lucon.ttf", 13 + ENLARGE%, STYLE$)
_FONT f&
CASE "2"
_FULLSCREEN _SQUAREPIXELS
full = _FULLSCREEN
IF full = 0 THEN GOSUB FCHECK
CASE "3"
_FULLSCREEN _STRETCH
full = _FULLSCREEN
IF full = 0 THEN GOSUB FCHECK
END SELECT
mode = _FULLSCREEN
PRINT
PRINT "_FULLSCREEN mode ="; mode,
PRINT "PRESS ESC TO END OR ENTER TO CONTINUE..."
DO: SLEEP: B$ = INKEY$: LOOP UNTIL B$ = CHR$(13) OR B$ = CHR$(27)
GOSUB ClearFont
LOOP UNTIL B$ = CHR$(27)
ClearFont
END
FCHECK:
Z3 = timer
DO
IF TIMER < Z3 THEN Z3 = Z3 - TIMER
IF TIMER - Z3 > 4 THEN EXIT DO
LOOP
full = _FULLSCREEN
IF full = 0 THEN _FULLSCREEN _OFF: SOUND 100, .75
RETURN
ClearFont:
IF f& > 0 THEN
_FONT 16 'select inbuilt 8x16 default font
_FREEFONT f&
END IF
RETURN
```
Testing all fullscreen methods.
```vb
PRINT "Hello, world!"
PRINT "Hit 1 for windowed mode;
PRINT " 2 for _STRETCH"
PRINT " 3 for _SQUAREPIXELS"
PRINT " 4 for _STRETCH, _SMOOTH"
PRINT " 5 for _SQUAREPIXELS, _SMOOTH"
DO
k$ = INKEY$
SELECT CASE VAL(k$)
CASE 1
_FULLSCREEN _OFF
CASE 2
_FULLSCREEN _STRETCH
CASE 3
_FULLSCREEN _SQUAREPIXELS
CASE 4
_FULLSCREEN _STRETCH, _SMOOTH
CASE 5
_FULLSCREEN _SQUAREPIXELS, _SMOOTH
END SELECT
_LIMIT 30
LOOP UNTIL _EXIT
SYSTEM
```
## See Also
* [_FULLSCREEN (function)](_FULLSCREEN-(function))
* [_ALLOWFULLSCREEN](_ALLOWFULLSCREEN)
* [_FONT](_FONT), [SCREEN](SCREEN)
* [_SCREENIMAGE](_SCREENIMAGE)
* [_SCREENMOVE](_SCREENMOVE), [_SCREENX](_SCREENX), [_SCREENY](_SCREENY)

View file

@ -1,34 +0,0 @@
The [_G2D](_G2D) function converts a **gradian** value into a **degree** value.
## Syntax
> result = [_G2D](_G2D)(num)
## Availability
* Version 1.000 and up.
## Example(s)
Coverting Gradians into Degree.
```vb
INPUT "Give me an angle in Gradians ", D
R = _G2D(D)
PRINT "That angle in Degrees is "; R
```
```text
Give me an angle in Gradians 60
That angle in Degrees is 54
```
## See Also
* [_D2G](_D2G), [_D2R](_D2R)
* [_G2R](_G2R)
* [_R2D](_R2D), [_R2G](_R2G)

View file

@ -1,34 +0,0 @@
The [_G2R](_G2R) function converts a **gradian** value into a **radian** value.
## Syntax
> result = [_G2R](_G2R)(num)
## Availability
* Version 1.000 and up.
## Example(s)
Coverting Gradians into Radians.
```vb
INPUT "Give me an angle in Gradians ", D
R = _G2R(D)
PRINT "That angle in Radians is "; R
```
```text
Give me an angle in Gradians 60
That angle in Radians is .9424778
```
## See Also
* [_D2G](_D2G), [_D2R](_D2R)
* [_G2D](_G2D), [_G2R](_G2R)
* [_R2D](_R2D), [_R2G](_R2G)

View file

@ -1,15 +0,0 @@
## Syntax
> **[_GLRENDER](_GLRENDER)** *mode*
## Parameters
Mode can be:
* _BEHIND - renders OpenGL context behind the software rendering
* _ONTOP - renders OpenGL context on the top of the software rendering [default]
* _ONLY - renders OpenGL context only
## See Also
* [Hardware images](Hardware-images)

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