PureBasic
PureBasic is a Computer programming language of the type BASIC. The current version is 4.10. Several points characterize it:
- Simplicity: syntax BASIC is simple to learn.
- Speed: the produced applications are optimized (reduced size) and rapids (as fast as the c++ in certain cases).
- Portability: the source code is portable of a Operating system to the other. There exists a version of PureBasic for AmigaOS, Linux, Windows, and Mac OS.
PureBasic has a wide command set (more than 800 internal orders) to which is added a simplified access of most of API of the operating system. The programmer can call the orders of API of Windows, of Linux or Mac OS directly as if they were internal orders with PureBasic, without having to declare them as a preliminary (as well as the constants). Nothing better than an example practices to illustrate this. Let us compare a simple program in visual BASIC with its equivalent in PureBasic: How to obtain the way of the Windows repertory.
-
Visual BASIC:
-
PureBasic:
Libraries
For information, here the official list of the PureBasic libraries:
-
general Libraries
-
2D Drawing, CDAudio, Cipher, Clipboard, Console, Database, Date, Desktop, DragDrop, File, FileSystem, Makes,
- Gadget, Help, Image, ImagePlugin, Library, Linked List, Math, Memory, Menu, Misc, Movie, Network,
- OnError, Packer, Preference, Process, Printer, Requester, Scintilla, Sort, StatusBar, String, SysTray, Thread,
- Toolbar, Window, XML
- Gadget, Help, Image, ImagePlugin, Library, Linked List, Math, Memory, Menu, Misc, Movie, Network,
-
Libraries for the plays 2D
-
Joystick, Keyboard, Module, Foam, Pallet, Sprite & Screen, Sprite3D, Sound, SoundPlugin
-
Libraries for the plays 3D
-
Engine3D, Billboard, Camera, Entity, Light, Material, Mesh, Particle, Ground, Texture
You can of course create your own libraries in language C or assembler, or directly in PureBasic thanks to a utility developed by a user of PureBasic (Tailbite).
Examples
This simple line of PureBasic code will create achievable autonomous tiny of 3,00 KB (3 072 bytes) for Windows.
MessageRequester (" " , " Hello World")
And what follows is a court but perfect example of a functional program with PureBasic. The sum of the numbers seized by the user is posted automatically. This program shows how to create a window, gadgets additional, as well as the management of the events and a simple mathematical calculation. This code compiles in achievable autonomous of 14,5 KB (14 848 bytes) which can be used on any PC equipped with Windows 95 to waiter 2003 of Windows while passing by Windows XP.
OpenWindow (1,300,300,100,100, " Title" , #PB_Window_SystemMenu) CreateGadgetList (WindowID (1)) StringGadget (1,10,10,50,20, " ") StringGadget (2,10,40,50,20, " ") TextGadget (3,80,30,50,20, " ") Repeat ev=WaitWindowEvent () Yew ev=#PB_Event_Gadget op1=Val (GetGadgetText (1)) op2=Val (GetGadgetText (2)) SetGadgetText (3, Str (op1+op2)) EndIf Until ev=#PB_Event_CloseWindow End
Visual designer
The visual editor of PureBasic (originator of graphical interfaces user) was created for the PureBasic computer programming language and is of course developed in PureBasic.
PureBasic collaboration/Other languages and files
In addition to the fact of reaching API of Windows, the PureBasic language, when it east uses in console, can use the scripts BATCH (language MSDOS) separated, whose exits users will be posted directly in the window of the PureBasic console, and not in a separate window. Certain processes batch remain however inaccessible, like the conditions…
Example:
File PureBasic (thus main file)
OpenConsole () EnableGraphicalConsole (1) RunProgram (" BATCH.bat") Input ()
File BATCH (under program):
@echo off echo. echo This is a Batch of example for WIKIPEDIA echo. exit
The PreBAsic program, compiled out of assembler, will give, if BATCH.bat is in the same file, one program in console posting:
A blank line A text (This is a Batch of example for WIKIPEDIA) A blank line
And this program will await an entry of give by the user and a validation by ENTRY ENTER to close, thanks to the function Input ()
Important note: Of course, this Batch collaboration/PureBasic is not possible that under Windows…
For the use of the other types of files, PureBasic integrates bookstores to decode JPEG, the video files. These bookstores are quoted previously. During the compilation of a program, the programmer can choose to integrate other resources into his project via the options of the compiler.
Bonds
- PureBasic : official site
- PureArea.net: essential site
- Ranges-Creators French gate of the video plays
| Random links: | Prophet | Pont- on-Meuse | Arquèves | Greer Garson | Rain off has Thousand Flames | Mary_Steenburgen |