VGA Flag Language

From Foone Wiki
Revision as of 02:06, 30 December 2023 by <bdi>Foone</bdi> (talk | contribs) (Created page with "The VGA Flag Language is a DSL for defining pride flags, to be used in VGAPride. === Example flag script: === $names=["demisexual"] $description="The Demisexual pride flag...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The VGA Flag Language is a DSL for defining pride flags, to be used in VGAPride.

Example flag script:

$names=["demisexual"]
$description="The Demisexual pride flag"
// Unknown creator. Maybe research further?
$textcolor=$black

vertical{
	RGB(255,255,255)
	RGB(255,255,255)
	RGB(110,  0,112)
	RGB(210,210,210)
	RGB(210,210,210)
}

Triangle (0,0), (240,240), (0,480), $black

Rendering context

Scripts generate a 640x480 image which uses a max of 16 colors.

The only pre-defined color is 0, which is black. The other 15 colors will be allocated as they are used, and the compiler will throw an error if too many colors are used.

The coordinate system is 0-639 horizontally, 0-479 vertically, starting in the top-left.

Overall structure

The main elements of a script are comments, variable declarations, structures, and commands.

Comments can start anywhere on a line and begin with // and continue to a newline.

Variable declarations take the form $variable_name = SOMEVALUE (see Value Types below)

Structures are curly-brace delimited blocks which automatically generate rectangle commands based on colors. See Structures below.

Commands are functions which draw different shapes into the image. See Command List below.

Value Types

There are six value types used for variables:

Name Examples Description
Integers 4

-5

+15

Whole signed numbers, 16-bits. Used for text sizing and ellipse width/height.
Colors RGB(10,20,30)

#FF00FF

A given color. Technically 6-bits-per-channel, but we're pretending they're not
Enumerations Filled

Medium

Outline

Used for special values in commands
Strings "foobar"

'bazqux'

A text string used for metadata
Points (10,25)

(-50, 500)

A point is a geometric location made of two integers.
Lists ["hello"]

[(25,0), (50,0)]

A list is a static array of values. Only used for Points and Strings.

Metadata

Some variable definitions are interpreted by VGAPride. These special definitions are: