It's not a big example of the work with the engine HGE of PureBasic. HGE powerful and enjoyable 2D engine. This example shows how to make a seamless 2D sphere with Distortion Mesh.
What is PureBasic?
PureBasic from Fantaisie Software is a portable programming language with support for both x86 and x64 architectures, as well as multiple operating systems. It is compatible with Windows, Mac, and Linux computing environments, and in fact has distinct versions for each of these operating systems. The essential functions and features, however, remain the same through all three.
PureBasic is known, first of all, for the simplicity and straightforwardness of its syntax, BASIC. It is also reputed by developers to be an excellent solution for those who need to create executable files that have been optimized extensively. It sports full Unicode support, boasts a speedy compiler, and precludes the need for runtime interpreters or outside-sourced DLLs when being used to generate an executable. Programmers are also given access to the complete API.
It supports two-dimensional games and can also support 3D via OGRE. It offers cross-platform-portable source code. The built in profiling utility can be used to inspect as well as trace code, and is supplemented by an internal debugger. It supports inline assembly, comes with a lifetime license model, and offers support for some other 3D environments for users who want to access 3D via an engine other than OGRE.
Find the official PureBasic downloadFile types supported by PureBasic
Our users primarily use PureBasic to open these file types:
By Prof. Jones (The File Expert)
Chief Content Editor and File Expert
Suggestions for this page? Mail me
Paradigm | structured, imperative, procedural |
---|---|
Family | BASIC |
Designed by | Fantaisie Software |
Developer | Fantaisie Software |
First appeared | 1998 (AmigaOS) 2000 (Windows) |
Stable release | |
OS | cross-platform: Microsoft Windows, Linux, macOS(active) AmigaOS(discontinued, open source) |
License | commercial |
Filename extensions | .pb, .pbi, .pbf, .pbp, .pbv |
Website | www.purebasic.com |
Influenced by | |
BASIC |
PureBasic is a commercially distributedprocedural computer programming language and integrated development environment based on BASIC and developed by Fantaisie Software for Windows 32/64-bit, Linux 32/64-bit, and macOS. An Amiga version is available, although it has been discontinued and some parts of it are released as open source. The first public release of PureBasic for Windows was on December 17, 2000. It has been continually updated since.
PureBasic has a 'lifetime license model'. As cited on the website, the very first PureBasic user (who registered in 1998) still has free access to new updates and this is not going to change.[1]
PureBasic compiles directly to x86, x86-64, PowerPC or 680x0 instruction sets, generating small standalone executables and DLLs which need no runtime libraries beyond the standard system libraries. Programs developed without using the platform-specific application programming interfaces (APIs) can be built easily from the same source file with little or no modification.
PureBasic supports inline assembly, allowing the developer to include FASM assembler commands within PureBasic source code, while using the variables declared in PureBasic source code, enabling experienced programmers to improve the speed of speed-critical sections of code. PureBasic supports and has integrated the OGRE 3D Environment. Other 3D environments such as the Irrlicht Engine are unofficially supported.
- 1Programming language
Programming language[edit]
Characteristics[edit]
PureBasic is a native 32 bit and 64 bit BASIC compiler. The code is highly portable. Currently supported systems are Windows, Linux, macOS. The AmigaOS version is now legacy and open-source. The compiler produces very fast and highly optimized executables and the syntax of PureBasic is simple and straightforward.[2] It can compile console applications,[3] GUI applications,[4] and DLL files.[5]
Hello World example[edit]
The following single line of PureBasic code will create a standalone x86 executable (4.5 KiB (4,608 bytes) on Windows version) that displays a message box with the text 'Hello World'.
And the following variant of the same code, which instead uses an inline Windows API call with no need for declarations or other external references, will create an even smaller 2.0 KiB (2,048 bytes) standalone x86 executable for Windows.
The following is a console version of the Hello World example.
Procedural programming[edit]
PureBasic is a 'Second generation BASIC' language, with structured conditionals and loops, and procedure-oriented programming supported. The user is not required to use procedures, so a programmer may opt for a coding style which includes Goto, Gosub Label, and Return.
Below is a sample procedure for sorting an array, although SortArray is now a built-in function of PureBasic.
Below is a sample program that displays a sizeable text editor with two menu items.
Note that PureBasic does not escape double quotes in strings so these must be concatenated with Chr(34).
Object-oriented programming[edit]
Fred, the developer of PureBasic, has stated that PureBasic will never be object oriented.[6] However, numerous users have created object oriented support systems.[7][8][9]
Data types[edit]
Variable data type specified when you first use it (and optionally - in the future), and is separated from the name of the point. There is a set of basic types - .f, .d (float and double numbers), .b, .c, .w, .l, .q (integers - from single-byte and 8-byte), .s - strings.
Type | Suffix | Memory usage | Numerical range |
---|---|---|---|
Byte | b | 1 byte (8 bits) | −128 … +127 |
Ascii | a | 1 byte (8 bits) | 0 … +255 |
Character | c | 1 byte (8 bits) (ascii) | 0 … +255 |
Word | w | 2 bytes (16 bits) | −32768 … +32767 |
Unicode | u | 2 bytes (16 bits) | 0 … +65535 |
Character | c | 2 bytes (16 bits) (unicode) | 0 … +65535 |
Long | l | 4 bytes (32 bits) | −2147483648 … +2147483647 |
Integer | i | 4 bytes (32 bits) x86 | −2147483648 … +2147483647 |
Float | f | 4 bytes (32 bits) | Depending on the ratio of the decimal number. |
Integer | i | 8 bytes (64 bits) x64 | −9223372036854775808 … +9223372036854775807 |
Quad | q | 8 bytes (64 bits) | −9223372036854775808 … +9223372036854775807 |
Double | d | 8 bytes (64 bits) | Depending on the ratio of the decimal number. |
String | s | (String length + 1) * SizeOf(Character) | No limit. |
Fixed String | s{length} | (String length) * SizeOf(Character) | No limit. |
- Note: Len(String) used to count the length of a string will not exceed the first null character (Chr(0)).
In addition to basic types, the user can define the type of construction via
Variables can be single (actually, standard variables), dynamic array (declared using the
Dimvar_name.type_name(size1,size2,...)
, a linked list (List()var_name.type_name
), an associative array (in new versions of language) (Mapvar_name.type_name()
)Form Designer RAD[edit]
PureBasic has its own form designer to aid in the creation of forms for applications, but other third-party solutions are also available.[10][11][12] The original non-integrated Visual Designer was replaced with a new integrated Form Designer on 14 Feb, 2013.[13]
User community[edit]
PureBasic provides an online forum for users to ask questions and share knowledge. On 6 May 2013 the English language forum had 4,769 members and contained 44,043 threads comprising 372,200 posts since May 17, 2002.[14]
Numerous code sharing sites show PureBasic is used to create tools[15] and games in a fast and easy way,[16] and share large amounts of open-source code.[17]
Further reading[edit]
- Willoughby, Gary (2006). Purebasic: A Beginner s Guide to Computer Programming. ISBN1-4276-0428-2.
- Logsdon, John. Programming 2D Scrolling Games.This book is now freely downloadable
- Basic Compilers: QuickBASIC, PureBasic, PowerBASIC, Blitz Basic, XBasic, Turbo Basic, Visual Basic, FutureBASIC, REALbasic, FreeBASIC. ISBN1-155-32445-5.
Bibliography[edit]
- Hale Ligh, Michael (2010). Malware Analysts Cookbook Tools for Thwarting Malicious Attacks. Indianapolis, IN: John Wiley & Sons Inc. p. 241. ISBN0-470-61303-3.
- Galbreath, Nick (2002). Cryptography for Internet and database applications : developing secret and public key techniques with Java. Indianapolis, Ind.: Wiley. p. 300. ISBN978-0-471-21029-0.
- 'Learning to Crack Code'. Manly Daily. Jun 25, 2004.
- Georges, Philippe. 'La programmation avec PureBasic'. PROgrammez (141).
- Svoboda, Luboš (2012). Překvapivý PureBasic (Surprising PureBasic: A Czech ebook for prospective users of PureBasic). p. 89.
References[edit]
- ^FAQ lifetime licence details
- ^PureBasic home page
- ^PureBasic - Console
- ^PureBasic - Gadget
- ^Building a DLL
- ^PureBasic won't be object oriented
- ^PureObject: PureBasic OOP support
- ^OOP tutorial
- ^Another OOP PreCompiler
- ^PureVision, Professional form design for PureBASIC.
- ^ProGUI, DLL library comprising more than 100 well documented commands to quickly incorporate rich, customizable GUI components into your applications.
- ^PureFORM, Freeware form designer.
- ^PureBasic 5.10 is released
- ^English forum, Official forum.
- ^Horst Schaeffer's Software Pages
- ^PureArea
- ^Andre Beer's code archive.
External links[edit]
- PureBasic at Curlie
- Articles
- PureBasic - The Perfect Cross-Platform & Native Development Language (2015)
- A little PureBasic review (2019)
- Libraries and Open Source Code Archives
Retrieved from 'https://en.wikipedia.org/w/index.php?title=PureBasic&oldid=901055810'