Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Grambol  (Read 1632 times)

0 Members and 1 Guest are viewing this topic.

Hapax

  • Hero Member
  • *****
  • Posts: 3462
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Grambol
« on: November 15, 2025, 03:22:25 am »


Introducing Grambol, a system for programmable symbols for use with SFML. That is, they become "vector" graphics similar to "clip-art".

Grambol is an entirely header-based library. The base classes (Symbol, PlainSymbol and FullSymbol) as well as all Provided Symbol Groups are all each contained within a single file.

The base class/classes gives similar features and interface to SFML's own Shape class. However, it expands the idea to allow derived classes to have more flexibility and control. For example, they can specify which primitive type is used as well as allowing multiple colours within one symbol.

Each symbol is set up in a similar way to a rectangle; it has a width and height. All point calculations in Grambol are ratios - in the range of 0 to 1. That is the x co-ordinate 0-1 expands to 0-width and the y co-ordinate 0-1 expands to 0-height. This "rectangle" is the foundational two-dimensional space in which the symbol is contained. The points can use this information however they choose - including expanding outside of this rectangle.

The main base class, Symbol, is all that is required. It provides all the of the base code to use. However, two other "base" classes are provided: PlainSymbol and FullSymbol. These are derived from Symbol but include some specific features. PlainSymbol simply adds setting and getting of the symbol's (single) colour. This is perfect for single colour symbols. FullSymbol adds ability to set a palette of multiple colours, allowing each point to use any one of these colours. This allows a single symbol to be multi-coloured.

The base classes available:
  • Symbol
    This main, base class is all that is required to create Grambol symbols
  • PlainSymbol
    This is a Symbol with specialisation to allow setting a single colour
  • FullSymbol
    This is a Symbol with specialisation to allow setting a palette of multiple colours

In addition to the main functionality of Grambol, some Provided Symbol Groups "PSG" are also included with some commonly-used and flexible symbols.

Currently available PSGs:
  • Basic
    some basic symbols
  • BasicGradient
    the same basic symbols in Basic with added gradient
  • Arrow
    multiple different types of customisable arrows
  • CardSuit
    symbols representing the suits of standard playing cards
  • Icon
    some common symbols often used as icons

The logo (above) was entirely created using Grambol symbols except the curve of the G and the lines in the M (those were Selba Ward's Spline with only some minimal image post processing. All of the symbols are a part of Provided Symbol Groups that are either already provided or are still to come; they will all be available.

G: standard arrow [Arrow]
R: 2 x pin [Icon] + heart [CardSuit]
A: impossible triangle [Misc - not yet available]
M: die face (value of 5) [Dots - not yet available]
B: Bluetooth logo [Icon]
O: radiation warning [Warning - not yet available] + ellipse [Basic] + cog [Icon]
L: Braille (character is technically a 'V') [Dots - not yet available]

In each of the Provided Symbol Group's wiki page, there is a simple example that demonstrates some of the ways they can be used. Here are screenshots of those simple example (with added anti-alias):

Basic


BasicGradient


Arrow


CardSuit (frames not included in Simple Example - added later from Basic group)


Icon


Wiki: https://github.com/Hapaxia/Grambol/wiki
Repo: https://github.com/Hapaxia/Grambol
« Last Edit: November 15, 2025, 03:26:36 am by Hapax »
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything