GETTING STARTED


RCBasic comes with 2 command-line tools for creating programs. The first is rcbasic_build which takes your sourcecode in your *.bas file and compiles it into a *.cbc. The *.cbc file contains intermediate bytecode which can be ran with the rcbasic (rcbasic.exe on windows) application. To distribute your program you will need to package your *.cbc file with a copy of the rcbasic executable which needs to be renamed to the name of your *.cbc file. For Example: If you have myprogram.cbc then rcbasic needs to be renamed to myprogram (myprogram.exe on windows).

NOTE:On Windows, you need to include all the 32-bit dlls with the 32-bit executable and all the 64-bit dlls with the 64-bit executable. The rcbasic package tool will automatically do all of this for you as well as package for other systems as well.

RUN PROGRAMS FROM GEANY

LINUX
In the installer directory there is a folder called geany_files. Inside the folder there is a file named filetypes.rcbasic. You can override the geany *.bas configuration by replacing the freeBasic configuration with this file. Just copy this file to the geany filedefs path, which on most linux distibutions should be (/home/.config/geany/filedefs), and rename the file to filetypes.freebasic.

Once you have rcbasic set up with geany you just need to create a new file and save it as *.bas. Then you can compile your program by going to Build->Compile. Once your program is compiled you can run it by going to Build->Execute.

NOTE: If you want to use a different file extension for rcbasic programs you can still use this file and just set it up for a different extension. Refer to the geany documentation on how to set up different file types.


WINDOWS
Geany comes preconfigured with rcbasic on windows. Just run the start_editor.bat file and create a new *.bas file. Select the File->New with Template option in the menu to start with a simple template program. Once you have created a new *.bas file goto Build->Compile to compile your program to a *.cbc file. Then goto Build->Execute to run your program.


USING RCBASIC FROM THE COMMAND-LINE
RCBasic will be added to path on install on linux. On Windows you will need to add the rcbasic folder to your path. Either (rcbasic/rcbasic_32) or (rcbasic/rcbasic_64) depending on your operating system. Once rcbasic is in your path you can simple pass a source file to rcbasic_build to create a *.cbc file.


rcbasic_build myprogram.bas


Once you have a *.cbc file you can pass it to rcbasic to run it.


rcbasic myprogram.cbc


Both tools also except the --version argument which will simply output the version of rcbasic you are using.


rcbasic_build --version
rcbasic -version





PORTING TO OTHER PLATFORMS
If you are using geany, RCBasic comes bundled with a tool that enables you to generate binary distributions of your programs that you can distribute however you see fit. If you want to use the tool with other editors you should be able to. Just pass your project directory along with the name of your *.bas file to app_build_gui.cbc. Since RCBasic compiles to intermediate bytecode, the distributables produced by this tool only bundles it with the runtime for each platform.

This tool will be available from the Build menu on windows when you startup geany using start_editor.exe. On linux you will need to install geany from your package manager and run rcbasic_geany_config.sh to set these tools up. This will setup geany to use RCBasic for *.bas files instead of freebasic. You can modify this behavior by editing the rcbasic_geany_config.sh file.

To be able to build for Android you will need to install the Android SDK command-line tools which are available on Google's official Android SDK page. You will also need to make sure you have the ANDROID_HOME environment variable set prior to starting geany. You should ensure you have an internet connection the first time you attempt to build for Android because it will need to download some packages and do a first time setup. The first time you build for android it will take longer to build your APK because it will need to build its dependencies. Once that is done, each subsequent build should be quite a bit faster.

NOTE: If you are trying to publish an android app you will need to generate a keystore. There is a tool that comes bundles with RCBasic called gen_key that will ask you for some information and generate the keystore for you. After you create your keystore you need to enter the name of your keystore and alias along with your password on the Android Settings tab in the Distribute App tool. Also, make sure you select the release checkbox at the bottom in Android Settings.

To be able to build for the web you will need to have git installed. You will also need an internet connection the first time you build for the web since it will need to download and setup emscripten to build the runtime. This will probably take a while but it will only need to do this setup once.

For IOS, you will need to download the XCode project and put all your project files in the assets folder. Rename your *.cbc file to main.cbc. After that you should just be able to build.

All source code to these tools is written in RCBasic itself and is provided with RCBasic for you to tinker with. If you make an improvement that you would like to contribute to the RCBasic repo just checkout a branch and put up a pull-request on https://github.com/n00b87/RCBASIC3. If you do wish to contribute it is greatly appreciated.