GLBasic is a commercial
BASIC
BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College ...
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
that can compile to various platforms including
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
,
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
,
Mac OS X
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
, and some
handheld device
A mobile device (or handheld computer) is a computer small enough to hold and operate in the hand. Mobile devices typically have a flat LCD or OLED screen, a touchscreen interface, and digital or physical buttons. They may also have a physical ...
s. The language is designed to be simple and intuitive.
Overview
GLBasic started as an
interpreted language
In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An interprete ...
with
2D commands (GL stands for Graphics Language). It now uses the
GCC compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
for many different platforms to achieve fast,
native code
In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a very ...
results. The GLBasic precompiler "GPC" converts the simple BASIC language into
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
code and compiles it later. Thus, the user can extend GLBasic using the INLINE command to mix
C/C++ code directly with GLBasic source code. Due to this, GLBasic can easily access third-party dynamic libraries on all platforms.
The GLBasic
SDK comes with an
IDE,
debugger
A debugger or debugging tool is a computer program used to software testing, test and debugging, debug other programs (the "target" program). The main use of a debugger is to run the target program under controlled conditions that permit the pr ...
, and a graphics engine built on
OpenGL
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardwa ...
(or
OpenGL ES
OpenGL for Embedded Systems (OpenGL ES or GLES) is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accel ...
) for the platforms
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
,
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
,
Mac OS X
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
,
iOS
iOS (formerly iPhone OS) is a mobile operating system created and developed by Apple Inc. exclusively for its hardware. It is the operating system that powers many of the company's mobile devices, including the iPhone; the term also includes ...
, and
WebOS
webOS, also known as LG webOS and previously known as Open webOS, HP webOS and Palm webOS, is a Linux kernel-based multitasking operating system for smart devices such as smart TVs that has also been used as a mobile operating system. Initially ...
. For handheld devices (
Windows Mobile
Windows Mobile is a discontinued family of mobile operating systems developed by Microsoft for smartphones and personal digital assistants.
Its origin dated back to Windows CE in 1996, though Windows Mobile itself first appeared in 2000 as Pock ...
,
GP2X
The GP2X is a Linux-based handheld video game console and portable media player developed by South Korean company GamePark Holdings. It was released on November 10, 2005, in South Korea only.
The GP2X is designed for homebrew developers as wel ...
, and
GP2X Wiz
The GP2X Wiz is a handheld game console and portable media player developed by South Korean company GamePark Holdings running a Linux kernel-based embedded operating system. It was released on May 12, 2009, and was also the first console from bo ...
), GLBasic uses its own close-to-hardware routines for fast graphics.
To compile for the
iPhone or
iPad
The iPad is a brand of iOS and iPadOS-based tablet computers that are developed by Apple Inc. The iPad was conceived before the related iPhone but the iPhone was developed and released first. Speculation about the development, operating s ...
, you will need an
iMac
iMac is a family of all-in-one Mac desktop computers designed and built by Apple Inc. It has been the primary part of Apple's consumer desktop offerings since its debut in August 1998, and has evolved through seven distinct forms.
In it ...
(on which to compile the generated code - to comply with Apple's requirements) and the latest version of
Xcode
Xcode is Apple's integrated development environment (IDE) for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, and tvOS. It was initially released in late 2003; the latest stable release is version 14.2, released on December 13, ...
, which is a free download from the Apple website.
To be able to actually run the program on an iPhone or iPad (GLBasic programs will not work on the emulator), you need to be a member of the iPhone
Apple Developer Connection
Apple Developer (formerly Apple Developer Connection) is Apple Inc.'s website for software development tools, application programming interfaces (APIs), and technical resources. It contains resources to help software developers write software for ...
.
Since the release of the 8.054 beta, it became possible to compile for the
Open Pandora
The Pandora is an operating system, handheld game console and mobile personal computer originally released in 2010. It is designed to take advantage of existing free and open-source software and to be a target for homebrew development. It incl ...
machine as well. However, with the lack of Windows programming tools half of the compiling process is performed on Windows, and the other half on the actual machine. Since version 10, the IDE directly builds packages on Windows for the Pandora.
Version 8.230 and above can compile for the Web-OS devices like the
Palm Pre
The Palm Pre , styled as palm prē, is a multitasking smartphone that was designed and marketed by Palm with a multi-touch screen and a sliding keyboard. The smartphone was the first to use Palm's Linux-based mobile operating system, webOS. The ...
without additional hardware or developer program membership requirements. Support for the
HP TouchPad was added in September 2011 via a web-update.
Version 10.057 added support to build application packages running on
Android devices.
GLBasic comes with numerous examples.
Online publication
Apps created with GLBasic can be uploaded to the Apple
App Store
An App Store (or app marketplace) is a type of digital distribution platform for computer software called applications, often in a mobile context. Apps provide a specific set of functions which, by definition, do not include the running of the co ...
,
Google Play
Google Play, also known as the Google Play Store and formerly the Android Market, is a digital distribution service operated and developed by Google. It serves as the official app store for certified devices running on the Android (operating sys ...
, and HP's
App Catalog; all of which require a developer account. Costs to the developer and pre-publication review level depend on the publisher used.
For
Apple iOS
iOS (formerly iPhone OS) is a mobile operating system created and developed by Apple Inc. exclusively for its hardware. It is the operating system that powers many of the company's mobile devices, including the iPhone; the term also includes ...
the
iOS Developer Program costs US$99 per year. All apps published on the app store are required to undergo a two-week, review-and-approval process prior to publication.
For
Android there is a one-time fee of US$25. Apps published via
Google Play
Google Play, also known as the Google Play Store and formerly the Android Market, is a digital distribution service operated and developed by Google. It serves as the official app store for certified devices running on the Android (operating sys ...
Store are not subject to an approval process and are immediately available to the public.
Publishing via HP's App Catalog requires a free account. Apps placed for sale through HP's App Catalog undergo a five-day review process before publication.
A wrapper for the
Intel AppUp
The Intel AppUp center was a digital storefront for existing and new PC software, apps, content and entertainment, developed by Intel for Windows-based Ultrabook devices, netbooks, laptops, and personal computers. Peter Biddle, Intel AppUp's market ...
Centre SDK is also available for GLBasic.
Features
GLBasic has the following features:
General
*Programs are written in BASIC.
*String and numbers are automatically converted between types.
*Arrays can be a fixed size or dynamic.
*Sound, graphics and data can be compressed into a single file.
*Users can define their own types. Types within type and
dynamic array
In computer science, a dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. It is supplied with standard lib ...
s are allowed.
*C code can be included by putting appropriate code between a starting and ending command, or can be included during compilation. In addition, for Windows, functions within DLLs can be called.
*A few features are only available in PC format.
*Programs for the iOS can use OpenFeint.
3D features
*The 3D engine is simple to use and maintains fast processing of objects
*Objects can be animated
*Works with most of the common 3D formats
*Objects can have shadows
*An Entity System is available as a free open source library package
2D features
*Sprites can be rotated and scaled and take account of blending and tinting values.
*Lines, filled rectangles, and other shapes can be drawn.
Network features
*TCP/IP and UDP/IP sockets are available, as well as a higher-level library built atop the IP-sockets.
Compiler
*The compiler is cross-platform. You do need an Intel Mac to compile the generated iPhone code though, as per Apple's legal requirements.
IDE
*The editor is Windows only, but can run at a decent speed in most virtual machines. With
Wine
Wine is an alcoholic drink typically made from fermented grapes. Yeast consumes the sugar in the grapes and converts it to ethanol and carbon dioxide, releasing heat in the process. Different varieties of grapes and strains of yeasts are m ...
though, you can only compile for windows. Crossover/Mac support is given since version 10.
*A third-party editor for the Mac is being worked on.
GUI system
GLBasic comes with the source code to DDgui, an easy-to-use GUI system, allowing all supported platforms to have the same look and feel across all platforms.
For Windows, Linux and Mac GLBasic has ported a
Tcl/Tk
Tk is a free and open-source, cross-platform widget toolkit that provides a library of basic elements of GUI widgets for building a graphical user interface (GUI) in many programming languages.
Tk provides a number of widgets commonly needed to ...
wrapper that offers a native OS look.
Versions
GLBasic has gone through the following revisions:
*Version 1.2 - The first version of GLBasic (also known as The DiNGS Game Basic sequel) (2000)
*Version 2.4 - This introduced PocketPC support
*Version 3.0 - (Codename: Behemoth) added TYPEs
*Version 4.0 - Introduced the ability to interface with Window's DLLs and introduced compiling for the Xbox (if Linux is installed on it). It should also run on standard Linux, although there is no hardware acceleration, so programs run much slower. (2007)
*Version 5.0 - Introduced compiling for the Apple Mac as a Universal application
*Version 6.0 - Introduced integers into GLBasic for the first time. Previously variables could either be floating-point or strings (December 2008)
*Version 7.0 - Introduced the ability to compile for Apple iPhone and iPod Touch devices. (August 2009)
*Version 8.2 - Now free for non-commercial Projects, supports Open Pandora platform, iPhone/iPad support (August 2010)
*Version 9.0 - Introduced the ability to compile for Palm WebOS (Palm Pre, Palm Pixi). (March 2011)
*Version 10.057 - Introduced the ability to compile for Android
*Version 10.109 - Added support for
WebOS
webOS, also known as LG webOS and previously known as Open webOS, HP webOS and Palm webOS, is a Linux kernel-based multitasking operating system for smart devices such as smart TVs that has also been used as a mobile operating system. Initially ...
pads like the HP TouchPad
*Version 11.0 - Added HTML5 support
*Version 12 - Improved HTML5 port, native GUI library (January 2014)
*Version 14* - Other platforms now installed as plugins, PRESCALER, improved debugging (August 2015) *skipped v13
*Version 14 - Update: introduces support for IPv6 in network commands, libPNG updated (October 2016)
*Version 15 - "Unicorn", Improved debugging options, adds True Type Fonts (November 2017)
*Version 16 - Available through
Steam
Steam is a substance containing water in the gas phase, and sometimes also an aerosol of liquid water droplets, or air. This may occur due to evaporation or due to boiling, where heat is applied until water reaches the enthalpy of vaporization ...
, renewed C++ compiler, Windows x64 support (March 2019)
Sample code
Hello World
// this is a comment
// Print "Hello World" to the screen position 0,0 (top, left)
PRINT "Hello World", 0,0
// swap backbuffer and visible screen, prepare backbuffer for next rendering
SHOWSCREEN
// wait for a key to be pressed
KEYWAIT
Limited object-oriented scope
With Version 8, GLBasic added basic object-oriented commands to the TYPE command. This allows structures to access itself (using the 'self' command) and to have functions within TYPEs
Simple OOP test
TYPE Tvec
x;y;z
FUNCTION null:
self.x = 0; self.y=0;
ENDFUNCTION
FUNCTION add: v AS Tvec
INC self.x, v.x
INC self.y, v.y
INC self.z, v.z
END FUNCTION
END TYPE
LOCAL vec AS Tvec, vec2 AS Tvec
vec.null()
vec.x=50
vec2.x = 100
vec.add(vec2)
Version 8 can encrypt and decrypt strings using 128-bit
Blowfish
Tetraodontidae is a family of primarily marine and estuarine fish of the order Tetraodontiformes. The family includes many familiar species variously called pufferfish, puffers, balloonfish, blowfish, blowies, bubblefish, globefish, swellfis ...
.
The future
Due to the author having problems with ARM64 iOS compilers, various other problems, and insufficient time to update the software, the source code (and the forum post about it) was made to those forum members who had a post count of at least 100. The download weighs in at around 2.5 GB compressed.
See also
*
SdlBasic
SdlBasic is a multiplatform interpreter for BASIC, using the Simple DirectMedia Layer, SDL libraries. Its interpreter core is based on wxBasic. The interpreter can be very useful for people who are familiar with ANSI-BASIC interpreters and are cur ...
, an interpreted BASIC for GP2X
*
Basic4GL
*
Fenix Project
Fenix Project is the codename for a GNU project to create a free compiler for a scripting language derived from the one created by Hammer Technologies for the game development suite DIV Games Studio. However, several features have been added whic ...
, an interpreted language intended to be easier to learn than C++
*
DarkBASIC Professional
The Game Creators Ltd (TGC; formerly Dark Basic Software Limited) is a British software house based in Macclesfield, Cheshire, England, which specialises in software for video game development, originally for the Microsoft Windows platform. ...
, a Windows-only BASIC compiler
References
*''This article is based on content taken fro
GP2X wiki which is available under the terms of the GFDL.''
External links
*
Official ForumGP2X gameswritten for the GLBasic/gp2x.d
competition2008
*Externa
Language Reference Guide*Externa
Official Language Reference Guide (in English)*The GLBasi
Wiki
{{Integrated development environments
Application programming interfaces
Articles with example BASIC code
BASIC compilers
BASIC interpreters
BASIC programming language family
Video game development software
Video game development