Difference between revisions of "Types"

From uGFX Wiki
Jump to: navigation, search
(Basic)
(Rendering)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
µGFX allows to write applications (eg. GUIs) that are completely portable as the library itself is highly agnostic. To achieve this goal, users should rely on the types exposed by µGFX as much as possible to prevent problems when migration to different systems.
 
µGFX allows to write applications (eg. GUIs) that are completely portable as the library itself is highly agnostic. To achieve this goal, users should rely on the types exposed by µGFX as much as possible to prevent problems when migration to different systems.
 +
 +
== Pre-Processor ==
 +
For pre-processing related boolean operations (eg. <code>#if MY_FEATURE</code>) use <code>GFXON</code> and <code>GFXOFF</code> accordingly.
  
 
== Basic ==
 
== Basic ==
Line 19: Line 22:
 
|-
 
|-
 
| <code>gU32</code> || Unsigned integer at least 32 bits wide.
 
| <code>gU32</code> || Unsigned integer at least 32 bits wide.
 +
|-
 +
| <code>gAny</code> || Any type that fits into a memory pointer by type casting.
 +
|-
 +
| <code>gPtr</code> || A pointer to something in memory.
 +
|-
 +
| <code>gPtrDiff</code> || The difference between two pointers.
 +
|}
 +
 +
== System ==
 +
{| class="wikitable"
 +
|-
 +
! Type !! Description
 +
|-
 +
| <code>gTicks</code> || Type to represent a number of system ticks.
 +
|-
 +
| <code>gDelay</code> || Type to represent a a delay. The unit depends on the semantics for example number of ticks or milliseconds.
 +
|-
 +
| <code>gMemSize</code> || Type to represent a size of memory (in bytes).
 +
|-
 +
| <code>gFileSize</code> || Type to represent the size of a file (in bytes).
 
|}
 
|}
  
Line 26: Line 49:
 
! Type !! Description
 
! Type !! Description
 
|-
 
|-
| <code>gCoord</code> || A type to express a coordinate in pixels.
+
| <code>gCoord</code> || A (cartesian) coordinate in pixels.
 +
|-
 +
| <code>gPoint</code> || A point on the drawing canvas (x & y).
 +
|-
 +
| <code>gRect</code> || A rectangle (top left / bottom right).
 +
|-
 +
| <code>gSize</code> || A size of an area (width & height).
 +
|-
 +
| <code>gArea</code> || An area (top left / width & height).
 
|-
 
|-
 
| <code>gColor</code> || A color.
 
| <code>gColor</code> || A color.

Latest revision as of 14:44, 12 August 2021

µGFX allows to write applications (eg. GUIs) that are completely portable as the library itself is highly agnostic. To achieve this goal, users should rely on the types exposed by µGFX as much as possible to prevent problems when migration to different systems.

Pre-Processor

For pre-processing related boolean operations (eg. #if MY_FEATURE) use GFXON and GFXOFF accordingly.

Basic

Type Description
gBool A boolean value. Use gTrue and gFalse for assignments & comparisons respectively.
gI8 Signed integer at least 8 bits wide.
gU8 Unsigned integer at least 8 bits wide.
gI16 Signed integer at least 16 bits wide.
gU16 Unsigned integer at least 16 bits wide.
gI32 Signed integer at least 32 bits wide.
gU32 Unsigned integer at least 32 bits wide.
gAny Any type that fits into a memory pointer by type casting.
gPtr A pointer to something in memory.
gPtrDiff The difference between two pointers.

System

Type Description
gTicks Type to represent a number of system ticks.
gDelay Type to represent a a delay. The unit depends on the semantics for example number of ticks or milliseconds.
gMemSize Type to represent a size of memory (in bytes).
gFileSize Type to represent the size of a file (in bytes).

Rendering

Type Description
gCoord A (cartesian) coordinate in pixels.
gPoint A point on the drawing canvas (x & y).
gRect A rectangle (top left / bottom right).
gSize A size of an area (width & height).
gArea An area (top left / width & height).
gColor A color.
gFont A font. See font rendering.
gImage An image. See images.