Codebot Cross Library

This is the official landing page for the Codebot Cross library. Source code, assets, and example projects are hosted on Github under the GLPv3 open source license. The library has been in constant development for over a decade and has been updated or hosted on various servers, but the main line is now and will in the future be permanently synchronized with Github.

The packages and other assets contained in the library are designed to be used with the Free Pascal compiler and the Lazarus IDE. It adds many enhancements, performance improvements, advanced design elements, routines, classes components, and controls.

Installation

To make use of this library you'll need to clone or download it from the official Github repository. You'll need to open the appropriate package from the source folder and build it. This step will register the package with the IDE. You can then start any new project and use the project inspector to add "codebot" or "codebot controls" package as a requirement. After adding the requirement you can make use of the library in that project.

Registering a Package

The following are the steps you would take in the Lazarus IDE to install the controls packages.
  1. Open the codebot.lpk package and press the build button.
  2. Open the codebot_controls.lpk package and press the build button.
  3. Open the codebot_controls_design.lpk package and press the build button.
  4. In the codebot_controls_design.lpk package click use -> install.
  5. When prompted click yes to rebuild the IDE.
If any of the steps fail, try exiting Lazarus, opening it again, and starting over from step 1.

Project Source

When using this library it is recommended to place the
Codebot.System
unit as the first unit in your project uses clause. You can then delete any platform specific threading or memory management units from the project source. The
Codebot.System
unit will take care of these platform specific options for you.

Unit Options

Please note all the source code units in the library use
{$mode delphi}
and reference a
{$i codebot.inc}
standard library include file that defines unit level compilation options.

Documentation

Most of the content in the Codebot Cross library is well documented in its source code files. Every type, function, class, and method is decorated with detailed information in the form of comments. Some of the content is categorized by group, functionality, and is often linked to other related content. Most of the content is further organized by regions, which can be expanded or collapsed in the IDE.

Example

Below is an example of how the documentation appears in the source code taken from the command line switch routines of the
Codebot.System
unit. Most of the content in this library is organized in this fashion, and reading or browsing the source code should provide users with more than enough information to understand how content in the library can be used.
{ Returns true if a program has a matching switch
  See also
  <link Codebot.System.SwitchIndex, SwitchIndex function>
  <link Codebot.System.SwitchValue, SwitchValue function>
  [group string] }
function SwitchExists(const Switch: string): Boolean;
{ Returns the index of a program's matching switch or -1 if no match was found
  See also
  <link Codebot.System.SwitchExists, SwitchExists function>
  <link Codebot.System.SwitchValue, SwitchValue function>
  [group string] }
function SwitchIndex(const Switch: string): Integer;
{ Returns the value of a program's switch
  See also
  <link Codebot.System.SwitchExists, SwitchExists function>
  <link Codebot.System.SwitchIndex, SwitchIndex function>
  [group string] }
function SwitchValue(const Switch: string): string;

Organization

The source code in this library is organized into three packages. These packages are the base package, the control package, and the rendering package. The last two packages depend on the base package.

Below is a brief summary of the three packages.

Codebot Package

The codebot package is the base package of this library. It includes routines and classes for general programming purposes. Some of the functionality includes enhanced string handling, dynamic array extensions, file and directory services, simplified threading, multicast delegates, simplified sockets with SSL/TLS support, an advanced graphics interface, XML, JSON, text encoding, and much more.

Functionality is organized by dotted unit namespace names. For example the an XML interface is provided in the
Codebot.Text.XML
namespace, while an implemenation of FTP is provided by the
Codebot.Networking.FTP
namespace. This design pattern of related functionality group into general then progressively more specific namespaces is repeated throughout the entire library.

Controls Package

The controls package relies on the codebot package and provides a collection of components, controls, and IDE designer enhancements. All controls make use of the advanced graphic interface defined in the codebot base package. These advanced graphics are exposed by way of a
ISurface
property and a protected virtual
Render
method that can be override.

Some of the custom controls include
TContentGrid
,
THuePicker
,
TIndeterminateProgress
,
TDrawList
,
TRenderBox
,
TThinButton
, and
TSlideBar
. Several custom form modules are also included in the controls package as well as useful components such as
TTextStorage
, and
TImagStrip
.

Rendering Package

The rendering package contains routines and classes encapsulating for working with OpenGL rendering. It does not specify a rendering control, rather it only relies on a valid OpenGL context to operate. The package units handle loading OpenGL library functions, managing an OpenGL context, and it provides an object oriented interface to working with textures, frame buffers, vertex buffers, shader programs, scene and asset management, as well as property animation and storyboarding.

Demonstration

The following is a small list of programs demonstrating various features of the Codebot Cross library. They have been written over some years and come from a variety of platforms and sources, but serve as a basic demonstration of some of the functionality of this library.

Surface Graphics Interface

This article demonstrates how the advanced surface graphics interface of the codebot package is designed and how it can be used. Example source code is shown detailing the surface rendering interface with a bit of detailed explanation.

Animation and Easings

This article demonstrates how animations and easings can be added to the advanced surface graphics interface. Detail information is provide on the subject in the article.

Network Protocols

This article demonstrates how the networking and string handling functions of the library can be used to implement an Internet protocol. A video with voice over goes through writing an application to connect to servers and display their contents.

Color Picking Controls

This project contains a video demonstrating the color picking controls. There are actually three controls that work together. These include a hue picker, a saturation picker, and an alpha value slider controls.

Layered Window with Controls

This project demonstrates an application consisting entirely of a layered window user interface including layer controls. The user interface is rendered entirely by surface graphics.

Desktop Dock Style Widget

This aricle explains how an Apple MacOS dock style widget can be created using the library. In it a series of animated icons are rendered over your desktop and they grow or shrink depending on your mouse position.

OpenGL Fractals

This project makes use of the rendering package to create a mandelbrot scene calculated in shader programs. The underlying code demonstrates how to integrate user interface controls, OpenGL rendering, and asset management in a project.

Multicast Delegates

This article describes multicast delegates as they are implemented in the codebot package. These delegates allow for multiple event registration and notification to be connected to a single property.